[Zope3-Users] ZCML debugger?

Roman Susi rnd at onego.ru
Mon Feb 13 14:27:46 EST 2006


Stephan Richter wrote:
> On Sunday 12 February 2006 10:19, Roman Susi wrote:
> 
>>Could it be beneficial to have some kind of wizard which could help
>>write ZCML configurations?
> 
> 
> Sure. I think a lot of people would be happy about a tool like that. The way 
> ZCML is constructed should make it very easy to retrieve all needed 
> information, build RelaxNG schemas, etc.

Lets hope someone will scratch the itch...

>>Or at least some good documentation on what is the meaning of ZCML
>>constructs.
> 
> 
> Have you looked at "http://localhost:8080/++apidoc++"? It contains a 
> dynamically generated ZCML documentation section. If you think that this 
> facility is not well-organized you could easily contribute improvements 
> there.

Sure, I know about this. But I can't right away tell what is wrong
there. Maybe, reading/writing ZCML requires more experience. That is, if
you see (or think about) some definition and then write ZCML code right
from the head... With Python the way from needed semantic to syntax is
more direct... And I remember it was from the first day I learned Python...

Not that I claim Python could be better for ZCML task, but maybe some
"wizard" like thing is needed to help learn it. I am not sure. Sorry, I
have not some up with anything constructive yet.

>> - what is the purpose of declaration (for example, what is the purpose
>>of declaring that OFS.Folder.Folder is traversable?) (that is, pragmatics)
> 
> 
> Note: This is a five directive, not a native Zope 3 one.

Yes. Most frustration comes from Zope 2/Five where broken configure.zcml
are silently ignored... So, the real question is:

 - is there any way in Zope2/Five and/or Zope 3 to check zcml for
obvious errors?

>> - what is needed to be declared (and where) to achieve certain typical
>>goals (like: in order to implement View class to this Content classes,
>>you need to add this to ZCML configure)
> 
> Books are for that. Both Philipp and my book explain what directives you need 
> in the situations presented.

Yes, certainly. I have not yet tried to read paper books.

>>Also, someone noted that write-once principle is broken with ZCML: it's
>>very verbose to at least my taste.
> 
> 
> It is not really more verbose than Python.

I think, it is: it requires to repeat the same (sometimes long) things like:

.thispackage.browser.thatview

and doesn't give visual picture what is adopted to what. It's like
assembler:

 LOAD A
 LOAD B
 ADD A, B
 STORE C

instead of

 C = A+B

or even

 C = ADD(A, B)

>>And after ABC of ZCML there lay a layer of idioms, unspoken patterns, etc.
> 
> 
> Can you elaborate? I do not understand what you mean.

I mean that when there are many ways to do the same, idioms are invented.

For example, what is better way to include browser's subdir
configure.zcml: by include package or include file?

My little experience tells me that file include (while it makes some
names longer) is more explicit, because I can use classes from the
Content directory (usually up the path).

That is,

 - mypackage
   + - browser
   +   \configure.zcml  <- here I can use .mymodule if it is included as
file
   + mymodule.py
   \ configure.zcml

But the point is, there are at least 2 ways. And there are also, it
seems, idiomatic meanings of meta.zcml (not sure what is the difference
as technically they are the same as configure.zcml), etc.

So, lot of knowledge also is hidden in the practice of writing things
some way. And it is not always self-evident where I see some idiom or
required way to describe things.

> Regards,
> Stephan

Sincerely yours,
Roman


More information about the Zope3-users mailing list