Hi all, I'm a newbie to Zope, using version 2.7.3 (okay it is not the newest one) and I want to know if there is something like a MVC approach available for Zope, i.e. Model-View-Controller approach, as it is for instance in Java with the Struts framework from Apache. To be more specific: - The Model consists of several python classes implementing business logic (the pendant to Enterprise Java Beans or simple Java Beans) - The Views producing the visual appearance of the business objects (in java or more specific in Struts these are the custom tag libraries) - The Controller, as a kind of glue between the two above, is controlling the work/process-flow (in java with servlets and in struts with actions classes (as a minimum) ) To transfer this appraoch to Zope, I'm not sure: Views: DTML-Document and/or DTML-Methods? Controller: PythonScripts? Models: I'm absolutely not sure, Pluggable brains? (the Zope book has a example but only as a handling of resultsets) So if has anybody a hint if there are some resources in the web, please post it. P.S: I don't know Zope 3 (Is that apossible answer of my questions?) Thasnks in advance Regards Thomas Adams
On Wednesday 03 August 2005 22:06, Thomas Adams wrote:
Hi all,
I'm a newbie to Zope, using version 2.7.3 (okay it is not the newest one) and I want to know if there is something like a MVC approach available for Zope, i.e. Model-View-Controller approach, as it is for instance in Java with the Struts framework from Apache.
Sure its possible to implement MVC in Zope2 (we did it for our product), especially if youre not afraid of Python Products, though theres no special support for this in Zope 2.7 You really should be looking at Zope3 or Zope2 + Five (which is part of Zope2.8) for this though. See the Zope3 Developers Book, eg. http://www.zope.org/Wikis/DevSite/Projects/ComponentArchitecture/Zope3Book/c... - peter.
To be more specific:
- The Model consists of several python classes implementing business logic (the pendant to Enterprise Java Beans or simple Java Beans)
- The Views producing the visual appearance of the business objects (in java or more specific in Struts these are the custom tag libraries)
- The Controller, as a kind of glue between the two above, is controlling the work/process-flow (in java with servlets and in struts with actions classes (as a minimum) )
To transfer this appraoch to Zope, I'm not sure:
Views: DTML-Document and/or DTML-Methods?
Controller: PythonScripts?
Models: I'm absolutely not sure, Pluggable brains? (the Zope book has a example but only as a handling of resultsets)
So if has anybody a hint if there are some resources in the web, please post it.
P.S: I don't know Zope 3 (Is that apossible answer of my questions?)
Thasnks in advance Regards Thomas Adams
Thomas Adams wrote:
Hi all,
I'm a newbie to Zope, using version 2.7.3 (okay it is not the newest one) and I want to know if there is something like a MVC approach available for Zope, i.e. Model-View-Controller approach, as it is for instance in Java with the Struts framework from Apache.
(snip description of MVC à la Struts)
To transfer this appraoch to Zope, I'm not sure:
Views: DTML-Document and/or DTML-Methods?
Nope, use ZopePageTemplates instead. DTML is useful for non-html templating (css, Javascript, SQL etc), but it's an horror when it comes to html IMHO.
Controller: PythonScripts?
You could get away with Python scripts, but Zope product(s) might be your best bet. Note that a single Zope Product can be composed of multiple classes, external methods, templates etc...
Models: I'm absolutely not sure, Pluggable brains?
Why ? This goes into the product too. Understand that a Zope product is not restricted to a single class, and that not all classes in a Zope product needs to be persistant or whatsoever. My 2 cents -- Bruno Desthuilliers Développeur bruno@modulix.org
Thomas Adams wrote:
Hi all,
I'm a newbie to Zope, using version 2.7.3 (okay it is not the newest one) and I want to know if there is something like a MVC approach available for Zope, i.e. Model-View-Controller approach, as it is for instance in Java with the Struts framework from Apache.
...
P.S: I don't know Zope 3 (Is that apossible answer of my questions?)
Yes, Zope 3 has a MVC-like architecture. We call it the Component Architecture. It lets you separate responsibilities into different components (objects), e.g. content objects (they can be persistent, for example, or come from an RDBMS), views (e.g. browser views that produce HTML), adapters (enhance components with functionality), and utilities. For a structured introduction, see http://dev.zope.org/Zope3/ProgrammerTutorial or http://worldcookery.com. It is also possible to use Zope 3 style components in Zope 2 already, by using the Five product: http://codespeak.net/z3/five/. However, if you don't have any Zope 2 legacy, I can only recommend you start with Zope 3 from the beginning. Best regards, Philipp
participants (4)
-
bruno modulix -
Peter Sabaini -
Philipp von Weitershausen -
Thomas Adams