Quick Guide to Zope

Executive Summary

Zope was originally a commercial, closed-source product called Principia and offered by Zope Corporation, formely Digital Creations. It was open-sourced in 1998. Zope is a mostly Python-based web application development tool, with C bits for performance-critical parts. At best of my knowledge, it's an open-source equivalent to ColdFusion or UserLand. All objects (scripts, HTML templates, data, etc.) live in a database, which is the single-file-based ZODB by default but that can be moved to a full-fledged DBMS server. Scripts can be written with either Zope's own DTML language, Perl, or Python. Extra modules are available, such as Zope's Content Management Framework (CMF) or the Slashdot-like blogger Squishdot.

Why use Zope...

... in the absolute?

After playing with simpler Zope-like tools like CherryPy, I finally figured why using Zope et al. is a better alternative to writing PHP scripts on top of a regular web server like Apache: An application server is aimed at making it easier to build web applications, and especially make it possible to handle web pages as objects and methods.

For instance, while http://localhost/support/index would execute a stand-alone PHP script located in eg. the docs/support/ section on the hard disk of a regular web server, the same URL could execute the index() method of the Support class under an application server. And locating common stuff in a Root class makes it a snap to share properties and methods with classes located below in the hierarchy... Definitely beats PHP scripts scattered around in a filesystem, each page independent from the others.

Pros

