本文整理汇总了Python中Products.ATContentTypes.content.base.ATCTContent.manage_afterAdd方法的典型用法代码示例。如果您正苦于以下问题:Python ATCTContent.manage_afterAdd方法的具体用法?Python ATCTContent.manage_afterAdd怎么用?Python ATCTContent.manage_afterAdd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products.ATContentTypes.content.base.ATCTContent
的用法示例。
在下文中一共展示了ATCTContent.manage_afterAdd方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: manage_afterAdd
# 需要导入模块: from Products.ATContentTypes.content.base import ATCTContent [as 别名]
# 或者: from Products.ATContentTypes.content.base.ATCTContent import manage_afterAdd [as 别名]
def manage_afterAdd(self, item, container):
# TODO: when we're done with 2.1.x, implement this via event subscription
ATCTContent.manage_afterAdd(self, item, container)
id = self.getId()
if self.fgField.__name__ != id:
self.fgField.__name__ = id
示例2: manage_afterAdd
# 需要导入模块: from Products.ATContentTypes.content.base import ATCTContent [as 别名]
# 或者: from Products.ATContentTypes.content.base.ATCTContent import manage_afterAdd [as 别名]
def manage_afterAdd(self, item, container):
# manage_afterAdd is deprecated in Zope 2.11+
### copy PDF file if bibreference has been copied
###
### BEWARE: to debug this code go into
### portal_skins/plone_scripts/folder_paste
### and comment out the
### fallback exception or use PloneTestCase
###
reference_catalog = getToolByName(self, 'reference_catalog')
bib_tool = getToolByName(self, 'portal_bibliography')
bibfolder = container
# grab the PDF file and its back references before the reference is removed by
# BaseContent.manage_afterAdd
pdf_file = self.getPdf_file() or None
pdf_file_uid = ''
if pdf_file:
pdf_file_uid = pdf_file.UID()
pdf_file_brefs = [ bref.UID() for bref in pdf_file.getBRefs('printable_version_of') if bref is not None ]
if not pdf_file_uid and shasattr(self, '_temp_pdffile_UID') and self._temp_pdffile_UID:
pdf_file_uid = self._temp_pdffile_UID
pdf_file_brefs = [ bref.UID() for bref in reference_catalog.lookupObject(pdf_file_uid).getBRefs('printable_version_of') if bref is not None ]
delattr(self, '_temp_pdffile_UID')
# first do all necessary ATCT, Archetypes, etc. things...
BaseContent.manage_afterAdd(self, item, container)
# we have to set another transaction savepoint here,
# before we can cut or copy the associated PDF file
bib_tool.transaction_savepoint(optimistic=True)
# then check PDF file association
pdf_file = pdf_file_uid and reference_catalog.lookupObject(pdf_file_uid)
if pdf_file and pdf_file_brefs and (self.UID() not in pdf_file_brefs):
# bibref item has been copied and UID of bibref item has changed
# => copy PDF file
new_pdf_file = self.relocatePdfFile(pdf_file=pdf_file, op=0)
self.setPdf_file(value=new_pdf_file.UID())
elif pdf_file and (pdf_file.aq_inner.aq_parent.aq_inner.aq_parent.getPhysicalPath() != self.aq_inner.aq_parent.getPhysicalPath()):
# PDF file and bibref item are not in the same bibfolder
# => move PDF file!!!
moved_pdf_file = self.relocatePdfFile(pdf_file=reference_catalog.lookupObject(pdf_file_uid), op=1)
示例3: manage_afterAdd
# 需要导入模块: from Products.ATContentTypes.content.base import ATCTContent [as 别名]
# 或者: from Products.ATContentTypes.content.base.ATCTContent import manage_afterAdd [as 别名]
def manage_afterAdd(self, item, container):
# Fix text when created through webdav.
# Guess the right mimetype from the id/data.
ATCTContent.manage_afterAdd(self, item, container)
field = self.getField("text")
# hook for mxTidy / isTidyHtmlWithCleanup validator
tidyOutput = self.getTidyOutput(field)
if tidyOutput:
if hasattr(self, "_v_renamed"):
mimetype = field.getContentType(self)
del self._v_renamed
else:
mimetype = self.guessMimetypeOfText()
if mimetype:
field.set(self, tidyOutput, mimetype=mimetype) # set is ok
elif tidyOutput:
field.set(self, tidyOutput) # set is ok