Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.02 KB | None | 0 0
  1. """Definition of the Homepage content type
  2. """
  3.  
  4. from zope.interface import implements
  5.  
  6. from Products.Archetypes import atapi
  7. from Products.ATContentTypes.content import base
  8. from Products.ATContentTypes.content import schemata
  9.  
  10. from ejn.types.vocabs import site_themes
  11. from ejn.types.vocabs import site_regions
  12.  
  13. from ejn.types.interfaces import IHomepage
  14. from ejn.types.config import PROJECTNAME
  15.  
  16. HomepageSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
  17.  
  18. atapi.LinesField('themes',
  19. vocabulary=site_themes,
  20. index='KeywordIndex',
  21. multiValued=True,
  22. widget=atapi.MultiSelectionWidget(label="Themes",
  23. format='checkbox',
  24. description="",
  25. ),
  26. ),
  27.  
  28. atapi.LinesField('regions',
  29. vocabulary=site_regions,
  30. index='KeywordIndex',
  31. multiValued=True,
  32. widget=atapi.MultiSelectionWidget(label="Regions",
  33. format='checkbox',
  34. description="",
  35. ),
  36. ),
  37.  
  38.  
  39. atapi.ReferenceField('program',
  40. widget=atapi.SelectionWidget(label='Program'),
  41. allowed_types=('Program'),
  42. relationship='display program',
  43. multiValued=0,
  44. vocabulary_display_path_bound=-1,
  45. ),
  46.  
  47. ))
  48.  
  49. # Set storage on fields copied from ATContentTypeSchema, making sure
  50. # they work well with the python bridge properties.
  51.  
  52. HomepageSchema['title'].storage = atapi.AnnotationStorage()
  53. HomepageSchema['description'].storage = atapi.AnnotationStorage()
  54.  
  55. schemata.finalizeATCTSchema(HomepageSchema, moveDiscussion=False)
  56.  
  57.  
  58. class Homepage(base.ATCTContent):
  59. """Home page"""
  60. implements(IHomepage)
  61.  
  62. meta_type = "Homepage"
  63. schema = HomepageSchema
  64.  
  65. title = atapi.ATFieldProperty('title')
  66. description = atapi.ATFieldProperty('description')
  67.  
  68. # -*- Your ATSchema to Python Property Bridges Here ... -*-
  69.  
  70. atapi.registerType(Homepage, PROJECTNAME)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement