Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from Products.ATContentTypes.content import base
- from Products.ATContentTypes.content import schemata
- from Products.ATContentTypes.content import document
- from Products.ATContentTypes.content.document import ATDocument
- from zope.interface import implements, Interface
- try:
- from Products.LinguaPlone import *
- except ImportError:
- from Products.Archetypes import *
- from Products.Archetypes.atapi import BooleanField
- from Products.Archetypes.atapi import BooleanWidget
- from Products.Archetypes.atapi import ReferenceField
- from Products.Archetypes.atapi import TextField
- from Products.Archetypes.atapi import RichWidget
- from archetypes.referencebrowserwidget import ReferenceBrowserWidget
- from plone.app.iterate.interfaces import IIterateAware
- from iasplus.policy import IASPlusMessageFactory as _
- # schema declaration
- #original - schema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
- schema = document.ATDocumentSchema.copy() + public.Schema((
- TextField('body',
- searchable = 0,
- required = 1,
- allowable_content_types = ('text/plain',
- 'text/structured',
- 'text/html',),
- default_output_type = 'text/x-html-safe',
- widget = RichWidget(label = _(u'body', default=u'body'),
- rows = '3',
- ),
- ),
- ReferenceField('jurisdictionImage',
- required = True,
- searchable = False,
- multiValued=0,
- allowed_types=('Image'),
- relationship= "jurisdictionImage",
- widget = ReferenceBrowserWidget(
- label = _(u'jurisdiction_image', default=u'Associated Jurisdiction Image'),
- allow_search = True,
- allow_browse = True,)
- ),
- )
- )
- class IJurisdiction(Interface):
- pass
- class Jurisdiction(base.ATCTContent):
- implements(IJurisdiction, IIterateAware)
- schema = schema
- meta_type = 'Jurisdiction'
- if 'description' in schema:
- schema['description'].required = True
- def getAssociatedImage(self):
- imageSet = self.getJurisdictionImage()
- if imageSet is not None:
- return imageSet.absolute_url()
- public.registerType(Jurisdiction, 'iasplus.policy')
Add Comment
Please, Sign In to add comment