"Phillip J. Eby" a écrit :
> Try:
> data=(self.which_one and [self.second_data] or [self.first_data])[0]

wow. what a *clever* idea to use [] around self.???_data. I used to

data=self.which_one and self.second_data or self.first_data

but this failed because sometimes self.second_data is a "false" value
(eg 0, '', instead of None that I use for empty values), causing
self.first_data to be returned instead.
one learns about python every day. thanks for the tip.
As I wrote in an earlier post, my initial problem was solved using
class_defaut_for_X trick

> Offhand, I'd guess that there is probably a lot easier way to do what
> you're doing, and that you probably don't even need/want "id" to be a
> sequence, let alone some of the other things you're doing here.  But
> without knowing what your app is actually trying to do, I can't suggest
> anything further.
I'm writing an application to track issues. I can not just use DC's
tracker product, because my customer's needs are very specials.
Well, various entities in my application have a so called 'location'. I
wish to be able to re-use the application I'm writing, so I abstracted
the concept of 'location'. i have then a specialist to manage locations
got from a location rack.
The rack I wrote for my customer deals with two-headed locations: (site,
subdivision). Each part of the location is managed in a different way,
but I need the two to identify one's location.
Later, when I install that program for a different customer, I want to
be able to rip out the old location rack and put another location rack
which can be more 'normal' (ie, one-headed) No one will notice except
the key to get the location is now an integer (or a string) instead of a

So, I think I'm doing right to have an id which is a sequence.

Thanks for your great help. I'm still fighting to acquire the principle
behind zpatterns, but once I get it, I wish I could help others to
understand it as well.


Zope-Dev maillist  -  [EMAIL PROTECTED]
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope )

Reply via email to