Cons

  • Acquisition
  • Clear distinction between logic and presentation thanks to ZPT and Python scripts
  • Main language is Python, an excellent OOL
  • ACLs
  • Versioning (changes are not displayed until developers say so)
  • Easy access to content with through the web editing
  • Access to RDBMS
  • Choice between using ZServer (Zope's own web server) or setting up Zope as a module to eg. Apache
  • Plone is a very good CMS (Content management system)
  • Steep learning curve
  • Development is quite different from regular Python or PHP
  • Mostly Python-based, so performance could be an issue
  • How resilient is Zope's HTTP server as compared to eg. Apache or AOLServer?
  • Python scripts only allow a sub-set of capabilities : must use external methods for other features
  • In real life, data live in the ZODB, on the file system (full-fledged Python scripts) and a DMBS
  • ZODB being a single, binary file (data.fs)... what about stability and data corruption?
  • Search engine is barely usable
  • Versioning not up to par with real source control software (what changed between the two versions?)
  • TTW editing (either text or image) not as good as full-fledged editor like UltraEdit. Working through FTP is not as simple as editing files from a file system (Update: You can use the Wing IDE for Python: "Using Wing IDE with Zope", or Boa Constructor)
  • No dedicated client, so no easy WYSIWYG editing to add content besides using the DHTML widget (IE only) and no support for disconnected mode
  • Much fewer developers than eg. PHP or Python in non-Zope environments

... over PHP + MySQL + templating engine?

After playing with PHP and frameworks (templating engines like UltraTemplate, or the mini-ZOPE PHITE)... I finally understood the beauty of ZODB and in-context acquisition:

From: "Wankyu Choi"

I don't consider myself an *ex*-PHP developer, but just wanted to share my thoughts.
 
I developed and still develop all those serious applications in PHP and even wrote a couple of books on the language with Wrox. PHP has a lot to offer in various aspects, and does have its own set of advantages over Python and Zope.
 
However, when it comes to that old theme of web developers, separating presentation and logic, I cannot but admit that Zope beats PHP hands down (of course, unless you DTMLify all of your Zope applications and gave them 'welcome-to-my-jungle' looks^^) In a way, PHP encourages mixing presentation and logic. I feel for that 'immediate convenience' for a number of occasions and came up with applications that do all kinds of presentation and logic mix-ups.
 
One good example is PHP NeoBoard vs. Zope NeoBoard.  PHP NeoBoard has been in heavy use since 1999. I stopped developing it in PHP once I realized I could do it in less than two days in Zope. And I did. Ported (not even ported, just borrowed concepts from) PHP NeoBoard to Zope in less than a few hours. My jaw just dropped at that moment I saw a 'better' NeoBoard work after a few hours of coding in Zope. It took me more than a few moths to get there in PHP. Just compare the length of the code: Zope NeoBoard 1.1b has tons of more  features than PHP NB 3.0 does with far fewer lines of code.
 
Guess it's not entirely fair to compare Zope and PHP in all aspects since we should see Zope as a developing platform/application server not a language. But as a web development platform, yes, I came to choose Zope over PHP. All I developed for basic foundation on which to develop other applications in PHP: Zope already got it. One good example: you don't have to seek a template engine. Zope already has it. I have yet to find a better template engine than ZPT. I still marvel at the elegance in its design.  Just spend a couple of hours with ZPT, you'll know what I mean.
 
Another strong point of Zope is... It's based on Python: complete OOP language. Rumor has it that even PHP5 wouldn't be 100% oop-ish. What's missing in PHP in terms of object-orientedness, you get more than you need with Python and Zope. Personally, I'd go for Python over even Java for OO-ness. Python simply helps you  (even forces you to) code in far cleaner and more extensible way. In terms of OOP-ishness, two more points for Python and Zope.
 
For the sake of fairness, however, Zope has a few drawbacks (and ZPT for that matter).
 
1. 'THE' PHP community is hundreds of times bigger than that of Zope. (Hundreds? Guess some Zopistas wouldn't agree.... that's sad but true. For instance, in Korea, I can even count everyone that can do any serious stuff in Zope with my two sets of fingers. PHP? Everywhere you look.) You'd know what I mean by this. I had a real hard time figuring out how I go about doing the same stuff in Zope as I did in PHP.
 
Documentation/community support/etc, ammunitions that you desperately need in this sometimes-very-very-cold opensource world, is far weaker than those of PHP.  (It might be a blessing in disguise since from the opposite end, that means you'd be rarity with Zope expertise: huge demand and little supply^^  To extend that Korean market anology, we have so many PHP developers that we even hear 'PHP developer' jokes as American people do lawyer jokes;-)
 
2. It comes with its own object database, which is something really new to PHP developers. I have yet to find a good and Zope-friendly way out of it, as a matter of fact. I have tons and tons and tons of data that I'm still wary of putting into ZODB.  (Okay some Zopistas, here, would say, hey that' not true! But yes it's true in my case. Suppose you have 100 giga bytes of data. More than 50% of it should be dynamically loaded into and unloaded from memory.  All I got, as of now, is a single-file ZODB storage. Having a single 100-giga byte file... I just can't take take. I do want a version-less file-based ZODB storage, which, again, as of now, is non-existent. I'm looking towards Directory storage, but it's still in beta. ZEO? Well, I don't have the hardware to go with that option. I've been doing this; no problem with LAMP - Linux, Apache, MySQL, PHP combo. But with Zope, it IS a problem now. What I really, desparately want from ZOPE is a bit more leeway in selecting strorage options. Maybe... ZOPE3/ZODB4 combo? )
 
3. Elegance (separating presentaton and logic: MVC model) sacrifices performance: I found ZPT is way slower than DTML and mixed-up PHP code (but you'd get into similar dilemma if you opt for any template engine in PHP since that would take a whole lot more time to render, anyway.) I used to choose performance over anything else, thus the mix-up of presentation and logic. I changed that attitude. I got sick and tired of re-doing all the applications I developed years ago, months ago,  weeks ago, and even days ago: I can't immediately figure out what I was doing in that block of code in PHP NeoBoard 3.0, for example. I tried my own template engine with PHP NeoBoard 3.0, an attempt that miserably failed. I did a message board, community club application, e-commercing application, web-base mail application, etc: the works in PHP. I'm RE-doing them all in Zope. Why? Thought it'd be better to redo them all from scratch than extending or even modifying the mess.
 
Zope and PHP are good tools in their own rights. One might be preferred in some areas and the other in the others. Simply put, one can't beat the other in all aspects.
What comes on top of your priority list, that's what counts, IMHO.

Also read Switching from PHP to Zope/Python by salimfadhley, and (French) Quel choix, Zope ou LAMP (php3 et php4)? .

Architecture

Zope (Z Object Publishing Environment) is an open-source alternative to UserLand, ie. a web-based development environment. It is almost entirely written in Python, and is used as an easy-to-use and powerful content management system. Content is viewed through a regular Web client, and can be edited through XML-RPC, WebDAV, or FTP, depending on what is available on the client host.

Zope comes with its own web server, but it can also run applications and have those be called by a remote web server through CGI. If your storage needs are not too important, all objects can be saved in the Object Database (ZODB); Otherwise, Zope can also outsource storage to an external DBMS server. Zope programs are written in the DTML (Document Template Markup Language) scripting language, but can also be written in other languages like Perl or Python, and can also include in-line HTML content, just like PHP and other server-based languages. Contents can be handled through a web interface. Zope also supports Undo to correct an error, and versioning to keep different versions of a document. Zope keeps data, code, and layout in one location.

A Zope applications is built from objects, of which there are three types: Content, Logic, and Presentation. Objects are containted in Folders.

Support for disconnected mode is minimal: An object, eg. a Folder, can be downloaded into the client host as an Export file, and imported into the user's Zope server at home. Later, the user must export this object from his Zope server into his laptop, Import this object into an empty folder on the Zope server at work, delete the original folder, and move the new version in its place...

As for editing documents, users are expected to either type HTML text in an edit box (which can be made easier by building documents in a WYSIWYG editor like Namo WebEditor, or semi-WYSIWYG editor like Hippie98, and copy/pasting the output into the edit box), or upload an HTML file into the right folder in Zope. If the latter, only one file can be uploaded, which leaves the issue of add-on files like images, style sheets, etc. By default, the FTP server that comes with Zope is listening on port 8021. Zope supports versioning, but differences between two versions of a document are displayed in HTML source, making it unusable for longer documents.

Until clients catch up to the latest WebDAV standard and understand the difference between the source of a document and its result, Zope offers a special HTTP server you can enable with the -W command line option. This server listens on a different port than your normal HTTP server and returns different, special source content for WebDAV requests that come in on that port. This is an advanced feature and is explained more in the Documentation Section of Zope.org.

(From the Zope site)

Setup

Linux

Binary tarball

  1. Make a dir where you want Zope to live, and cd to it: mkdir /var/zope ; cd /var/zope
  2. untar the package there
  3. change the owner of this directory to the user account under which Zope will run later (eg. nobody:nobody): chown -R nobody.nobody /var/zope
  4. Switch to the ad hoc user: su - nobody ; cd /var/zope
  5. ./install -u nobody -g nobody
  6. Write down the manager login name and password
  7. ./start &
  8. netstat -tuplan, and check that a process is listening on port 8080 (It can take a minute until Zope is up and running, so be patient)

Source tarball

RPMs

As of Sept 8th, the RPMs available from Tau Productions installed OK, but the server fails starting with "Startup exception : error: (91, 'Protocol wrong type for socket')". In any case, a standard RedHat 7.1 comes with Python, while Zope 2.4 needs Python2:

  1. rpm -Uvh python2-2.1.1-3.i386.rpm
  2. rpm -Uvh python2-devel-2.1.1-3.i386.rpm
  3. rpm -Uvh Zope-2.4.1-1.i386.rpm
  4. rpm -Uvh Zope-zserver-2.4.1-1.i386.rpm

NT

  1. Download and run the installer
  2. Run Drive:\Program Files\WebSite\start.bat
  3. Write down the admin login/password

Backing up Zope

Here's a backup procedure on Zope.org: http://mail.zope.org/pipermail/zodb-dev/2002-October/003418.html

Installing Zope products

"Products" are add-ons to enhance Zope. To install a new product, copy its files under (Unix) /lib/python/Products or (NT) "c:\Program Files\WebSite\lib\python\..", and restart Zope.

Removing Zope products

Head for the Control Panel | Products section, remove the products, and also remove the ad hoc folders under $ZOPE/lib/python/Products (otherwise, they get re-added the next time you run Zope)

Tips

Once you're done installing Zope, launch a web brower, aim at http://myzopesrv:8080/manage, and log on as the admin account with the password given to you during install.

Important: If you are having problems with copy and paste, make sure that you have enabled cookies in your browser. Zope uses cookies to keep track of the objects that you cut and copy.

You can change the admin's password by running the zpasswd.py Python script.

To start the Zope HTTP server, run python z2.py. -z tells the script where Zope is installed.

A startup script located in /etc/rc.d/init.d/ calls up other Zope scripts and set required variables for z2.py

To export an object from a Zope server, and import it into another server:

  1. In the Zope Management Interface, select the object, and click on Export
  2. As explained, the file was saved in the sub-directory var/ as myobject.zexp
  3. On the target server, create a sub-directory import/ on the same level as other main directories (eg. var/)
  4. Copy the myobject.zexp into import/
  5. In the ZMI, go to the location in the tree where you wish to import the object, and click on Import/Export
  6. Fill the Import editbox with the exact file name without its pathname, eg. simply myobject.zexp

To download the directory tree or part of it before uploading it to a remote FTP site, you can use wget with the following options:

wget -k -l 0 -m -nH -np -r http://localhost:8080/mysite

Post-install customizing

Virtual servers

If you wish to host more than one site on a single server, whether it only has one IP or has more than one address assigned to the network interface, you'll need to set up virtual servers, ie. each site has its contents located in its own sub-directory in ZODB.

The usual way is to install VHM (Virtual Host Monster; might already be part of the Zope distribution if you downloaded a binary package), add the Apache web server to act as front-end, and set up Apache and Zope so that requests go through Apache and are redirected to Zope. The added bonus of using Apache as a front-end are security, load, and manageability (Toby Dickenson  says : "A lot of problems go away if using Apache Squid or Pound").

Some deeper information on Virtual Host Monsters can be found here. Please note that "SiteRoots", which also can be used to create virtual roots in Zope are deprecated. Don't use them unless you really know why you need them.

VHM redirects calls to a given folder,and, if you're not using a front-end web server like Apache, can also handle the task of rewriting the URL. It will only do this even the URL contains keywords like VirtualHostBase and/or VirtualHostRoot. For instance "/VirtualHostBase/http/www.site-b.com" rewrites the URL to "http://www.site-b.com"; Note that if Zope is running on port 8080, the URL will keep this port number, ie. the URL will be rewritten to "http://www.site-b.com:8080"; If you wish to use a different port, you must include it, ie. use "/VirtualHostBase/http/www.site-b.com:80".

If you include the keyword VirtualHostRoot somewhere in the URL, any part before this keyword is removed, and Zope starts afresh. For instance, "/a/b/c/VirtualHostRoot/d" will be reinterpreted as "/d", just like if folder "d" was located at the root.

Needless to say, users don't need to know this, since VHM rewrites those URLs dynamically when a request for a virtual site comes in.

Imagine Zope is installed at www.site-a.com, and you wish to add a second site, www.site-b.com on this host:

  1. Go to the root folder, and add a Virtual Host Monster (VHM) object by clicking on "Select type to add...". Any ID will do, eg. vhm
  2. In the root folder, create a folder that will host the document tree for the virtual site, eg. /site-b
  3. Go into this folder, and create a DTML Method, with id = index_html
  4. In the root folder, select the VHM object, and click on its Mappings tab
  5. Add the following : www.site-b.com/site-b
  6. Hit http://www.site-b.com : Zope will happily serve /site-b/index_html . You're in business :-)

More information

Performance

To increase performance, run Zope as a proxy module through Apache instead of CGI. Use ZEO to build clusters.

From: "Thomas B. Passin"

Subject: Re: [Zope] Re: Speeding up Zope startup

[Christopher Quinn]

No experience to speak of, but just having read the python tutorial, I see mention of its ability to write out .pyc files alongside the .py, and this compiled bytecode form yields faster startup times. If zope was installed for multi-users, the ownership probably does not allow for such files to be written, although this does not trouble python. So perhaps arranging for all .py files in the zope installation to be pre-compiled?

[Tom P]

It is not that. Python creates the .pyc files when they are non-existent or out of date, so after the first time Zope is run, the .pyc files will be exist. There was a thread awhile ago about this, and as I recall, people with very large database files - data.fs - had very slow startup times. So clean up and pack your database. Search the archives to see if you can find that thread.

 Hmm, you might want to check whether everything is okay with your data.fs. If something is wrong, Zope rebuilds some stuff. Recompile all your scripts, pack the database, see if that helps. I had a similar thing at one time and the only thing that seemed to help was starting over with a clean zope install and importing my old site.

From: Stephan =?ISO-8859-1?Q?G=F6ldi?= <goeldi@goeldi.com>

Am Fre, 2002-07-26 um 08.15 schrieb EvH:

> Is anyone else running Zope on a Windows workstation (P3) and witnessing a good 30-s delay until Zope is up and running? BTW, I installed Zope on one of my brother's PCs (a P2), and it's close to a minute...

It is not of interest, if it is a P2 or a P3. How many MHz? How many RAM? I have Zope running on a P166 with 64MB RAM for demonstration only (sic!) It starts the server in about 30 - 45 seconds. On our product servers (www.zopehosting.ch) restarting Zope takes about 5 seconds (Redhat, not micros~1.oft).We are speaking here of the starting of a server environment, not of micros~1.oft Word (which takes about the same time). So what is your problem?

From: "Barry Berenberg" <berenberg@higher-speed.net>

I'm running Zope 2.5.1 under Windows 2000 on a P3-500 machine. I start it manually as a service. The service seems to start quickly (it says it's started after 5 seconds or so), but it's another 30 seconds or so until I can access the server. I've watched the task manager while it's starting up, and it's the python.exe process that is using up CPU time during the wait.I just assumed 30 seconds was the normal startup time. On a 667 MHz G4 Powerbook (OSX 10.1.5), the Zope server takes 20-25 seconds to start.

ZOPE as a desktop CMS

Since it's pretty common for individuals to have some spare hard-disk on a mutualized server over at their ISP, but no way to install any software, we can run ZOPE on the desktop, generate a static snapshot of a site, and upload this output to the web server through FTP.

At this point, there are two venues:

Epoz

Epoz is a WYSIWYG editing widget written in JavaScript, and (Dec 2003) is currently available in two versions: 0.x is the original work of Maik Jablonski and is still under development because dumping this code base would break some apps, and the newer 1.x which is being rewritten by Guido Wesdorp and friends. More infos at http://codespeak.net/issues/epoz .

Here's how to install this widget:

  1. Go to Zope's Products sub-folder (C:\Program Files\zope\lib\python\Products\), untar FileSystemSite, followed by Epoz. Restart Zope
  2. At the root of a folder, add a "Epoz editor" object, and give it an id (eg. "epoz"). This will create a folder with several objects, such as JavaScript, etc. "Typically you want to use the editor macro in your own Page Template. First, create an 'epoz editor' object at the top of your folder hierarchy and give it an id, e.g. 'epoz'. Then, create a page template and make use of the macros and slots documented in API.txt using 'here/epoz/epozmacros/macros' as TALES path prefix (if you have named the editor object 'epoz')."

Latest news (April 2004): "As of now, the in-browser WYSIWYG editor formerly known as epozNG has a new name: Kupu! Even though it was never the intention, the Epoz WYSIWYG editor development had split in 2 branches, confusing both developers and users. Hopefully the new name settles this confusion."

IEDocument

External Document

OODocument

CMF or Plone + OpenOffice

XMLRPC clients

How to set up and test xmlrpc in Zope

XMLRPC File into ZOPE

Make XMLRPC Calls From ZOPE

Creating XML Applications With Zope

Internet Scripting: Zope and XML-RPC

xmlrpc utility for Windows

A Zope 3 story - augmenting other components

XML-RPC HOWTO

Using Zope as an XML-RPC Server

Advanced XML Applications in Zope

Writing applications

DTML is the older templating format provided by Zope. A newer, prefered alternative is ZPT (Zope Pages Templates.) ZPT consists of TAL (Template Attribute Language), METAL (Macro Expansion Template Attribute Language), and TALES (Template Attribute Language Expression Syntax.)

Advices given on the Zope mailing list is to read the following material:

Writing business apps with Zope

From: Paul Winkler <pw_lists@slinkp.com>
On Mon, Dec 09, 2002 at 09:50:22PM +0100, Frederic Faure wrote:

I'm back to playing with Zope, except this time I need it as a tool to rewrite business apps (payroll, in this case.) I've read the New Riders book along wit the online Zope Book. I understand that DTML is evil and that new users should prefer ZPT.

I wouldn't say that DTML is evil... simple DTML is very nice, it's just that *abuse* of DTML is evil and it's always tempting to add just "one more thing" instead of breaking it out into a script.  And you can abuse ZPT pretty easily, too... tal:define and tal:condition and tal:repeat give you plenty of rope. It's somewhat more explicit rope than some of the magic DTML stuff, and there's a lot less of it; but you can still hang yourself with it. :)

Anyway, is there a good document for newbies that come from procedural languages like VB that would show them how to get up to speed?

The "Advanced Scripting" chapter in the online Zope book is a decent introduction to this kind of thing, although it's a lot more nuts-and-bolts than best-practices.  I said *introduction*... it has little examples of forms that are processed by scripts that can call other scripts, etc.

Since you say "procedural languages", I suspect what you really need is to read this:

http://www.zope.org/Members/mcdonc/HowTos/gainenlightenment

Again, it isn't exactly what you asked for - it's heavy on rah-rah and contains no real "how do I..." stuff. But it will get you in the right mind-frame.

I need to understand how to separate logic and presentation as cleanly as possible.

Object orientation will help you here. Remember what the Extreme Programming guys say: "Refactor mercilessly". When you see some logic in your presentation templates, ask yourself, "What is the maximum amount of this logic that I can break out into a separate script? what is the absolute minimal amount of logic that I can have  in this template and still get the job done?"  

For example, look at the code in a tal:condition="..." statement.  Do you have to do a bunch of tal:defines just to set up the condition? Do you have nested tal:conditions? Can you put all that stuff in one python script and  in this template just have tal:condition="here/myscript"? These are the kind of low-level questions you can ask yourself.  

As far as architecture of your app... big topic. TOO big. "It depends."

From: Dylan Reinhardt <zope@dylanreinhardt.com>

I've written several business apps in Zope and would suggest one best  practice right off the bat: acquire more experience with your tools.

Not to be discouraging, but you'll need more than passing familiarity with  your development environment before you take on programming any reasonably  important business system.  Yes, payroll software can be done in  Zope.  Yes, it's even a good idea.  But I would encourage you not to make a  payroll system your first major project... in *any* language or  environment.  Particularly not if you're operating under any kind of deadline or expectation of useful results.

As for frameworks, Zope *is* a framework and a very powerful one at  that.  Virtually anything Zope doesn't already do can be done with Python products.

Read a good book on programming with Python (O'Reilly's Learning Python 2nd Ed. is my recommendation).  Then read the Zope Developer's Guide (http://www.zope.org/Documentation/ZDG) at least three times.   Develop a product that exposes a basic interface and can return functional administration screens using either ZPT or DTML.  Give yourself at least a month or two to do all this.

At the point where you're weighing issues more technically nuanced than whether DTML is evil (it isn't), I think you'll probably find a lot of help available for any ambitious projects you may be ready to take on.

