some fixes for schema composer

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2906 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-09-26 17:29:57 +00:00
parent f58b622ddd
commit aecca2f1a5
2 changed files with 8 additions and 3 deletions

View file

@ -39,6 +39,7 @@ class Email(schema.TextLine):
# put field type name and other info in standard field classes. # put field type name and other info in standard field classes.
schema.Field.__typeInfo__ = ('textline',) schema.Field.__typeInfo__ = ('textline',)
schema.Choice.__typeInfo__ = ('dropdown',)
class SchemaFactory(object): class SchemaFactory(object):
@ -61,7 +62,7 @@ class SchemaFactory(object):
schema.Float: ('number',), schema.Float: ('number',),
schema.Bool: ('checkbox',), schema.Bool: ('checkbox',),
schema.List: ('list',), schema.List: ('list',),
schema.Choice: ('dropdown',), #schema.Choice: ('dropdown',),
schema.Bytes: ('fileupload',), schema.Bytes: ('fileupload',),
#Email: ('email',), #Email: ('email',),
} }
@ -84,6 +85,7 @@ class SchemaFactory(object):
getattr(field, 'vocabularyName', None)) getattr(field, 'vocabularyName', None))
f = Field(field.getName(), f = Field(field.getName(),
fieldType=info[0], fieldType=info[0],
fieldTypeInfo=len(info) > 1 and info[1] or None,
required=field.required, required=field.required,
default=field.default, default=field.default,
default_method=getattr(field, 'default_method', None), default_method=getattr(field, 'default_method', None),
@ -91,6 +93,9 @@ class SchemaFactory(object):
title=field.title, title=field.title,
description=field.description, description=field.description,
readonly=field.readonly, readonly=field.readonly,
nostore=getattr(field, 'nostore', False),) #value_type=getattr(field, 'value_type', None),
nostore=getattr(field, 'nostore', False),
multiple=getattr(field, 'multiple', False),
baseField=field,)
fields.append(f) fields.append(f)
return Schema(name=interface.__name__, *fields, **kw) return Schema(name=interface.__name__, *fields, **kw)

View file

@ -209,7 +209,7 @@ class DateFieldInstance(NumberFieldInstance):
if value is None: if value is None:
return '' return ''
view = self.clientInstance.view view = self.clientInstance.view
langInfo = view and view.languageInfo or None langInfo = view and getattr(view, 'languageInfo', None) or None
format = self.context.display_format or ('dateTime', 'short') format = self.context.display_format or ('dateTime', 'short')
if langInfo: if langInfo:
locale = locales.getLocale(langInfo.language) locale = locales.getLocale(langInfo.language)