Skip to content. | Skip to navigation

Personal tools

Navigation

You are here: Home / Tips / Acquire

Acquire

設定工作流程權限時,會看到 Acquire permission settings? 的設定選項,勾選的話,除了特定目錄的設定值之外,還會沿用上層目錄的設定值。

Acquisition

Zope Deveoper Guide: 支援 Acquisition 的物件,透過 Extension Class Instance 來存取它的時候,會回傳 Acquisition Wrapper 物件。

Views and Automatic Member Variable Acquisition Wrapping

from Acquisition import aq_inner

self.obj = self.context.reference_catalog.lookupObject(value)
return aq_inner(self.obj).absolute_url() # Acquistion chain corrected

Get Field Value from Parent Folder If Current Context Missing

collective.explicitacquisition: Context for 404 Site is the wrong portal

http://blog.keul.it/2011/10/plone-security-and-workflows-learn-how.html

Turn Off Inherit Permissions from higher Levels

Python properties and Zope Acquisition are not compatible. Using a property strips the acquisition chain from the object.

Get Content From a Relation Field In a Parent Object

adapt fake or real parent: contentratings

- subloc = ISublocations(self.context.__parent__, alternative=None)
+ subloc = ISublocations(self.context.aq_inner.__parent__, alternative=None)

aq_chain() and __parent__.__parent__

acquisition 的效果範例

Install the external method as "showaq" at the base of your Zope installation. Then try different acquisition paths:

http://localhost:8080/QuickStart/showaq
http://localhost:8080/QuickStart/Outline/QuickStart/showaq
http://localhost:9080/QuickStart/Outline/QuickStart/Control_Panel/showaq

Shane Hathaway script to show

def showaq(self, indent=''):
    rval = ""
    obj = self
    base = getattr(obj, 'aq_base', obj)
    try: id = base.id
    except: id = str(base)
    try: id = id()
    except: pass
 
    if hasattr(obj, 'aq_self'):
        if hasattr(obj.aq_self, 'aq_self'):
            rval = rval + indent + "(" + id + ")\n"
            rval = rval + indent + "|  \\\n"
            rval = rval + showaq(obj.aq_self, '|   ' + indent)
            rval = rval + indent + "|\n"
        if hasattr(obj, 'aq_parent'):
            rval = rval + indent + id + "\n"
            rval = rval + indent + "|\n"
            rval = rval + showaq(obj.aq_parent, indent)
    else:
        rval = rval + indent + id + "\n"
    return rval

如果 Zope 系統裡有兩個 Plone 網站,它們位於同一層:

|
+-- Site1
+-- Site2

使用 http://localhost/Site1/Site2 之類的網址,會在 Site1 裡看到 Site2 的內容,可用 collective.siteisolation 模組來處理這類問題。

AttributeError('getFolderContents',) message on Plone 4 with customised navigation

顯示上層目錄的標題 aq_parent