本文整理汇总了Python中AccessControl.allow_class方法的典型用法代码示例。如果您正苦于以下问题:Python AccessControl.allow_class方法的具体用法?Python AccessControl.allow_class怎么用?Python AccessControl.allow_class使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccessControl
的用法示例。
在下文中一共展示了AccessControl.allow_class方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: writeobj
# 需要导入模块: import AccessControl [as 别名]
# 或者: from AccessControl import allow_class [as 别名]
)
return self.zip_filename
# forbidden methods
# _write = write
# write = None
# writepy = None
def writeobj(self, obj, arcname=None):
# Check if this user has access to this object.
if not AccessControl.getSecurityManager().checkPermission("View", obj):
raise "Unauthorized", "not authorized to View %s" % (obj.absolute_url())
if hasattr(obj, "_original"):
fsname = obj._original._get_fsname(obj._original.filename)
elif hasattr(obj, "_get_fsname"):
fsname = obj._get_fsname(obj.filename)
else:
raise Exception, "Can not determine filename for object."
self.write(filename=fsname, arcname=arcname)
def ZipFile(contents=None, filename=None):
return _ZipFile(contents=contents, filename=filename)
if not testing:
Globals.InitializeClass(_ZipFile)
AccessControl.allow_class(_ZipFile)
示例2: __init__
# 需要导入模块: import AccessControl [as 别名]
# 或者: from AccessControl import allow_class [as 别名]
import AccessControl
class ObjectResult:
def __init__(self,objectId,version,weight=0,repository=None):
"""shadow class to make sims look like search res"""
if version == 'latest':
ob=repository.catalog(objectId=objectId,version=version)
if ob:
self = ob
else:
self = repository.getRhaptosObject(objectId,version)
self.matched={}
self.fields={}
self.weight=weight
AccessControl.allow_class(ObjectResult)