Exemple #1
0
 def test_metaschemata(self):
     dummy = self._dummy
     schemata = dummy.Schemata()
     meta_names = getNames(schemata['metadata'])
     self.assertEqual(meta_names, [
         'allowDiscussion', 'subject', 'description', 'location',
         'contributors', 'creators', 'effectiveDate', 'expirationDate',
         'language', 'rights', 'creation_date', 'modification_date'
     ])
Exemple #2
0
 def test_metaschemata(self):
     dummy = self._dummy
     schemata = dummy.Schemata()
     meta_names = getNames(schemata['metadata'])
     self.assertEqual(meta_names, ['allowDiscussion', 'subject',
                                   'description', 'location', 'contributors',
                                   'creators', 'effectiveDate',
                                   'expirationDate', 'language',
                                   'rights', 'creation_date',
                                   'modification_date'])
    def __iter__(self):
        for item in self.previous:
            yield item

        for item in self.results:
            obj = item.getObject()
            path = '/'.join(obj.getPhysicalPath())

            schema = dict()
            schema['_type'] = 'collective.nitf.content'
            schema['_from'] = path  # we store here the original path
            schema['_path'] = path + self.tmp

            for name in getNames(obj.Schema()):
                field = obj.getField(name)
                schema[name] = field.get(obj)

            yield schema
Exemple #4
0
    def __iter__(self):
        for item in self.previous:
            yield item

        for item in self.results:
            obj = item.getObject()
            path = '/'.join(obj.getPhysicalPath())

            schema = dict()
            schema['_type'] = 'collective.nitf.content'
            schema['_from'] = path  # we store here the original path
            schema['_path'] = path + self.tmp

            for name in getNames(obj.Schema()):
                field = obj.getField(name)
                schema[name] = field.get(obj)

            yield schema
Exemple #5
0
from Products.EEAContentTypes.content.validators import ExistsKeyFactsValidator
from zope.interface import implements
from eea.themecentre.interfaces import IThemeTagging

schema = Schema((), )

Highlight_schema = getattr(ATNewsItem, 'schema', Schema(())).copy() + \
                   getattr(ExternalHighlight, 'schema', Schema(())).copy() + \
                   quotation_schema.copy() + \
                   schema.copy()

# put all the external highlights fields into their own schema
ExternalHighlightSchema = ExtHighlightSchema.copy()

fields2Move2DefaultSchemata = ['management_plan']
for fieldname in getNames(ExternalHighlightSchema):
    field = Highlight_schema[fieldname]
    if fieldname in fields2Move2DefaultSchemata:
        field.schemata = 'default'
    elif field.schemata != 'metadata':
        field.schemata = 'Front Page'

Highlight_schema['text'].required = True
validators = Highlight_schema['text'].validators
validators.appendRequired(ExistsKeyFactsValidator('existsKeyFacts'))
Highlight_schema.moveField('image', before='imageCaption')


class Highlight(ExternalHighlight, ATNewsItem):
    """<p>Hightlights are links with descriptions presented as news on
    the website.</p>
Exemple #6
0
 def test_baseschemata(self):
     dummy = self._dummy
     schemata = dummy.Schemata()
     base_names = getNames(schemata['default'])
     self.assertEqual(base_names, ['id', 'title'])
Exemple #7
0
 def test_baseschemata(self):
     dummy = self._dummy
     schemata = dummy.Schemata()
     base_names = getNames(schemata['default'])
     self.assertEqual(base_names, ['id', 'title'])