Back to index

plone3  3.1.7
TestContent.py
Go to the documentation of this file.
00001 from AccessControl import ClassSecurityInfo
00002 from Products.Archetypes.atapi import *
00003 try:
00004     from Products.ATReferenceBrowserWidget.ATReferenceBrowserWidget import ReferenceBrowserWidget
00005 except:
00006     ReferenceBrowserWidget = ReferenceWidget
00007 
00008 schema = Schema((
00009     ReferenceField('singleRef', 
00010                    multiValued=0,
00011                    allowed_types=('Document', 'File'),
00012                    relationship='Rel1',
00013                    widget=ReferenceBrowserWidget(default_search_index='SearchableText',)),
00014 
00015     # multiRef: allows browsing.
00016     ReferenceField('multiRef', 
00017                    multiValued=1,
00018                    relationship='Rel2',
00019                    widget=ReferenceBrowserWidget(show_indexes=1,)),
00020 
00021     # multiRef2: no browse
00022     ReferenceField('multiRef2', 
00023                    multiValued=1,
00024                    allowed_types=('Document', 'ATDocument'),
00025                    relationship='Rel3',
00026                    widget=ReferenceBrowserWidget(allow_search=1, 
00027                                                  allow_browse=0,
00028                                                  show_indexes=1, 
00029                                                  available_indexes={'SearchableText':'Free text search',
00030                                                                     'Description': "Object's description"},
00031                                                 )),
00032     ReferenceField('multiRef3',
00033                    multiValued=1,
00034                    relationship='Rel3',
00035                    widget=ReferenceBrowserWidget(show_indexes=1,
00036                                                  allow_browse=1,
00037                                                  base_query={'Subject':'aspidistra'},
00038                                                  )),
00039     ReferenceField('multiRef4',
00040                    multiValued=1,
00041                    relationship='Rel4',
00042                    widget=ReferenceBrowserWidget(show_indexes=1,
00043                                                  allow_browse=0,
00044                                                  base_query={'Subject':'aspidistra'},
00045                                                  )),
00046     ReferenceField('multiRef5',
00047                    multiValued=1,
00048                    relationship='Rel5',
00049                    widget=ReferenceBrowserWidget(show_indexes=1,
00050                                                  allow_browse=0,
00051                                                  base_query='dynamicBaseQuery',
00052                                                  )),
00053     
00054                               ))
00055 
00056 class TestContent(BaseContent):
00057     security = ClassSecurityInfo()
00058     __implements__ = (getattr(BaseContent,'__implements__',()),)
00059     archetype_name = 'TestContent'
00060     meta_type = portal_type = 'TestContent'
00061 
00062     schema = BaseSchema + \
00063              schema
00064 
00065 registerType(TestContent,'kupu')