Univention Bugzilla – Attachment 7715 Details for
Bug 41424
Add Sanitizer(allow_none=True)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
41424.patch (text/plain), 1.44 KB, created by
Florian Best
on 2016-06-02 15:21 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-06-02 15:21 CEST
Size:
1.44 KB
patch
obsolete
>diff --git a/management/univention-management-console/src/univention/management/console/modules/sanitizers.py b/management/univention-management-console/src/univention/management/console/modules/sanitizers.py >index 1c511ef..cd9b510 100644 >--- a/management/univention-management-console/src/univention/management/console/modules/sanitizers.py >+++ b/management/univention-management-console/src/univention/management/console/modules/sanitizers.py >@@ -149,6 +149,8 @@ class Sanitizer(object): > :param bool may_change_value: if the process of sanitizing is allowed > to alter *request.options*. If not, the sanitizer can still be used > for validation. Default: *True* >+ :param bool allow_none: if None is allowed and not further validated. >+ Default: *False* > ''' > > def __init__(self, **kwargs): >@@ -156,6 +158,7 @@ def __init__(self, **kwargs): > self.required = kwargs.get('required', False) > self.default = kwargs.get('default', None) > self.may_change_value = kwargs.get('may_change_value', True) >+ self.allow_none = kwargs.get('allow_none', False) > > def sanitize(self, name, options): > '''Sanitize function. Internally calls _sanitize with the >@@ -173,6 +176,8 @@ def sanitize(self, name, options): > else: > return self.default > value = options[name] >+ if value is None and self.allow_none: >+ return value > if self.further_arguments: > further_arguments = dict([(field, options.get(field)) for field in self.further_arguments]) > else:
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 41424
: 7715