equal
deleted
inserted
replaced
789 access_level = self.cleaned_data[field] |
789 access_level = self.cleaned_data[field] |
790 |
790 |
791 if not has_access(rights, access_level, scope_path, prefix): |
791 if not has_access(rights, access_level, scope_path, prefix): |
792 self._errors[field] = ErrorList([DEF_NO_RIGHTS_FOR_ACL_MSG]) |
792 self._errors[field] = ErrorList([DEF_NO_RIGHTS_FOR_ACL_MSG]) |
793 del self.cleaned_data[field] |
793 del self.cleaned_data[field] |
|
794 |
|
795 def str2set(string_field): |
|
796 """Clean method for cleaning comma separated string in the edit form. |
|
797 |
|
798 Obtains the comma separated string from the form and stores it as |
|
799 returns it as a list of strings. |
|
800 """ |
|
801 |
|
802 def wrapper(self): |
|
803 """Decorator wrapper method. |
|
804 """ |
|
805 cleaned_data = self.cleaned_data |
|
806 |
|
807 string_data = cleaned_data.get(string_field) |
|
808 |
|
809 list_data = [] |
|
810 for string in string_data.split(','): |
|
811 string_strip = string.strip() |
|
812 if string_strip and string_strip not in list_data: |
|
813 list_data.append(string_strip) |
|
814 |
|
815 cleaned_data[string_field] = list_data |
|
816 |
|
817 return cleaned_data[string_field] |
|
818 |
|
819 return wrapper |