Volume 1 Issue 4, November 2002
|
Copyright (C) 2002 by Steve Litt. All rights reserved. Materials from guest authors copyrighted by them and licensed for perpetual use to Linux Productivity Magazine. All rights reserved to the copyright holder, except for items specifically marked otherwise (certain free software source code, GNU/GPL, etc.). All material herein provided "As-Is". User assumes all risk and responsibility for any outcome.
and Rapid Learning: Secret Weapon of the Successful Technologist by Steve Litt |
[ Troubleshooters.Com
| Back Issues ]
(discussing the role of Open Source licensing in Zope's success, during an interview with Steve Litt at the 1999 LinuxExpo in Raleigh, NC) |
CONTENTS
If you find yourself responsible for creating a large, dynamic website,
Zope is one of the must-evaluate products. And very possibly the best product
to use. Some say that Zope is difficult to learn. This issue of
Linux Productivity Magazine is a roadmap that shows you the path of least resistance in learning
Zope, and provides a roadmap for further learning.
Zope version 2.6 just came out recently, and although the content in this
magazine is based on Zope 2.5.1, you'll have no trouble using this magazine
to work with Zope 2.6.
So kick back, put your feet up, and read how you can use this powerhouse web development environment. And remember, if you use Linux or other free software, this is your magazine. Enjoy!
What's the benefit of learning Zope? I see several:
Note: |
NOTE:
This might be a good point to add a root level manager user. To do so, navigate to the root folder, then into the acl_users folder, then click the Add button, and add the username with password. Leave the domains field blank, and click Manager in the Roles dropdown. Last but not least, click the Add button to add this user. There are certain tasks the admin/emergency user can't do, and for those tasks you need a manager type user. |
Zope |
An
application server that also comes with a web server. Zope has all the tools
you need to make web applications. Zope is written in the Python language. |
Web application |
A computer program that users access with a web
browser over the Internet. The web application lets users use dynamic tools
to work with the application. |
Web app | Slang for web application. |
Three key ideas to understanding what Zope can do for you |
1) powerful collaboration, 2) simple content management, 3) and web components. |
Three layers of traditional web apps |
1) Databases, 2) Programs, 3) HTML and Layout. Zope
unifies all three layers, although programs can be extended in Python and
Perl, and data from other DBMS's such as Oracle or PostgreSQL can be read
and written from Zope. |
Web components |
Islands of code that interact with each other. .net and xml-rpc are examples. |
Roles people play in an application |
1) Consumers (visitors), 2) Business users (create
and manage content), 3) Site designers (create sites look and feel), 4) Site
developers (program the site's services), 5) Component developers (make software
for distribution), 6) Administrators (keep software and environment running),
7) Information Architects (platform decisions and big picture). Zope has
separate facilities for those assuming each role. For instance, the site
designer needn't add content, and the business user needn't concern herself
with appearance. To put this in Zopese, in Zope, Site developers create services to be turned over to Site Designers and Business Users, and Component Developers distribute new products and services for Zope users world wide. Another way of thinking of roles is that roles are like hats you put on at different times to do different jobs, or hats various people wear to do their jobs. |
DTML |
Zope's tag-based scripting language |
Zope Page Templates |
Zope's templating language for XML -- Zope's new tool to create dynamic HTML |
ZPT | Abbreviation for Zope Page Templates |
Zope Scripting |
How to write business logic in Zope |
The Catalog |
Zope's built-in search engine |
Zope Enterprise Objects |
A tool to scale Zope for huge numbers of customers.
Also facilitates data sharing between zope instances. This is what you use
when your app is successful enough to attract huge traffic. |
ZEO | Abbreviation for Zope Enterprise Objects |
Zope Components |
Web
server, Web based interface, object database, Relational integration,
Scripting language support. These are the high level components Zope uses
to build web apps. |
Zope management interface |
This is the high level interface by which you build Zope applications. Available at http://localhost:8080/manage. |
Zope Object Database |
Zope's built in database where they store all objects.
You can store your app's data here, or in other DBMS's such as Oracle, PostgreSQL,
etc. |
ZODB |
Abbreviation for Zope Object Database |
Relational Integration |
Zope's method of storing data outside of Zope (Oracle,
PostgreSQL, etc). Although Zope has its own data storage facilities, you'll
often need to write and access data from other systems. |
Database Adaptor (DA) |
A Zope product providing the Zope API for an external database such as Oracle, PostgreSQL, etc. |
Scripting language support |
You can build and enhance Zope functionality with
three scripting languages -- DTML Python or Perl. DTML is higher level but
not as capable. |
zpasswd.py |
Script to change usernames and passwords |
./start & |
How to start Zope manually |
Export |
Zope's facility to export a part of your Zope system for import on another Zope system |
Import |
Import a system part exported from another Zope system. |
Sessions |
Zope's mechanism to keep track of users. Alternatively,
you can use cookies. Sessions themselves can use cookies. Sessions have some
overhead cost. |
Session related objects |
1) Browser ID Manager, 2) Transient Object Container, 3) Session Data Manager |
Browser ID Manager |
To quote The Zope Book by ????: "Manages how visitors'
browsers are identified from request-to-request, and allows you to configure
whether this happens via cookies or form variables, or via a combination
of both. The default sessioning configuration provides a Browser Id Manager
as the /browser_id_manager object." <this is a quote from The Zope Book> |
Transient Object Container |
holds session data. It allows you to set how long
session data lasts before it expires. The default sessioning configuration
provides a Transient Object Container named /temp_folder/session_data. The
session data objects in the default session_data Transient Object container
are lost each time Zope is restarted. <this is a quote from The Zope Book> |
Session Data Manager |
connects the browser id and session data information.
When a folder which contains a session data manager is traversed, the REQUEST
object is populated with the SESSION, which is a session data object. The
default sessioning configuration provides a Session Data Manager named /session_data_manager.
<this is a quote from The Zope Book> |
REQUEST OBJECT |
The HTTP request, including cookies and form data restructered into a Zope object. |
Content Management Framework |
A Zope product that provides a full-blown member-oriented site for your Zope, with facilities for membership, news, topics, discussions, workflows, user folders and "skins". A great application of CMF would be for a departmental collaboration server!) |
CMF |
Abbreviation for Content Management Framework |
Zope Object Types |
Zope
has many types of objects. A good way to list them all is by clicking the
Add button in the Zope workspace. The following is the list on Zope version
2.5.1. The more common ones are defined later in this article:
|
Folder | Folders are objects whose purpose is containing other objects. |
Image | Image objects contain graphical images. |
DTML Document | Web content containing not only HTML, but also Zope markup language. Used primarily as a document. |
DTML Method | Very similar to a DTML document, but used primarily
as a component by other objects. To a small degree DTML documents and DTML
methods are interchangable. |
Z Gadfly Database Connection | An interface from your Zope app to a Zope relational database. |
Z SQL Method | A
container for a SQL statement. In general, a SQL statement is contained in
a Z SQL Method, which in turn is called by a DTML document or a DTML Method. |
Page Template | An
object to hold code similar to DTML, but more versatile. In fact, as time
goes on Zope Page Templates will be increasingly replacing DTML documents
and methods. |
Zope Tutorial |
A copy of the Zope tutorial. |
WARNING
Never put spaces in the Id field, because the Id becomes part of the URL, and URL's with spaces are truly nasty. If you feel the need for the readability that comes with spaces, substitute underscores for spaces. |
/my_folder/my_tutorial/examples/lesson1/home.html
http://localhost:8080/my_folder/my_tutorial/examples/lesson1/home.html
Danger Will Robinson!
The user and password screen is misleading. Do not fill in a user or password, as it will be rejected regardless of its correctness, at least on my Zope 2.5.1 setup. Instead, click the screen's cancel button. Then you will see the phrase "You have been logged out." on the main screen. That's how you know you're truly logged out. |
Warning!
The preceding security settings were a reckless strongarm to save time. In real life, you would uncheck only those Acquire permission settings checks that gave permissions to unauthenticated users, and for those that you unchecked, you'd check both Authenticated and Manager columns. The reason this article doesn't have you do that is it is easy to do it wrong and lock yourself out of the my_folder folder, and without a good knowledge of undo and emergency users, you could stay locked out. Also, many privileges are subtle, and without the brute force method you might not have kept out the unauthenticated. |
<html> |
http://localhost:8080/my_folder/my_python?name=FredYou'll see it works the same way, and gives you Fred's name. Now let's hook it up with a form:
<dtml-var standard_html_header> |
V. Termination A. Unless this Court grants an extension, this Final Judgment will expire on the fifth anniversary of the date on which it takes effect. B. In any enforcement proceeding in which the Court has found that Microsoft has engaged in a pattern of willful and systematic violations, the Plaintiffs may apply to the Court for a one-time extension of this Final Judgment of up to two years, together with such other relief as the Court may deem appropriate. |
Any article submitted to Linux Productivity Magazine must be licensed with the Open Publication License, which you can view at http://opencontent.org/openpub/. At your option you may elect the option to prohibit substantive modifications. However, in order to publish your article in Linux Productivity Magazine, you must decline the option to prohibit commercial use, because Linux Productivity Magazine is a commercial publication.
Obviously, you must be the copyright holder and must be legally able to so license the article. We do not currently pay for articles.
Troubleshooters.Com reserves the right to edit any submission for clarity or brevity, within the scope of the Open Publication License. If you elect to prohibit substantive modifications, we may elect to place editors notes outside of your material, or reject the submission, or send it back for modification. Any published article will include a two sentence description of the author, a hypertext link to his or her email, and a phone number if desired. Upon request, we will include a hypertext link, at the end of the magazine issue, to the author's website, providing that website meets the Troubleshooters.Com criteria for links and that the author's website first links to Troubleshooters.Com. Authors: please understand we can't place hyperlinks inside articles. If we did, only the first article would be read, and we can't place every article first.
Submissions should be emailed to Steve Litt's email address, with subject line Article Submission. The first paragraph of your message should read as follows (unless other arrangements are previously made in writing):
Copyright (c) 2001 by <your name>. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, version Draft v1.0, 8 June 1999 (Available at http://www.troubleshooters.com/openpub04.txt/ (wordwrapped for readability at http://www.troubleshooters.com/openpub04_wrapped.txt). The latest version is presently available at http://www.opencontent.org/openpub/).
Open Publication License Option A [ is | is not] elected, so this document [may | may not] be modified. Option B is not elected, so this material may be published for commercial purposes.
After that paragraph, write the title, text of the article, and a two sentence description of the author.