From The Zope Book

DTML Tags

Windows client

Some projects are currently under way to offer a Windows dedicated client as an alternative to Web-based access: Zope Fat Client, gnope (GNOME Zope client), and an example Python client from Amos ??.

The latter requires (obviously) Python, the tarball of the client, the wxPython toolkit, and the xmlrpclib module. More infos @ http://www.xml.com/lpt/a/2000/01/xmlrpc/index.html . Python 2.x ships with Zope (eg. Drive:\Program Files\WebSite\bin\), but even this path to the PATH variable didn't help: wxPython complained that no Python 2.1 was installed; Installing Python-2.2b1.exe didn't help either because wxPython really wants Python 2.1.

Installing the xmlrpclib modules is done by copying the .py files the archives contains into Drive:\Program Files\WebSite\bin\lib\ . Once you're done, just untar the archive of the client, open a DOS box, and run "python ZopeClient.py".

Squishdot

Once you have Zope installed, a quick and easy way to set up a news and discussion portal ("weblog") is to install Squishdot:

  1. Untar the Squishdot tarball into its own sub-directory under /var/zope/lib/python/Products/ (Unix), or Drive:\Program Files\WebSite\lib\python\Products\ (NT)
  2. Restart Zope
  3. Aim your browser to http://localhost:8080/manage
  4. In the "Select type to add..." combobox, select SquishDot Site
  5. Give it an ID (this will be part of the URL, eg. http://localhost:8080/mysquish/), and a Title. Click on Add
  6. Connect to http://localhost:8080/mysquish/. To post a new article, click on the Post Article link in the upper left-hand corner.
  7. To make changes to your Squishdot site, go back to its main page, and click on the Admin link in the left-hand corner (or aim at http://localhost:8080/weblog/manage). This brings you into the Zope administration screen. The interesting tabs in the navigation bar (upper part of the screen) are Postings, Options, and Properties

Programming Tips

Editing code from UltraEdit

  1. File | FTP | Open from FTP
  2. Create an account, eg. domain=localhost, name=root, password=test, FTP Port=8021. Optionaly, you can fill the Initial Directory setting to be pointed to a specific folder in ZODB once you're connected
  3. Click on Close to save this new account
  4. Back in the main dialog, click on Open to list the content of ZODB
  5. Double-click on a file to edit it. To avoid being prompted by UE whether to convert from UNIX to DOS format, there is a setting in UE that tells it to perform this conversion automatically: Advanced | Configuration | General : "Auto convert Unix files"

Alternatively, you can set up Windows to map a drive letter to point to an FTP server: Right-click on the desktop, New, Shortcut, ftp://root:test@localhost:8021/

To access APIs in Python

_.module.method, where "module" is string, math, random, whrandom. Variables can be accessed through _.attribute, where "attribute" can be things like chr(x), eg. <dtml-var expr="_.chr(65)">

To display a list of folders

Create a DTML Method object and add the following code to have Zope create a list of folders in the current folder, each item appearing as a URL:

<dtml-in "PARENTS[0].objectIds('Folder')">
<a href="<dtml-var sequence-item url_quote>">&dtml-sequence-item;</a><br>
</dtml-in>

To display a list of folders and their content

Method 1

Documents themselves must be of type DTML Document since that's what we're looking for. So far, I haven't found a way to sort the H2 sections, don't know why they appear in such and such order, and can't handle a tree with a depth superior to 1 (ie. sub-folders in folders)

<dtml-in expr="objectValues('Folder')" sort=sequence-item>
<dtml-if sequence-item>
<H2><dtml-var title_or_id></H2>
<ul>
<dtml-in "_['sequence-item'].objectValues('DTML Document')">
<li><a href="&dtml-absolute_url;"><dtml-var title_or_id></a></li>
</dtml-in>
</ul>
</dtml-if>
</dtml-in>

You can learn more about the ObjectManage class and its method objectValues at http://www.zope.org/Documentation/ZopeBook/AppendixB.stx

 

???? I should've also said.. take care to make sure that all the objects in which you might acquire standard_html_header have a document_title method.. ??? you might also use:

<dtml-if document_title>&dtml-document_title;<dtml-else>&dtml-title;</dtml-if>


or somesuch.

 

Yes. Do it the other way around. Instead of including things from the documents, make a template, and include the content from it.

Make a DTML Method or a ZPT called index_html and put it in the root. From that include the content (in dtml with a <dtml-var content>) and then putall the content into dtml-methods called "content". Put one method in each folder making each folder a document. This also makes it easier to create automatic navigation.
ps. For $850 you can skip all this fiddling, and use Easy Publisher instead. You'll get templating and automatic navigation, news services  and more. ds

 

Check the documentation of the ObjectManager (methods: objectIds() or objectValues()). They are described in Appendix B of the Zope Book.

 

Maybe you would prefer to leverage acquisition. You'd create a universal DTML Method called "list_documents" in your root folder. This method simply lists documents in the current folder. And then you would place the following code in each folder:
<dtml-var standard_html_header>

<dtml-var list_documents> <dtml-var standard_html_footer>

How to add a Home link when the home folder is not the Root folder?

Eg. http://localhost/dummy-root/ ? Using <a href="/">Home</a> or <a href="..">Home</a> are not good solutions.

How to display a document's Title and ID through a default standard_header section?

Here's the standard_header section that I use:
    <html><head><title><dtml-var title></title><dtml-var style_sheet></head>

    <body>
    <table border="0" width="100%">
        <tr>
            <td width="70%"><h1><dtml-var document_title></h1></td>
            <td><dtml-if expr="_.len(PARENTS) > 2"><a href="..">Return to parent</a></dtml-if></td>
            <td align="right"><img src="<dtml-var id>.png"></td>
        </tr>
    </table>

When adding this into the default index_html DTML Method object, I'd like the above banner to display the document's Title and a picture whose filename is eg. index_html.png.

Problem is, using <dtml-var document_title> displays "Standard Html Header", while <dtml-var title> displays the title of the container (eg. a sub-folder located under Root) instead of the document's own Title!

Solution: Use a DTML Document instead of a DTML Method... but doing so will break some things such as <dtml-in expr="objectValues('Folder')"> sections... Catch22.

To display an icon for an article

... either an icon that matches the name of the article (eg. mydoc.html.png), or a default icon if none exists for the article:

<dtml-try>
    <dtml-let imageObject="_[getId()+'.png']">
        <img src="<dtml-var getId>.png" border=0>
    </dtml-let>
<dtml-except>
    <img src="default_icon.png" border=0>
</dtml-try>

Thanks to Adrian Hungate from the Zope Development mailing list for the tip.

Q&A

Are there any good Zope-based CMS?

What are ZClass and ZPatterns?

ZPatterns Howto

How is the Zope Tutorial displayed when calling http://localhost:8080/?

The index_html object located in the root folder includes a reference to zope_quick_start, which is located in the Zope directory on the filesystem, eg. "C:\Program Files\Zope\lib\python\App\dtml\zope_quick_start.dtml"

Although Zope is listening on port 8021 and I can log on, Zope gets stuck before listing files and directories

I cannot access the root document (www.acme.com/) due to authorization failure

I fail inserting images into ZODB through the ZMI

Don't use quotes in the path to the image

I deleted a picture from the catalog, and added a new picture with the same id/Title, but the old picture still show up!

Delete the Image object, pack the database, and add the Image object

When viewing the source code, Zope uses absolute URLs instead of relative. How to force Zope to use relative URLs and external links?

<a href="http://localhost:8080/test/item1.html">Item1</a>

<tr><td align=right><a href="http://www.zope.org/Credits" target="_top"><img src="http://localhost:8080/p_/ZopeButton" width="115" height="50" border="0" alt="Powered by Zope" /></a></td></tr>

Note: The latter is coded as <tr><td align=right><dtml-var ZopeAttributionButton></td></tr> in the original DTML Document.

How to backup Zope?

If using ZODB, do I just need to back up all the files located in eg. "d:\Program Files\WebSite\var\.."? Is it OK if I just move those files onto another server?

How can I change the title of a folder?

Select the folder, and click on Properties.

When copy/pasting a large HTML file into a DTML Document object using Opera 5.12 as my browser, some of the content gets left out

Either try a more recent version of Opera, or use IExplorer.

DTML Document, DTML Method : Who needs both?

A DTML Document is a complete object in and of itself, while a DTML Method is a component of its container. Consequently, <dtml-var title> in a DTML Method object displays the title of its container.

Resources

Books

Reference Site

Various documents