Hello,

I have my own product and use Plone 3.2.1

My product have content types Subject and WikiCatalog.
When I add Subject object, subscriber add WikiCatalog and then want
set WikiCatalog as default page for Subject.

interfaces.py
---------------
class ISubject(Interface):
   """Interface for Subject type
   """
   contains('my.product.interfaces.IWikiCatalog')

   title = schema.TextLine(title=_(u"Title"),
                           description=_(u"Name of the subject"),
                           required=True)

   description = schema.Text(title=_(u"Description"),
description=_(u"A short summary of the subject"),
                             required=False)

class IWikiCatalog(Interface):
   """Conterneer for wiki objects"""

   contains('my.product.interfaces.IWiki',)

   title = schema.TextLine(title=_(u"Title"),
                           description=_(u"Folder title."),
                           required=True)


content.py
-------------
Catalog_schema = ATFolderSchema.copy()

catalog_hidden_fields = ('description',)
for fld in catalog_hidden_fields:
   Catalog_schema[fld].widget.visible={'edit': 'invisible',
                                       'view': 'invisible',
                                       }
Catalog_schema['title'].storage = AnnotationStorage()

class WikiCatalog(ATFolder):
   """Container, where we will store wiki pages. """
   implements(IWikiCatalog)
portal_type = meta_type = 'WikiCatalog'
   schema = Catalog_schema
   _at_rename_after_creation = True

   title = ATFieldProperty('title')

registerType(WikiCatalog, PROJECTNAME)

class Subject(Container, BrowserDefaultMixin):
   """Subject type. Here we will put info about university subject's.
   """
   implements(ISubject, INameFromTitle)
   portal_type = 'Subject'

   title = u""
   description = u""

subjectFactory = Factory(Subject, title=_(u"Create new subject"))


def subject_added_event(subject, event):
   """Subject processing after creation:
   add wiki
   """
   wiki_id = 'wiki'
   default_text = 'Mano ((batai)) buvo du, vienas dingo, nerandu.'
   obj = event.object
if wiki_id not in obj.objectIds():
       obj.invokeFactory('WikiCatalog', id=wiki_id,)
       obj.setDefaultPage(wiki_id)



Why this don't work?

--
Jaro

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to