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
37b326ab
Commit
37b326ab
authored
Jul 10, 2012
by
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- use the same constructor names and signatures as in zope.browserpage
parent
a4bd7649
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
src/Products/Five/browser/metaconfigure.py
src/Products/Five/browser/metaconfigure.py
+14
-14
src/Products/Five/viewlet/README.txt
src/Products/Five/viewlet/README.txt
+2
-2
No files found.
src/Products/Five/browser/metaconfigure.py
View file @
37b326ab
...
...
@@ -125,16 +125,13 @@ def page(_context, name, permission, for_=Interface,
cdict
[
'__name__'
]
=
name
if
template
:
# class and template
new_class
=
makeClassForTemplate
(
template
,
bases
=
(
class_
,
),
cdict
=
cdict
,
name
=
name
)
new_class
=
SimpleViewClass
(
template
,
bases
=
(
class_
,
),
name
=
name
)
elif
attribute
!=
"__call__"
:
# we're supposed to make a page for an attribute (read:
# method) and it's not __call__. We thus need to create a
# new class using our mixin for attributes.
cdict
.
update
({
'__page_attribute__'
:
attribute
})
new_class
=
makeClass
(
class_
.
__name__
,
(
class_
,
ViewMixinForAttributes
),
cdict
)
new_class
=
makeClass
(
class_
.
__name__
,
(
class_
,
simple
),
cdict
)
# in case the attribute does not provide a docstring,
# ZPublisher refuses to publish it. So, as a workaround,
...
...
@@ -158,7 +155,7 @@ def page(_context, name, permission, for_=Interface,
else
:
# template
new_class
=
makeClassForTemplate
(
template
,
name
=
name
)
new_class
=
SimpleViewClass
(
template
,
name
=
name
)
for
n
in
(
''
,
attribute
):
required
[
n
]
=
permission
...
...
@@ -428,8 +425,7 @@ def resourceDirectory(_context, name, directory, layer=IDefaultBrowserLayer,
)
class
ViewMixinForAttributes
(
BrowserView
,
zope
.
browserpage
.
metaconfigure
.
simple
):
class
simple
(
BrowserView
,
zope
.
browserpage
.
metaconfigure
.
simple
):
# XXX: this alternative implementation would support permission checks for
# the attribute instead of the view
...
...
@@ -471,15 +467,19 @@ class ViewMixinForTemplates(BrowserView):
def
__call__
(
self
,
*
args
,
**
kw
):
return
self
.
index
(
*
args
,
**
kw
)
def
makeClassForTemplate
(
filename
,
globals
=
None
,
used_for
=
None
,
bases
=
(),
cdict
=
None
,
name
=
u''
):
# XXX needs to deal with security from the bases?
if
cdict
is
None
:
# Original version: zope.browserpage.simpleviewclass.SimpleViewClass
def
SimpleViewClass
(
src
,
offering
=
None
,
used_for
=
None
,
bases
=
(),
name
=
u''
):
if
bases
:
cdict
=
getSecurityInfo
(
bases
[
0
])
else
:
cdict
=
{}
cdict
.
update
({
'index'
:
ViewPageTemplateFile
(
filename
,
globals
),
cdict
.
update
({
'index'
:
ViewPageTemplateFile
(
src
,
offering
),
'__name__'
:
name
})
bases
+=
(
ViewMixinForTemplates
,)
class_
=
makeClass
(
"SimpleViewClass from %s"
%
filename
,
bases
,
cdict
)
class_
=
makeClass
(
"SimpleViewClass from %s"
%
src
,
bases
,
cdict
)
if
used_for
is
not
None
:
class_
.
__used_for__
=
used_for
...
...
src/Products/Five/viewlet/README.txt
View file @
37b326ab
...
...
@@ -484,8 +484,8 @@ represent the files in a table:
... </html>
... ''')
>>> from Products.Five.browser.metaconfigure import
makeClassForTemplate
>>> Contents =
makeClassForTemplate
(contentsTemplate, name='contents.html')
>>> from Products.Five.browser.metaconfigure import
SimpleViewClass
>>> Contents =
SimpleViewClass
(contentsTemplate, name='contents.html')
The Viewlet Manager
...
...
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