RE: [Zope] How a WebSite works using Zope?
I think you are on the right track in conceptualizing this; Zope does a very good job in making it easier to break things up into easily digestible small (generally) single-purpose components. Everything is an object in Zope, including granularly small single-purpose software components (like ZSQL methods and the database adapter objects they use, or python scripts, page templates, or user folders) that you place/arrange inside container objects (folders). You may want to strongly consider using Zope Page Templates (ZPT) instead of DTML; they are documented well in the 2.5 (online) version of the Zope Book. They keep code, generally speaking, out of the presentation, and even allow you to have designers create mockup that gets stripped at runtime. You'll get much better editor possibilities if you use ZPT because it won't break syntax highlighting in most text-based HTML editors, and will work with WYSIWYG editors without breaking layout. In your case, make your design, including some made-up mockup example data in the templates using ZPT. Write some scripts or ZSQL methods to get/set relevant values from content stored in the ODB or RDBs respectively. Then write business-logic Python scripts that uses the data (or write to data) and outputs something friendly for calling by a page template, like a sequence/list or a string as a return value. Once you have all of these components in place, use TAL attributes inside the HTML in your ZPT pages to call those middle-tier scripts. This process will get you two things: 1 - the ability to modularize everything into tiers with differing concerns, keeping application code, data-access code, and presentation code separate, and potentially create a useful division of labor. 2 - You can storyboard your application visually in HTML before your code is done (which is one of ZPT's main strengths). Sean -----Original Message----- From: Raphael Ribeiro [mailto:raphaelribeiro@terra.com.br] Sent: Saturday, May 18, 2002 1:32 PM To: zope@zope.org Subject: [Zope] How a WebSite works using Zope? I don't know , then i'm asking this, but is it the way i'm thinking? In your index and other pages you call your zope objects using DTML , it's like that, you create an object in zope that takes some data of your SQL Server DB, and then in your index page, you call that object that takes some data? And then the DATA appears... Another question , is: Is there any DTML editor , and how can i separarate the business logic and the front-end in ZOPE? It's like, i want to make a design , and then i want to integrate it , with my Zope website, and i don't want the codes to be a mass , how can i do it?
sean.upton@uniontrib.com wrote:
I think you are on the right track in conceptualizing this; Zope does a very good job in making it easier to break things up into easily digestible small (generally) single-purpose components. Everything is an object in Zope, including granularly small single-purpose software components (like ZSQL methods and the database adapter objects they use, or python scripts, page templates, or user folders) that you place/arrange inside container objects (folders).
You may want to strongly consider using Zope Page Templates (ZPT) instead of DTML; they are documented well in the 2.5 (online) version of the Zope Book. They keep code, generally speaking, out of the presentation, and even allow you to have designers create mockup that gets stripped at runtime. You'll get much better editor possibilities if you use ZPT because it won't break syntax highlighting in most text-based HTML editors, and will work with WYSIWYG editors without breaking layout.
One thing that I am not sure about ZPT is speed when compared to DTML; it's slower, at least that is the perception I gather from the posts I've read on this list, am I mistaken? Any Zope guru outthere could opine on this? Don't mean to start a DTML/ZPT conflict, just an honest question ;-).
In your case, make your design, including some made-up mockup example data in the templates using ZPT. Write some scripts or ZSQL methods to get/set relevant values from content stored in the ODB or RDBs respectively. Then write business-logic Python scripts that uses the data (or write to data) and outputs something friendly for calling by a page template, like a sequence/list or a string as a return value. Once you have all of these components in place, use TAL attributes inside the HTML in your ZPT pages to call those middle-tier scripts. This process will get you two things:
1 - the ability to modularize everything into tiers with differing concerns, keeping application code, data-access code, and presentation code separate, and potentially create a useful division of labor.
2 - You can storyboard your application visually in HTML before your code is done (which is one of ZPT's main strengths).
Sean
-----Original Message----- From: Raphael Ribeiro [mailto:raphaelribeiro@terra.com.br] Sent: Saturday, May 18, 2002 1:32 PM To: zope@zope.org Subject: [Zope] How a WebSite works using Zope?
I don't know , then i'm asking this, but is it the way i'm thinking?
In your index and other pages you call your zope objects using DTML , it's like that, you create an object in zope that takes some data of your SQL Server DB, and then in your index page, you call that object that takes some data? And then the DATA appears...
Another question , is: Is there any DTML editor , and how can i separarate the business logic and the front-end in ZOPE?
It's like, i want to make a design , and then i want to integrate it , with my Zope website, and i don't want the codes to be a mass , how can i do it?
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
-- Jorge O. Martinez MIS Senior Associate eMediaMillWorks 1100 Mercantile Lane, Suite 119 Largo, MD 20774 E-mail => jmartinez@eMediaMillWorks.com Phone => (301)883-2482 ext. 105 Fax => (301)883-9754
The ongoing discussion is unfortunate and should have been kept to some dev lists. It just means that people are thinking about how to improve ZPT, it sure does not mean to prefer DTML for (of all reasons) "performance"... Stefan --On Dienstag, 21. Mai 2002 13:21 -0400 "Jorge O. Martinez" <jmartinez@eMediaMillWorks.com> wrote:
One thing that I am not sure about ZPT is speed when compared to DTML; it's slower, at least that is the perception I gather from the posts I've read on this list, am I mistaken? Any Zope guru outthere could opine on this? Don't mean to start a DTML/ZPT conflict, just an honest question ;-).
-- BLOWFISH, n. - Preference for beef
Stefan H. Holek wrote:
The ongoing discussion is unfortunate and should have been kept to some dev lists. It just means that people are thinking about how to improve ZPT, it sure does not mean to prefer DTML for (of all reasons) "performance"...
Right. Here at ZC, we always favor page templates over DTML for HTML page generation, so if there really is a performance issue, we'll have to face it and fix it. Besides, I have my doubts that there really is an issue. ;-) Shane
Shane Hathaway wrote:
Right. Here at ZC, we always favor page templates over DTML for HTML page generation, so if there really is a performance issue, we'll have to face it and fix it. Besides, I have my doubts that there really is an issue. ;-)
What, aside from the fact that ZPT is demonstrably slower than DTML? cheers, Chris
On Tue, 21 May 2002, Chris Withers wrote:
Shane Hathaway wrote:
Right. Here at ZC, we always favor page templates over DTML for HTML page generation, so if there really is a performance issue, we'll have to face it and fix it. Besides, I have my doubts that there really is an issue. ;-)
What, aside from the fact that ZPT is demonstrably slower than DTML?
It's only demonstrably slower for simplistic tests. Because TALES is more explicit, the expressions you use in ZPT tend to be more efficient than DTML. I can't say whether ZPT is thus faster than DTML, but I think ZPT provides more opportunities for optimization. A simple example is "request/foo" vs. "<dtml-with REQUEST><dtml-var foo></dtml-with>". ZPT grabs the name "request" from a dictionary, then gets an attribute called "foo". DTML searches the entire acquisition path to find REQUEST, puts it at the top of the namespace, gets an attribute called "foo", then pops the topmost namespace. If speed really is a concern, the current page templates are a bit wasteful in a couple of spots and someone could look at cleaning them up. For example, we use the "Script" base class, which drags in bindings, but bindings aren't needed! Shane
On Tue, May 21, 2002 at 01:21:46PM -0400, Jorge O. Martinez wrote:
sean.upton@uniontrib.com wrote:
I think you are on the right track in conceptualizing this; Zope does a very good job in making it easier to break things up into easily digestible small (generally) single-purpose components. Everything is an object in Zope, including granularly small single-purpose software components (like ZSQL methods and the database adapter objects they use, or python scripts, page templates, or user folders) that you place/arrange inside container objects (folders).
You may want to strongly consider using Zope Page Templates (ZPT) instead of DTML; they are documented well in the 2.5 (online) version of the Zope Book. They keep code, generally speaking, out of the presentation, and even allow you to have designers create mockup that gets stripped at runtime. You'll get much better editor possibilities if you use ZPT because it won't break syntax highlighting in most text-based HTML editors, and will work with WYSIWYG editors without breaking layout.
One thing that I am not sure about ZPT is speed when compared to DTML; it's slower, at least that is the perception I gather from the posts I've read on this list, am I mistaken? Any Zope guru outthere could opine on this? Don't mean to start a DTML/ZPT conflict, just an honest question ;-).
This is my take, based on limited experience, and without doing rigorous benchmarks. I am going to refer to Script (python) as snake_thingie. Tested in isolation, ZPT is without doubt slower than DTML. I have seen figures that indicate that it is MUCH slower. But, I believe, again without real testing, that in a real production environment, that a snake_thingie/ZPT based system is not slower than a DTML based system. The reason is that you are forced to move essentially all logic into the snake_thingie. In the DTML based approach, you had a double interpretation problem, DTML was being interpreted using a mostly python based approach. In the snake_thingie/ZPT, you have the situation where business logic is going much faster, and presentation is much slower. This appears to be about a wash. Now, in the best of all possible worlds, you could write a snake_thingie/DTML system, getting both faster business logic and faster presentation. I have been moving that way for quite a while, and find that I just can't do it. ZPT goes much further in "encouraging" you to do clean separation. As an aside, in my opinion, "Path Expressions" are underutilized in the Zope Book, and many of the examples show elements with both a condition and a content (or condition and replace). This produces slower code simply because of double evaluation! Jim Penny
participants (6)
-
Chris Withers -
Jim Penny -
Jorge O. Martinez -
sean.upton@uniontrib.com -
Shane Hathaway -
Stefan H. Holek