fixes for composer.schema to be usable for loops member registration
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2102 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
		
							parent
							
								
									55e801431e
								
							
						
					
					
						commit
						e8db37544f
					
				
					 6 changed files with 26 additions and 10 deletions
				
			
		|  | @ -71,7 +71,7 @@ class Form(object): | |||
| 
 | ||||
|     @Lazy | ||||
|     def fields(self): | ||||
|         return self.schema.fields | ||||
|         return [f for f in self.schema.fields if not f.readonly] | ||||
| 
 | ||||
|     @Lazy | ||||
|     def data(self): | ||||
|  |  | |||
|  | @ -83,7 +83,17 @@ | |||
|            tal:attributes="name name; | ||||
|                            style python: | ||||
|                                 'width: %s' % (width and str(width)+'px' or '450px'); | ||||
|                            value data/?name" /> | ||||
|                            value data/?name|string:" /> | ||||
| </metal:textline> | ||||
| 
 | ||||
| 
 | ||||
| <metal:textline define-macro="input_date"> | ||||
|     <input type="text" name="field" style="width: 450px" | ||||
|            tal:define="width field/width|nothing" | ||||
|            tal:attributes="name name; | ||||
|                            style python: | ||||
|                                 'width: %s' % (width and str(width)+'px' or '450px'); | ||||
|                            value data/?name|string:" /> | ||||
| </metal:textline> | ||||
| 
 | ||||
| 
 | ||||
|  | @ -93,7 +103,7 @@ | |||
|            tal:attributes="name name; | ||||
|                            style python: | ||||
|                                 'width: %s' % (width and str(width)+'px' or '450px'); | ||||
|                            value data/?name" /> | ||||
|                            value data/?name|string:" /> | ||||
| </metal:password> | ||||
| 
 | ||||
| 
 | ||||
|  | @ -105,7 +115,7 @@ | |||
|                            rows python: height or 3; | ||||
|                            style python: | ||||
|                                 'width: %s' % (width and str(width)+'px' or '450px');" | ||||
|            tal:content="data/?name"> | ||||
|            tal:content="data/?name|string:"> | ||||
|     </textarea> | ||||
| </metal:textarea> | ||||
| 
 | ||||
|  | @ -126,7 +136,7 @@ | |||
|               tal:content="item/title" | ||||
|               tal:attributes="value item/token; | ||||
|                               selected python: | ||||
|                     item['token'] == data[name]">Mrs</option> | ||||
|                     item['token'] == data.get(name)">Mrs</option> | ||||
|     </select> | ||||
| </metal:dropdown> | ||||
| 
 | ||||
|  |  | |||
|  | @ -68,6 +68,8 @@ class SchemaFactory(object): | |||
|                         #default_method=getattr(field, 'default_method', None), | ||||
|                         vocabulary=voc, | ||||
|                         title=field.title, | ||||
|                         description=field.description) | ||||
|                         description=field.description, | ||||
|                         readonly=field.readonly, | ||||
|                         nostore=getattr(field, 'nostore', False),) | ||||
|                 fields.append(f) | ||||
|         return Schema(name=interface.__name__, *fields, **kw) | ||||
|  |  | |||
|  | @ -38,6 +38,8 @@ class Field(Component): | |||
|     implements(IField) | ||||
| 
 | ||||
|     required = False | ||||
|     readonly = False | ||||
|     nostore = False | ||||
|     standardFieldName = None | ||||
|     vocabulary = None | ||||
|     renderFactory = None | ||||
|  | @ -73,7 +75,7 @@ class Field(Component): | |||
| 
 | ||||
|     @property | ||||
|     def storeData(self): | ||||
|         return self.getFieldTypeInfo().storeData | ||||
|         return not self.nostore and self.getFieldTypeInfo().storeData | ||||
| 
 | ||||
|     def getTitleValue(self): | ||||
|         return self.title or self.name | ||||
|  |  | |||
|  | @ -78,7 +78,7 @@ class Editor(BaseInstance): | |||
|             # don't do anything if there is an error | ||||
|             return formState | ||||
|         for f in template.components: | ||||
|             if not f.storeData: | ||||
|             if not f.storeData or f.readonly: | ||||
|                 # a dummy field, e.g. a spacer | ||||
|                 continue | ||||
|             name = f.name | ||||
|  | @ -99,7 +99,9 @@ class Editor(BaseInstance): | |||
|         formState = FormState() | ||||
|         if self.template is None: | ||||
|             return formState | ||||
|         for f in self.template.fields: | ||||
|         for f in self.template.components: | ||||
|             if f.readonly: | ||||
|                 continue | ||||
|             fi = f.getFieldInstance() | ||||
|             value = data.get(f.name) | ||||
|             fi.validate(value, data) | ||||
|  |  | |||
|  | @ -86,7 +86,7 @@ fieldTypes = SimpleVocabulary(( | |||
|     FieldType('textarea', 'textarea', u'Textarea'), | ||||
|     FieldType('number', 'number', u'Number', | ||||
|               inputRenderer='input_textline', instanceName='number'), | ||||
|     #FieldType('date', 'date', u'Date'), | ||||
|     FieldType('date', 'date', u'Date'), | ||||
|     FieldType('fileupload', 'fileupload', u'File upload', | ||||
|               instanceName='fileupload'), | ||||
|     #FieldType('checkbox', 'checkbox', u'Checkbox'), | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 helmutm
						helmutm