当前位置: 首页>>代码示例>>Python>>正文


Python ATFolder.initializeArchetype方法代码示例

本文整理汇总了Python中Products.ATContentTypes.content.folder.ATFolder.initializeArchetype方法的典型用法代码示例。如果您正苦于以下问题:Python ATFolder.initializeArchetype方法的具体用法?Python ATFolder.initializeArchetype怎么用?Python ATFolder.initializeArchetype使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Products.ATContentTypes.content.folder.ATFolder的用法示例。


在下文中一共展示了ATFolder.initializeArchetype方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initializeArchetype

# 需要导入模块: from Products.ATContentTypes.content.folder import ATFolder [as 别名]
# 或者: from Products.ATContentTypes.content.folder.ATFolder import initializeArchetype [as 别名]
 def initializeArchetype(self, **kwargs):
     """Pre-populate the press room folder with its basic folders.
     """
     ATFolder.initializeArchetype(self,**kwargs)
     
     # create sub-folders
     self._createSubFolders()
开发者ID:collective,项目名称:Products.PressRoom,代码行数:9,代码来源:PressRoom.py

示例2: initializeArchetype

# 需要导入模块: from Products.ATContentTypes.content.folder import ATFolder [as 别名]
# 或者: from Products.ATContentTypes.content.folder.ATFolder import initializeArchetype [as 别名]
 def initializeArchetype(self, **kwargs):
     """ Create initial SignupSheet configuration
     """
     ATFolder.initializeArchetype(self, **kwargs)
     pm = getToolByName(self, 'portal_membership')
     portal_factory = getToolByName(self, 'portal_factory')
     if not pm.isAnonymousUser() and not portal_factory.isTemporary(self):
         ISignupSheetInitializer(self).form_initializer(**kwargs)
     else:
         logger.debug("Anonymous user: not allowed to create fields")
开发者ID:Blaastolen,项目名称:collective.signupsheet,代码行数:12,代码来源:signupsheet.py

示例3: initializeArchetype

# 需要导入模块: from Products.ATContentTypes.content.folder import ATFolder [as 别名]
# 或者: from Products.ATContentTypes.content.folder.ATFolder import initializeArchetype [as 别名]
    def initializeArchetype(self, **kwargs):
        """ Create sample content that may help folks
            figure out how this gadget works.
        """

        ATFolder.initializeArchetype(self, **kwargs)

        self.setSubmitLabel(zope.i18n.translate(_(u'pfg_formfolder_submit', u'Submit'), context=self.REQUEST))
        self.setResetLabel(zope.i18n.translate(_(u'pfg_formfolder_reset', u'Reset'), context=self.REQUEST))

        oids = self.objectIds()

        # if we have *any* content already, we don't need
        # the sample content
        if not oids:

            haveMailer = False
            # create a mail action
            try:
                self.invokeFactory('FormMailerAdapter', 'mailer')
                mailer = self['mailer']

                mailer.setTitle(zope.i18n.translate(
                  _(u'pfg_mailer_title', u'Mailer'),
                  context=self.REQUEST))
                mailer.setDescription(
                  zope.i18n.translate(
                    _(u'pfg_mailer_description',
                      u'E-Mails Form Input'),
                    context=self.REQUEST))

                self._pfFixup(mailer)

                self.actionAdapter = ('mailer', )
                haveMailer = True
            except Unauthorized:
                logger.warn('User not authorized to create mail adapters. Form Folder created with no action adapter.')

            # create a replyto field
            self.invokeFactory('FormStringField', 'replyto')
            obj = self['replyto']
            obj.fgField.__name__ = 'replyto'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_replytofield_title', u'Your E-Mail Address'),
              context=self.REQUEST))

            obj.fgField.required = True
            obj.setFgStringValidator('isEmail')
            obj.setFgTDefault('here/memberEmail')
            obj.setFgDefault('dynamically overridden')

            self._pfFixup(obj)

            if haveMailer:
                mailer.replyto_field = 'replyto'

            # create a subject field
            self.invokeFactory('FormStringField', 'topic')
            obj = self['topic']
            obj.fgField.__name__ = 'topic'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_topicfield_title', u'Subject'),
              context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)

            if haveMailer:
                mailer.subject_field = 'topic'

            # create a comments field
            self.invokeFactory('FormTextField', 'comments')
            obj = self['comments']
            obj.fgField.__name__ = 'comments'

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_commentsfield_title', u'Comments'),
              context=self.REQUEST))

            obj.fgField.required = True

            self._pfFixup(obj)


            # create a thanks page
            self.invokeFactory('FormThanksPage', 'thank-you')
            obj = self['thank-you']

            obj.setTitle(zope.i18n.translate(
              _(u'pfg_thankyou_title', u'Thank You'), context=self.REQUEST))
            obj.setDescription(zope.i18n.translate(
              _(u'pfg_thankyou_description', u'Thanks for your input.'),
              context=self.REQUEST))

            self._pfFixup(obj)

            self.thanksPage = 'thank-you'
开发者ID:arielvb,项目名称:Products.PloneFormGen,代码行数:102,代码来源:form.py


注:本文中的Products.ATContentTypes.content.folder.ATFolder.initializeArchetype方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。