[Zope3-dev] Brainstorming about browser pages
dev at projekt01.ch
Sat Feb 18 06:30:22 EST 2006
> We'll be moving soon to having minimal ZCML configuration for pages,
> just pointing at the module and class to use for a set pages. Within
> the class there will be methods decorated with @page('name'), and
> attributes for page templates. So, a typical view class in Launchpad
> will look like:
> classes="DistributionView SpecialOtherDistributionView"
> class DistributionView(LaunchpadView):
> def initialize(self):
> # here, set up data before the page is rendered,
> # do redirections and avoid the page being rendered,
> # and process form POSTs.
> foo_page = page('foo.html', LaunchpadTemplate('foo.pt'))
> bar_template = LaunchpadTemplate('bar.bt')
> def render_bar_page(self):
> # do stuff, maybe using self.bar_template
> The advantage of all this is that you need to look in just
> one place to
> understand a view class. You don't need to look in both the ZCML and
> the Python code, just the Python code. The ZCML becomes simpler, and
> more focused on glueing pieces of Python code together, and less about
> what is to be displayed at what URLs.
Let my say somthing about that.
I like it and I think it's a good way for simplifie view registration
for a well defined project but not a fremawork where has to offer
a more open API for views.
Why not useable in frameworks;
because this means you have to use PageTemplates for such a API.
But Im OK with this as long we don't propagate this as a reusable
concept for the zope3 core or 3rd party applications.
I like it more to see real Pyhton view API's where can be used
with different templating systems in the future.
btw, I think this isn't really possible since it exist two
base templating pattern (push and pull). But a python view
class can always offer a API with the right set of methods and
If we think about MVC then I would say that such a pattern
isn't the right way to mix it with PageTemplate implementation.
But that's another part.
But I agree with you Steve, I think its a good concept if you
use it in project which uses PageTemplates and doesn't need to
offer a generic API.
> Steve Alexander
> Zope3-dev mailing list
> Zope3-dev at zope.org
More information about the Zope3-dev