本文整理汇总了Python中Products.ATContentTypes.content.folder.ATFolder类的典型用法代码示例。如果您正苦于以下问题:Python ATFolder类的具体用法?Python ATFolder怎么用?Python ATFolder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ATFolder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
def setUp(self):
self.portal = self.layer["portal"]
pps = self.portal.restrictedTraverse("@@plone_portal_state")
member = pps.member()
memberid = member.getId()
folder = ATFolder(memberid)
transactions = self.portal.transactions
transactions._setObject(memberid, folder)
transactions.reindexObject()
# Finally, change its permissions
folder.manage_permission(ModifyPortalContent, roles=[], acquire=0)
# Make sure the user's service registration dates are correct
properties = {
"askanexpert_registrationdate": NULLDATE,
"answerdatabase_registrationdate": NULLDATE,
"moreexercise_registrationdate": NULLDATE,
}
member.setProperties(properties)
self.context = self.portal.maths
self.context.allowQuestions = True
self.request = self.portal.REQUEST
self.manager_name = "plone.belowcontent"
self.themelayer = IEmasThemeLayer
self.viewlet_name = None
self.formsubmit_token = None
self.formfield = None
self.memberproperty = None
self.creditproperty = ""
示例2: initializeArchetype
def initializeArchetype(self, **kwargs):
"""Pre-populate the press room folder with its basic folders.
"""
ATFolder.initializeArchetype(self,**kwargs)
# create sub-folders
self._createSubFolders()
示例3: manage_afterAdd
def manage_afterAdd(self, item, container):
# XXX TODO: when we're done with 2.1.x, implement this via event subscription
ATFolder.manage_afterAdd(self, item, container)
id = self.getId()
if self.fsStartField.__name__ != id:
self.fsStartField.__name__ = id
示例4: __init__
def __init__(self, oid, **kw):
"""
"""
ATFolder.__init__(self, oid, **kw)
self.plomino_version = VERSION
self.setStatus("Ready")
PlominoAccessControl.__init__(self)
manage_addCMFBTreeFolder(self, id='plomino_documents')
directlyProvides(self.documents, IHideFromBreadcrumbs)
示例5: initializeArchetype
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")
示例6: setId
def setId(self, value):
"""Sets the object id. Changes both object and field id.
"""
badIds = ("language", "form", "form_submit", "fieldset", "last_referer", "add_reference")
if value in badIds:
raise BadRequest, 'The id "%s" is reserved.' % value
ATFolder.setId(self, value)
self.fsStartField.__name__ = self.getId()
示例7: __init__
def __init__(self, oid, **kwargs):
""" initialize class """
ATFolder.__init__(self, oid, **kwargs)
self.fsStartField = StringField(
"FieldSetStart", searchable=0, required=0, write_permission=View, widget=FieldsetStartWidget()
)
self.fsEndField = StringField(
"FieldSetEnd", searchable=0, required=0, write_permission=View, widget=FieldsetEndWidget()
)
示例8: convertLPFolder
def convertLPFolder(parent, folder):
""" convert Large Plone Folders to Folders """
id = folder.getId()
newfolder = ATFolder(id)
newfolder._setId(id)
newfolder = newfolder.__of__(parent)
uid = folder._at_uid
for item_id, item in folder.objectItems():
folder._objects = tuple(
[i for i in folder._objects if i['id'] != item_id])
folder._delOb(item_id)
newfolder._objects = newfolder._objects + (
{'id': item_id, 'meta_type': item.meta_type},)
newfolder._setOb(item_id, aq_base(item))
parent._objects = tuple([i for i in parent._objects if i['id'] != id])
parent._delOb(id)
newfolder._at_uid = uid
parent._objects = parent._objects + (
{'id': id, 'meta_type': newfolder.meta_type},)
parent._setOb(id, aq_base(newfolder))
#transaction.abort()
return "%s, %s" % (id, folder.absolute_url(1))
示例9: getObjectPosition
def getObjectPosition(self, id):
"""
"""
if id in self.documents:
# documents will not be ordered in site map
return 0
return ATFolder.getObjectPosition(self, id)
示例10: manage_beforeDelete
def manage_beforeDelete(self, *args, **kwargs):
"""
"""
#log("manage_beforeDelete: %s" % self)
retVal = ATFolder.manage_beforeDelete(self, *args, **kwargs)
self.syncResults('delete')
return retVal
示例11: moveObjectsByDelta
def moveObjectsByDelta(self, *args, **kwargs):
"""
"""
#log("moveObjectsByDelta: %s" % self)
retVal = ATFolder.moveObjectsByDelta(self, *args, **kwargs)
self.syncResults('move')
return retVal
示例12: manage_afterAdd
def manage_afterAdd(self, *args, **kwargs):
"""
"""
#log("manage_afterAdd: %s" % self)
#retVal = OrderedBaseFolder.manage_afterAdd(self, *args, **kwargs)
retVal = ATFolder.manage_afterAdd(self, *args, **kwargs)
self.syncResults('add')
return retVal
示例13: manage_afterAdd
def manage_afterAdd(self, item, container):
#BaseFolder.manage_afterAdd(self, item, container)
#OrderedBaseFolder.manage_afterAdd(self, item, container)
ATFolder.manage_afterAdd(self, item, container)
# Create a user-defined role "ECAssignment Viewer". This role
# has the View permission in certain states (defined in
# ECAssignmentWorkflow). This can be used for model
# solutions: (1) Submit an assignment with the model
# solution. (2) Use the "Sharing" tab to assign the role
# "ECAssignment Viewer" to the users or groups who should be
# allowed to view the assignment.
#if 'ECAssignment Viewer' not in self.valid_roles():
# self.manage_defined_roles('Add Role',
# {'role': 'ECAssignment Viewer'})
# Create a user-defined role "ECAssignment Grader". The owner
# of an assignment box can use this role to delegate grading
# to other users.
#if 'ECAssignment Grader' not in self.valid_roles():
# self.manage_defined_roles('Add Role',
# {'role': 'ECAssignment Grader'})
# Plone 3: in profiles/default/rolemap.xml
# Grant the GradeAssignments permission to the "ECAssignment
# Grader" role.
# self.manage_permission(permissions.GradeAssignments,
# roles=['ECAssignment Grader',], acquire=True)
# Assign the local roles to the creator
creator = self.Creator()
roles = list(self.get_local_roles_for_userid(creator))
for role in ('ECAssignment Viewer', 'ECAssignment Grader'):
if role not in roles:
roles.append(role)
self.manage_setLocalRoles(creator, roles)
示例14: getPAMDefaultPage
def getPAMDefaultPage(self):
"""
Return the first user visible article as default page if
ViewTOC is unchecked (i.e, it redirect the user to the first page)
"""
request = getattr(self, 'REQUEST', None)
force_toc = request.get('force_toc', False)
pages = self.getPages()
if force_toc or self.getViewTOCFirst() or len(pages) == 0:
return ATFolder.__call__(self)
else:
return request.RESPONSE.redirect(pages[0].getObject().absolute_url())
示例15: checkIdAvailable
def checkIdAvailable(self, id):
""" Expands on ATFolder by checking for ids known to cause problems.
This includes ids of objects in all fieldsets.
"""
result = ATFolder.checkIdAvailable(self, id)
if result:
result = id not in BAD_IDS
if result:
# check the fieldsets
fieldsets = self.objectValues('FieldsetFolder')
for fs in fieldsets:
if id in fs.objectIds():
return False
return result