Commit b0c70bdd authored by 's avatar

- now we can simplify that code a bit

parent a4485bbd
......@@ -120,18 +120,16 @@ def page(_context, name, permission, for_=Interface,
raise ConfigurationError(
"The provided class doesn't have the specified attribute "
)
cdict = getSecurityInfo(class_)
cdict['__name__'] = name
if template:
# class and template
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.
else:
cdict = getSecurityInfo(class_)
cdict['__name__'] = name
cdict['__page_attribute__'] = attribute
new_class = makeClass(class_.__name__, (class_, simple), cdict)
if attribute != "__call__":
# in case the attribute does not provide a docstring,
# ZPublisher refuses to publish it. So, as a workaround,
# we provide a stub docstring
......@@ -144,13 +142,6 @@ def page(_context, name, permission, for_=Interface,
# on method objects
func = func.im_func
func.__doc__ = "Stub docstring to make ZPublisher work"
else:
# we could use the class verbatim here, but we'll execute
# some security declarations on it so we really shouldn't
# modify the original. So, instead we make a new class
# with just one base class -- the original
cdict['__page_attribute__'] = attribute
new_class = makeClass(class_.__name__, (class_, simple), cdict)
else:
# template
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment