[Zope-dev] zpatterns-0.4: defaults attributes, more...

2000-07-13 Thread Ava
hello, thanks to philipp for its explanation for 'class_default_for_X'. I'm not at the office now, and I can't do a reply on the message from the archives ;-) I have a rack that must retrieve informations from 2 sql tables. I set up 3 generic attribute providers: - one that get data from the

Re: [Zope-dev] zpatterns-0.4: defaults attributes, more...

2000-07-13 Thread Phillip J. Eby
At 07:11 PM 7/13/00 +0400, Ava wrote: first generic attribute provider: fromexpr = '(self.id[0] and sql_get_first(key=id[0]) or [NOT_FOUND])[0]' attrsexprs = ['first_data=RESULT.data'] second generic attribute provider: fromexpr = 'self.id[1] and sql_get_first(key=id[1]) or

Re: [Zope-dev] zpatterns-0.4: defaults attributes, more...

2000-07-13 Thread Jephte CLAIN
"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 write: data=self.which_one and self.second_data or self.first_data but this failed because sometimes self.second_data is a