[Zope] .dtml files

2000-07-12 Thread Daniel Rusch

I've been digging into to the inner workings of Zope trying to gleen as
much Zen as possible, before I implement a write of our existing
framework.

During this process I have noticed that Zope's dtml pages are stored on
the file system as .dtml files (i.e. roleEdit.dtml) The question then is
how does Zope display this pages??

I have found function calls such as:
manage_roleForm=HTMLFile('roleEdit', globals()) which I believe creates
an HTML document template from the named file. But, what is the
mechanism that calls/displays mange_roleForm?

Thanks in advance,

DR


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] .dtml files

2000-07-12 Thread Jonothan Farr

 I have found function calls such as:
 manage_roleForm=HTMLFile('roleEdit', globals()) which I believe creates
 an HTML document template from the named file. But, what is the
 mechanism that calls/displays mange_roleForm?

The class heirarchy looks something like this:

Globals.HTMLFile
DocumentTemplate.HTMLFile
DT_HTML.HTMLFile
DT_HTML.HTML
DT_String.String

You want to look at the __call__ method of the DT_String.String class for
enlightenment, although I'll warn you that it's likely to make anyone but Jim's
head explode. ;)

--jfarr

"Perl is worse than Python because people wanted it worse."
Larry Wall, 14 Oct 1998



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] .dtml files

2000-07-12 Thread Patrick Lewis

The object has a method named manage_roleForm.  In your example, an object
which is (or inherets from) Role will have a manage_roleForm, and can be
accessed just like any other method, assuming adequate permissions.

Using an example I am more familiar with, if you have a DTML Document
index_html (which inherits from PropertyManager), you can call
index_html/manage_propertiesForm, which will render the file
'properties.dtml'.

This is one of those things that when I discovered it, I did the 'this is
so cool' dance.

-- 
Patrick Lewis
[EMAIL PROTECTED]

On Wed, Jul 12, 2000 at 01:30:13PM -0500, Daniel Rusch wrote:
 I've been digging into to the inner workings of Zope trying to gleen as
 much Zen as possible, before I implement a write of our existing
 framework.
 
 During this process I have noticed that Zope's dtml pages are stored on
 the file system as .dtml files (i.e. roleEdit.dtml) The question then is
 how does Zope display this pages??
 
 I have found function calls such as:
 manage_roleForm=HTMLFile('roleEdit', globals()) which I believe creates
 an HTML document template from the named file. But, what is the
 mechanism that calls/displays mange_roleForm?
 
 Thanks in advance,
 
 DR

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] .dtml files

2000-07-12 Thread R. David Murray

On Wed, 12 Jul 2000, Daniel Rusch wrote:
 I have found function calls such as:
 manage_roleForm=HTMLFile('roleEdit', globals()) which I believe creates
 an HTML document template from the named file. But, what is the
 mechanism that calls/displays mange_roleForm?

Actually, it creates a renderable DTML object, I think.  Which
might be saying the same thing.

What calls it is the Zope management framework.  Somewhere you
should find manage_roleForm getting assigned into a structure like
manage_options= or some such.

In short, magic grin.

--RDM


___
Zope maillist  -  [EMAIL PROTECTED]
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 )




re: [Zope] .dtml files

2000-07-12 Thread Steve Alexander


Daniel wrote:
 During this process I have noticed that Zope's dtml pages are stored on
 the file system as .dtml files (i.e. roleEdit.dtml) The question then is
 how does Zope display this pages??

The pages are usually accessed as attributes Python objects. They are
wrapped in a HTMLFile instance.

(Line numbers refer to latest Zope 2.2b4).

For example, see line 191 of lib/python/OFS/DTMLMethod.py:

  manage_editForm=HTMLFile('documentEdit', globals())

See the source in lib/python/DocumentTemplate/DT_HTML.py for details.
The documents are read lazily.

class HTMLFile(FileMixin, HTML):
"""\
HTML Document templates read from files.

If the object is pickled, the file name, rather
than the file contents is pickled.  When the object is
unpickled, then the file will be re-read to obtain the string.
Note that the file will not be read until the document
template is used the first time.
"""
--
Steve Alexander
Software Engineer
Cat-Box limited
http://www.cat-box.net

___
Zope maillist  -  [EMAIL PROTECTED]
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 )