From a5847a6fb2394f8609fc64ab2e66fd345728bd91 Mon Sep 17 00:00:00 2001 From: helmutm Date: Fri, 12 Oct 2007 14:08:39 +0000 Subject: [PATCH] use new Jeep convenience methods for position of fields on schemas git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2110 fd906abe-77d9-0310-91a1-e0d9ade77398 --- organize/browser.py | 26 +++++++++++++------------- schema.py | 8 +++----- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/organize/browser.py b/organize/browser.py index d6ebf63..d962152 100644 --- a/organize/browser.py +++ b/organize/browser.py @@ -64,17 +64,17 @@ class MyStuff(ConceptView): return self -class PasswordWidget(BasePasswordWidget): - - def getInputValue(self): - value = super(PasswordWidget, self).getInputValue() - confirm = self.request.get('form.passwordConfirm') - if confirm != value: - v = _(u'Password and password confirmation do not match.') - self._error = WidgetInputError( - self.context.__name__, self.label, v) - raise self._error - return value +#class PasswordWidget(BasePasswordWidget): +# +# def getInputValue(self): +# value = super(PasswordWidget, self).getInputValue() +# confirm = self.request.get('form.passwordConfirm') +# if confirm != value: +# v = _(u'Password and password confirmation do not match.') +# self._error = WidgetInputError( +# self.context.__name__, self.label, v) +# raise self._error +# return value class MemberRegistration(NodeView, CreateForm): @@ -100,8 +100,8 @@ class MemberRegistration(NodeView, CreateForm): @Lazy def schema(self): schema = super(MemberRegistration, self).schema - if 'birthDate' in schema.fields: - del schema.fields['birthDate'] + schema.fields.remove('birthDate') + schema.fields.reorder(-2, 'loginName') return schema @Lazy diff --git a/schema.py b/schema.py index a30b9d3..4e2842d 100644 --- a/schema.py +++ b/schema.py @@ -44,9 +44,8 @@ class FileSchemaFactory(SchemaFactory): def __call__(self, interface, **kw): schema = super(FileSchemaFactory, self).__call__(interface, **kw) - if ('request' in kw and kw['request'].principal.id != 'rootadmin' - and 'contentType' in schema.fields.keys()): - del schema.fields['contentType'] + if 'request' in kw and kw['request'].principal.id != 'rootadmin': + schema.fields.remove('contentType') return schema @@ -56,8 +55,7 @@ class NoteSchemaFactory(SchemaFactory): def __call__(self, interface, **kw): schema = super(NoteSchemaFactory, self).__call__(interface, **kw) - del schema.fields['description'] + schema.fields.remove('description') schema.fields.data.height = 5 return schema -