Пример #1
0
    def __init__(self, context, request):
        # xxx usually a super is the way to go here? why not?
        Tile.__init__(self, context, request)
        WidgetsView.__init__(self, context, request)

        try:
            self.field = self.data['field'].split('-', 1)[-1]
        except KeyError:
            self.field = None
            return

        # Omit all the fields except rendered field to save time, because
        # autoform update will only add fields not in self.fields.

        if self.field in self.schema:
            self.fields = Fields(self.schema).omit(self.field)
        else:
            self.fields = Fields(self.schema).omit(self.schema.names())
            for schema in self.additionalSchemata:
                if self.field in schema:
                    self.field = '%s.%s' % (schema.__name__, self.field)
                    self.fields += Fields(
                        schema,
                        prefix=schema.__name__
                    ).omit(self.field)
                    self._additionalSchemata = (schema,)
                    return
Пример #2
0
    def __init__(self, context, request):
        # xxx usually a super is the way to go here? why not?
        Tile.__init__(self, context, request)
        WidgetsView.__init__(self, context, request)

        try:
            self.field = self.data['field'].split('-', 1)[-1]
        except KeyError:
            self.field = None
            return

        # Omit all the fields except rendered field to save time, because
        # autoform update will only add fields not in self.fields.

        if self.field in self.schema:
            self.fields = Fields(self.schema).omit(self.field)
        else:
            self.fields = Fields(self.schema).omit(self.schema.names())
            for schema in self.additionalSchemata:
                if self.field in schema:
                    self.field = '%s.%s' % (schema.__name__, self.field)
                    self.fields += Fields(schema, prefix=schema.__name__).omit(
                        self.field)
                    self._additionalSchemata = (schema, )
                    return
Пример #3
0
 def __init__(self, context, request):
     Tile.__init__(self, context, request)
     DisplayForm.__init__(self, context, request)
     components = self.data['field'].split('-', 1)
     self.schema = None
     if len(components) > 1:
         for schema in iterSchemata(self.context):
             if schema.__identifier__.endswith(components[0]):
                 self.schema = schema
     else:
         self.schema = tuple(iterSchemata(self.context))[0]
     self.field = components[-1]
     self.fields = Fields(self.schema).select(self.field)
Пример #4
0
    def __init__(self, context, request):
        if IVersionViewLayer.providedBy(request):
            version = request.form.get('version')
            context = utils.get_object_version(context, version)
        Tile.__init__(self, context, request)
        WidgetsView.__init__(self, context, request)

        try:
            self.schema_name, _, self.field_name = self.data[
                'field'].partition('-')
        except KeyError:
            self.field = self.field_name = self.schema_name = None
            return

        if self.schema_name in _supported_schemas:
            schema = _supported_schemas[self.schema_name]
            self.field = '%s.%s' % (self.schema_name, self.field_name)
            self.fields += Fields(schema,
                                  prefix=self.schema_name).select(self.field)
            self._additionalSchemata = (schema, )
        else:
            super(DexterityFieldTile, self).__init__(context, request)
 def __getattr__(self, name):
     # proxy attributes for this view to the selected view of the content
     # item so views work
     if name in ('data',
                 'content_context',
                 'default_view',
                 'item_macros',
                 'item_panels',
                 'getPhysicalPath',
                 'index_html',
                 ) or name.startswith(('_', 'im_', 'func_')):
         return Tile.__getattr__(self, name)
     return getattr(self.default_view, name)
Пример #6
0
 def __getattr__(self, name):
     # proxy attributes for this view to the selected view of the content
     # item so views work
     if name in ('data',
                 'content_context',
                 'default_view',
                 'item_macros',
                 'item_panels',
                 'getPhysicalPath',
                 'index_html',
                 ) or name.startswith(('_', 'im_', 'func_')):
         return Tile.__getattr__(self, name)
     return getattr(self.default_view, name)