James Johnson wrote:
> I wonder if you are planning on releasing some UML stuff related to
> ZPatterns and Zope?
I don't think UML is a very good match for describing either the
internals of ZPatterns, or for describing systems built using ZPatterns
-- or Zope for that matter.
> I use a Freeware product called DOME. It has
> support for UML and COAD-YOURDON OOA.
For Zope and ZPatterns work, I prefer the Coad notation to UML. It is
more Object-oriented, whereas UML is more class-oriented.
I tend to use a whiteboard and digital camera for modeling work. Either
that, or pens and paper.
> I'm don't have any formal
> training so I'm still trying to figure out what it all means.
Keep on figuring. I think you're doing ok :-)
> If you have any example diagrams that you can share that would be
> most kind.
What would you most like a diagram of? I find diagrams generally most
useful when they come along with a description in words.
> Here is the code I was trying to use in the first place.
> <h2> Inserting new Guest Book Table Info Item!</h2>
> <dtml-let id="'entry_%d' % len(self.objectIds())">
I can see what you're trying to do here. You can't do it like this
You can't use "len" or "self" in dtml. The variable "self" is kind of
taken as read in most cases. Use "_.len()" for "len()". So, you could
<dtml-let id="'entry_%d' % _.len(objectIds())">
However, although this will return a value, it still won't do what you
want. The items that you store in a specialist actually live in a Rack.
They are not visible as normal sub-objects that you can access using
The number returned by len(self.objectIds()) represents the number of
DTML methods, DTML documents, folders, External methods, Python methods,
images, files and so forth, plus the number of Racks and Data-PlugIns in
Rather that try to give you new item a unique sequential id, try just
giving it a unique id.
You can use a method in a Rack called "newKey" for this. Then, this
method will be called to determine the new id, you pass _.None (from
DTML) or None (from a Python method or an External method).
I use this external method to generate a new unique key for my racks. I
put this inside the Rack, from the rack's methods tab.
from DateTime import DateTime
# self is a rack instance
fk = lambda x: 'entry-%d' % x
n = int(DateTime().timeTime())
max_tries = 10
key = fk(n)
while max_tries and self.getItem(key) is not None:
n = n + 1
max_tries = max_tries-1
key = fk(n)
> <dtml-call "ni.propertysheets.manage_addPropertySheet
> (id='GBookProps', ns='')">
You'll want a dtml-let here I should think.
> <dtml-call "nips.manage_addProperty('guest_name', guest_name,
> <dtml-call "nips.manage_changeProperties(REQUEST)">
And, of course, another dtml-let closing tag here.
Zope-Dev maillist - [EMAIL PROTECTED]
** No cross posts or HTML encoding! **
(Related lists -