Back to index

plone3  3.1.7
DDocument.py
Go to the documentation of this file.
00001 from Products.Archetypes.atapi import *
00002 from Products.Archetypes.TemplateMixin import TemplateMixin
00003 from Products.Archetypes.Marshall import PrimaryFieldMarshaller
00004 from Products.Archetypes.config import PKG_NAME
00005 
00006 schema = BaseSchema + Schema((
00007     TextField('teaser',
00008               searchable=1,
00009               widget=TextAreaWidget(description="""A short lead-in to the
00010               article so that we might get people to read the body""",
00011                                     label="Teaser",
00012                                     rows=3)),
00013 
00014     # Using a bare ObjetField doesn't make sense ...
00015     #ObjectField('author'),
00016     StringField('author'),
00017 
00018     TextField('body',
00019               required=1,
00020               primary=1,
00021               searchable=1,
00022               default_output_type='text/html',
00023               allowable_content_types=('text/restructured',
00024                                        'text/plain',
00025                                        'text/html',
00026                                        'application/msword'),
00027               widget=RichWidget(),
00028               ),
00029 
00030     IntegerField("number",
00031                  index="FieldIndex",
00032                  default=42,
00033                  validators=('isInt',),
00034                  ),
00035 
00036     ImageField('image',
00037                default_output_type='image/jpeg',
00038                allowable_content_types=('image/*',),
00039                widget=ImageWidget()),
00040     
00041     ReferenceField('related',
00042                    relationship = 'related',
00043                    multiValued = False,
00044                    widget=ReferenceWidget(),
00045                    keepReferencesOnCopy = True),
00046     ),
00047 
00048     marshall=PrimaryFieldMarshaller()) + TemplateMixin.schema
00049 
00050 class DDocument(TemplateMixin, BaseContent):
00051     """An extensible Document (test) type"""
00052     schema = schema
00053     archetype_name = "Demo Doc"
00054     actions = TemplateMixin.actions
00055 
00056     def manage_afterPUT(self, data, marshall_data, file, context, mimetype,
00057                         filename, REQUEST, RESPONSE):
00058         """For unit tests
00059         """
00060         self.called_afterPUT_hook = True
00061 
00062 
00063 registerType(DDocument, PKG_NAME)