Re: [Zope] REPOST: dtml-with doesn't work
I checked the sources Shai Berger writes: > My experience is somewhat different: ZSQL methods in general *DO* > look at the namespace just like normal DTML methods, with two > exceptions: ZSQL methods do *NOT* look at the DTML(!) namespace. They do look at REQUEST or (exclusive) explicitly provided keyword arguments *AND* they can acquire names from the ZSQL methods and its acquisition context. > ... > and > only look at a very limited local namespace, initialized with the > REQUEST and passed arguments; but even this namespace may be modified, > *INSIDE* the ZSQL method, with and . I see, I should have been more specific. ZSQL methods do not look at the DTML namespace of the *CALLING* document template. They use a document template (to generate the query) which is evaluated in a (newly creatd) namespace. Of cause, it looks at this DTML namespace in the usual way. And all DTML tags are available to extend this namespace. > However, > other tags behave quite normally -- which means that a lot of the > problems can be bypassed by thoughtful use of , especially > using the sql_quote modifier (BTW, it is by virtue of this that you > can call other methods -- even other ZSQL methods -- from within a > ZSQL method). There is no difference with respect to name lookup between "dtml-var" and "dtml-sqlvar" or the other "dtml-sql*" tags. They *ALL* work with the same namespace. > 2) Changing REQUEST does *not* update the local namespace, that is, > within a ZSQL method, That is right. The reason is that "REQUEST" is not part of the newly generated namespace in which the ZSQL template is evaluated. "REQUEST" is acquired. > > > > doesn't work; but > > > > Does. Dieter ___ 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] REPOST: dtml-with doesn't work
Philip has already made it clear that this was not his problem, but still, Dieter Maurer wrote: > Just a remark: > > SQL methods do *NOT* look at the DTML namespace *AT ALL*, > just at REQUEST (or the expliciitly passed keyword arguments). > > Thus, "dtml-with", "dtml-let" and friends are all ineffective > with respect to ZSQL methods. > My experience is somewhat different: ZSQL methods in general *DO* look at the namespace just like normal DTML methods, with two exceptions: 1) The major one, is that Dieter's remark does describe (almost) correctly the behavior of and . These two tags only look at a very limited local namespace, initialized with the REQUEST and passed arguments; but even this namespace may be modified, *INSIDE* the ZSQL method, with and . However, other tags behave quite normally -- which means that a lot of the problems can be bypassed by thoughtful use of , especially using the sql_quote modifier (BTW, it is by virtue of this that you can call other methods -- even other ZSQL methods -- from within a ZSQL method). 2) Changing REQUEST does *not* update the local namespace, that is, within a ZSQL method, doesn't work; but Does. Hope this helps, Shai. ___ 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] REPOST: dtml-with doesn't work
Usually, I complain that problem reports are too terse. But, your's was very big, such that I did not read it carefully. It is very difficult to get it right for everyone. Just a remark: SQL methods do *NOT* look at the DTML namespace *AT ALL*, just at REQUEST (or the expliciitly passed keyword arguments). Thus, "dtml-with", "dtml-let" and friends are all ineffective with respect to ZSQL methods. May be, that explains your problem. May be not, as I am not sure, that you need the values indeed inside a ZSQL method. I can assure you: "dtml-with" does work. Dieter ___ 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 )