def rename(self, registry, names): for old_name, new_name in names: old_name = unicodify(old_name) new_name = unicodify(new_name) if new_name in self: raise ValueError( u'An item of the same name ("%s") already ' 'exists.' % new_name) obj = self.remove(registry, old_name) self.add(registry, new_name, obj) return True
def set_password(self, value, key=None): """ Encrypt a plaintext password. """ if not isinstance(value, unicode): value = unicodify(value) if len(value) < 5: raise ValueError("Password must be longer than 4 chars") self._field_storage['password'] = get_sha_password(value)
def order(self, value): pool = list(self.data.keys()) new_order = [] for key in value: new_order.append(key) pool.remove(key) if pool: new_order.extend(pool) self._order = tuple([unicodify(x) for x in new_order])
def check_input(self, value): if not isinstance(value, basestring): raise TypeError("check_input only accepts strings as input, got %s" % value) encrypted = self.get(default=_marker) if encrypted is _marker: return False if not isinstance(value, unicode): value = unicodify(value) return self.hash_method(value) == encrypted
def _callFUT(self, name, sysencoding=None): from repoze.folder import unicodify return unicodify(name, sysencoding)
def set(self, value, **kwargs): if not isinstance(value, unicode): value = unicodify(value) if not len(value) >= self.min_length: raise ValueError("Password shorter than required %s chars" % self.min_length) self.__encrypted_password__ = self.hash_method(value)
def _set_uid(self, value): value = unicodify(value) self.set_field_value('uid', value)
def uid(self, value): self.set_field_value('uid', unicodify(value))