Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
60f2b77e
Commit
60f2b77e
authored
Jul 29, 2007
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed some more references to Acquisition
parent
705edbea
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
20 deletions
+6
-20
lib/python/Products/Five/browser/pagetemplatefile.py
lib/python/Products/Five/browser/pagetemplatefile.py
+0
-2
lib/python/Products/Five/browser/tests/provider.txt
lib/python/Products/Five/browser/tests/provider.txt
+2
-5
lib/python/Products/Five/component/__init__.py
lib/python/Products/Five/component/__init__.py
+1
-1
lib/python/Products/Five/doc/manual.txt
lib/python/Products/Five/doc/manual.txt
+0
-7
lib/python/Products/Five/form/objectwidget.py
lib/python/Products/Five/form/objectwidget.py
+3
-5
No files found.
lib/python/Products/Five/browser/pagetemplatefile.py
View file @
60f2b77e
...
@@ -17,9 +17,7 @@ $Id$
...
@@ -17,9 +17,7 @@ $Id$
"""
"""
import
zope.app.pagetemplate
import
zope.app.pagetemplate
from
Acquisition
import
aq_base
from
Acquisition
import
aq_get
from
Acquisition
import
aq_get
from
Acquisition
import
aq_parent
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
from
Products.PageTemplates.Expressions
import
SecureModuleImporter
from
Products.PageTemplates.Expressions
import
SecureModuleImporter
from
Products.PageTemplates.Expressions
import
createTrustedZopeEngine
from
Products.PageTemplates.Expressions
import
createTrustedZopeEngine
...
...
lib/python/Products/Five/browser/tests/provider.txt
View file @
60f2b77e
...
@@ -188,18 +188,15 @@ information is used:
...
@@ -188,18 +188,15 @@ information is used:
</body>
</body>
</html>
</html>
Now we test a provider using a PageTemplateFile to render itself. It must
Now we test a provider using a PageTemplateFile to render itself:
inherit from an Acquisition base class so that the template can use Zope 2
security mechanisms:
>>> import os, tempfile
>>> import os, tempfile
>>> temp_dir = tempfile.mkdtemp()
>>> temp_dir = tempfile.mkdtemp()
>>> dynTemplate = os.path.join(temp_dir, 'dynamic_template.pt')
>>> dynTemplate = os.path.join(temp_dir, 'dynamic_template.pt')
>>> open(dynTemplate, 'w').write(
>>> open(dynTemplate, 'w').write(
... 'A simple template: <tal:simple replace="python:view.my_property" />')
... 'A simple template: <tal:simple replace="python:view.my_property" />')
>>> from Acquisition import Explicit
>>> from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
>>> from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
>>> class TemplateProvider(
Explici
t):
>>> class TemplateProvider(
objec
t):
... zope.component.adapts(zope.interface.Interface,
... zope.component.adapts(zope.interface.Interface,
... browser.IDefaultBrowserLayer,
... browser.IDefaultBrowserLayer,
... zope.interface.Interface)
... zope.interface.Interface)
...
...
lib/python/Products/Five/component/__init__.py
View file @
60f2b77e
...
@@ -36,7 +36,7 @@ def findSite(obj, iface=ISite):
...
@@ -36,7 +36,7 @@ def findSite(obj, iface=ISite):
"""Find a site by walking up the object hierarchy, supporting both
"""Find a site by walking up the object hierarchy, supporting both
the ``ILocation`` API and Zope 2 Acquisition."""
the ``ILocation`` API and Zope 2 Acquisition."""
while
obj
is
not
None
and
not
iface
.
providedBy
(
obj
):
while
obj
is
not
None
and
not
iface
.
providedBy
(
obj
):
obj
=
getattr
(
obj
,
'__parent__'
,
aq_parent
(
aq_inner
(
obj
)
))
obj
=
aq_parent
(
aq_inner
(
obj
))
return
obj
return
obj
@
zope
.
component
.
adapter
(
zope
.
interface
.
Interface
)
@
zope
.
component
.
adapter
(
zope
.
interface
.
Interface
)
...
...
lib/python/Products/Five/doc/manual.txt
View file @
60f2b77e
...
@@ -271,13 +271,6 @@ view class are:
...
@@ -271,13 +271,6 @@ view class are:
* They need to be initialized with the Zope 2 security system, as
* They need to be initialized with the Zope 2 security system, as
otherwise you cannot use the view.
otherwise you cannot use the view.
* This also means they need to be part of the Zope 2 acquisition
system, as this is a requirement for Zope 2 security to
function. The ``BrowserView`` base class, available from
``Products.Five``, already inherits from ``Acquisition.Explicit`` to
make this be the case. Acquisition is explicit so no attributes can
be acquired by accident.
An example of a simple view::
An example of a simple view::
from Products.Five import BrowserView
from Products.Five import BrowserView
...
...
lib/python/Products/Five/form/objectwidget.py
View file @
60f2b77e
...
@@ -14,11 +14,9 @@
...
@@ -14,11 +14,9 @@
"""Five-compatible version of ObjectWidget
"""Five-compatible version of ObjectWidget
This is needed because ObjectWidget uses ViewPageTemplateFile whose
This is needed because ObjectWidget uses ViewPageTemplateFile whose
macro definition is unfortunately incompatible with
macro definition is unfortunately incompatible with ZopeTwoPageTemplateFile.
ZopeTwoPageTemplateFile. So this subclass uses
So this subclass uses ZopeTwoPageTemplateFile for the template that renders
ZopeTwoPageTemplateFile for the template that renders the widget's
the widget's sub-editform.
sub-editform. Acquisition has to be mixed in to provide the
ZopeTwoPageTemplateFile with the proper acquisition context.
$Id$
$Id$
"""
"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment