[ZDP] mmmmmm...

Shaw, Howard ShawH@STHS.org
Fri, 7 May 1999 13:49:59 -0500


> ----------
> From: 	Tom Deprez[SMTP:Tom.Deprez@uz.kuleuven.ac.be]
> Sent: 	Friday, May 07, 1999 1:09 PM
> To: 	zdp@zope.org
> Subject: 	[ZDP] mmmmmm...
> 
> I'm totally not sure about this piece of text. Maybe others know more?
> I've
> also written some q'ns down I really don't know the solution of :
> 
> Zope Object Request Broker
> 
> The Z ORB is the real engine, it finds itself inside the Z Publisher.
> It
> makes it possible that Pyhton  objects can be published as WWW
> resources.
> <-> conflict with Z Publisher text
> 
I apologize if my text is unclear. It is based on my own limited
understanding of the internal structure. I have not yet looked at much
of the internal code.. I probably should before writing more, lest it be
mere misinformation. 

> Zope Object Database
> 
> The Z ODB is used for storing all the Zope applications and web sites.
> The
> database is build in such a way that it looks and feels like a
> filesystem
sp = built
> to end users. So, every object you create is stored in the Z ODB. This
> way
> an object can look into the hierarchy of the Z ODB to determine it's
> context.
> 
> More text?
> 
> 
> Z Framework
> 
> The Z Framework keeps Zope Objects together. But what is Z Framework
> exactly? Is it something physical, or are it some rules which
> developers
> have to follow?
> 
This is the framework as I understand it... I could be totally off
here...

The Z Framework is a set of rules, guidelines, and mixin classes, which,
when followed, permit arbitrary Python code to participate in the Zope
hierarchy in a manner functionally identical to the original elements.
The Framework provides mixin classes to allow outside Python classes to
participate in Persistence, Acquisition, and other technologies. It also
includes API functions and rules and guidelines for when and how to call
these, so that a given class can influence its position in and
relationship to the hierarchy and other objects in the hierarchy. It
also permits Python classes to participate in the internal security
structure, by defining permissions relevant to themselves, which can
then be made available through the web interface.

The simplest explanation of the Z Framework, is that it is the
difference between a Zope External Method, and a Zope Product. An
External Method is arbitrary Python code, and can even call Zope API
functions, but does not fill all the requirements to act as an
independent object in the hierarchy. It is added via a wrapper object in
the interface. A Zope Product, on the other hand, by conforming to the Z
Framework, can define the proper mechanisms for adding objects it
defines to the framework, controlling how they persist, how they can be
acquired, what they acquire, and supplying security information to the
overall Framework.

The Framework can also be viewed in an immediate sense as the collection
of objects existing within the ZODB which conform to the theoretical
Framework, much like a C++ or Python Class, and an instance of that
class. Thus the Framework can be seen as a base class which defines the
rules by which a inheriting class's instance can become a member of the
collection of instances that are the Framework instance.


I would appreciate it if some of the other people on the list could
comment on my understanding of the Framework...

> Z Templates
> 
> Zope wasn't anything if it didn't had a way to display it's
> information.
> Ok, let's assume you go to a shop and buy a self-to-build beach-seat
> (or
> how do you call this?). Opening your box, you find the pieces of the
> seat ,
> but also a manual. This manual explains how to build the seat and how
> it
> eventually will look like.... Same goes here for objects. We know that
> objects merely are a collection of data and methods. Without a
> 'manual'
> they can't present the data in a certain way. The 'manuals' of these
> objects are called Templates, Z Templates to be correct. The Z
> Templates
> provide the way how the data has to be formatted. So, when an object
> is
> asked to send it's data, the object first formats the data according
> to a
> template in the right way and then sends the result back. If an object
> has
> several Z Templates, it can send it's data in several formats,
> dependend on
> the questionar. One time an object has to publish it's data into an
> XML
> format, while another time it publishes it's data into HTML.
> 
> Z SQL Methods
> 
> We told you that it is possible to use existing data of external
> relational
> databases into Zope. But how is this possible you may ask? An external
> database isn't presenting itself as an object and Zope only works with
> objects... However it is possible. Z SQL Methods are operating as a
> go-between. Z SQL Methods are objects and can be used inside Zope.
> They ask
> an SQL query on the relational database. The database itself performs
> the
> query and returns with a result. The Z SQL Method then contains data,
> which
> is the result of the query. Because Z SQL Method is an object, the
> data of
> the Z SQL Method can be used by every other object in Zope. Ok, ok,
> you may
> think, but that can't be everything... all relational databases should
> be
> able to know SQL (it's a standard)... but the connection to a database
> isn't standard specified... 
> 
> Z Database Adapters
> 
> That's where the Z Database Adapters (Z DA) are needed for. Z DA are
> objects which provide the code which is specific per database server.
> So
> the real answer to 'how can we connect Zope to a database' is. When
> creating a Z SQL Method object you've to specify to which Z DA it
> belongs.
> The Z DA needs a connection string, so it can connect itself to the
> database. From that moment on Zope is always connected to that
> database.
> Thus, when an object asks the data of an Z SQL Method, the Z SQL
> Method
> sends the query to the database for which it is intended. The
> connection is
> already done by the Z DA. The SQL query is performed by the database
> and
> the result is returned to the Z SQL Method. Which on it's turn makes
> the
> data available for the object who made the request.
> 
> 
I would present this in the opposite order...

Zope Adaptors

	A Zope Adaptor is a piece of code machinery which resides as an
object in the ZODB, and provides a connection to an external data
source. The most common variety of Adaptor is the SQL Adaptor, though
recently IMAP and LDAP Aaptors have also appeared. The Adaptor mediates
a connection, potentially long-running, between internal objects in the
ZODB and the external source. In the case of an SQL Adaptor, this
connection is to a specific database being served by a specific server
of a specific type. Thus one Adaptor object in the database might give
access to the finances database being served by PostGresSQL on port 994
with username 'finance' and password 'manager', while another give
access to the 'resources' database served by MySQL on a computer in
another building with username 'HQX33' and password 'jjg44S22'. 
	However, Adaptors do not always provide direct access to the
data. Particularly in the case of SQL Adaptors, a second component is
necessary to cause any data to be passed in either direction.

Zope SQL Methods
	SQL databases depend on SQL (Structured Query Language) for
their communications. SQL Methods encapsulate a particular query,
including parameters. The query can include DTML code for dynamism. When
accessed with the appropriate parameters, the SQL Method accesses the
already open connection through the SQL Adaptor, and transmits the query
(constructed with DTML and SQL) and returns the result in a special
structure, which may be easily iterated over.

> What's the difference between Zope Applications and Zope WebSites? 
> 
Presumptively, a Zope Website is a unified concept encompassing the
totality of pages visibly connected via links and appearance to a given
endeavor, that is to some extent running on Zope. That is, given a large
company with several divisions, one may speak of the company website,
and mean by that all the divisions as well, or one may speak of a
division's website. Thus website is not a technical term, but one of
appearance.

A Zope Application is a particular service implemented in Zope. For
example, a web based email interface, a data display from an SQL
database, an online editable FAQ, etc.. This is what we would nominally
call a Product, although it is probably more exactly a closely tied
collection of Product instances.

Neither is really a well-defined technical term. Zope Product, and Zope
Database, are the two terms most closely related, and both have clear
definitions. It is hard to ask questions about the first two, as they
are amorphous. It is far easier to speak coherently about the second
two.

> Is it possible to have two Zope WebSites running next to each other?
> 
In the sense that a website is simply a coherent collection of pages, of
course. Two ZODB's, on the other hand, cannot be easily served by one
Zope instance; however, even here they could run as two separate Zope
instances on different ports, or under different directory names through
CGI.

> Tom.
> 
> _______________________________________________
> ZDP maillist  -  ZDP@zope.org
> http://www.zope.org/mailman/listinfo/zdp
> 
Howard Clinton Shaw III
St. Thomas High School