[Zope] dtml-let and product
I have a simple test Zope product inheriting from Cacheable, PropertyManager and SimpleItem. Say I have a dtml method at http://myzopeinstance.com/testdtml with contents I'd like "myvar" to be available in the__call__ method of testproduct. I don't know how to do that. Here's my testproduct __call__ method: def __call__(self, client=None, REQUEST=None, **kw): foo="1. client:"+str(client)+"" \ +"2. REQUEST:"+str(REQUEST)+"" \ +"3. kw:"+str(kw)+"" \ +"4. getattr(..REQUEST..):"+str(getattr(self, "REQUEST", None))+"" \ +"5. getattr(..client..):"+str(getattr(self, "client", None))+"" \ +"6. getattr(self, myvar...):"+str(getattr(self, "myvar", None))+ "" \ +"7. aq_get(self, myvar...):"+str(aq_get(self, "myvar", None))+ "" return foo >From poking around I was expecting "myvar" to be accessible somewhere from >that list either directly or as an attribute of one of the objects, but it's >not. Every call (via a web browser) displays None for every line except #4, >the getattr(self, "REQUEST", None) statement. Containment acquisition works more or less the way I would expect, i.e. if myvar is a dtml method in the same folder then the text "hello world" shows up on lines 6 and 7. (I don't understand though why the REQUEST object is always None; I thought when a DTML method calls another object the client and REQUEST parameters are passed in.) I'd appreciate it if someone can explain to me how things work and what I'm doing wrong. Looking for last minute shopping deals? Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping___ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Re: [Zope] dtml-let + 'expr=' possible?
Lee wrote: > > I think: ..will do it, if it doesn't, then you probabyl can't :-S cheers, Chris ___ 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 )
[Zope] dtml-let + 'expr=' possible?
Hi, I have one quick question about the 'let' tag; gives me the value 'class52225'. Is there anyway I can use the 'let' tag to push this onto the namespace stack? I was thinking something *like*; The python method, classcode_to_table, takes in a string, alters it and returns it. This is going to be an argument for some ZSQL methods and some Python methods. Thanks, Lee ___ 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] DTML-LET problems
Mohan try this, -AndyD > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Mohan > Baro > Sent: 08 December 2000 14:41 > To: [EMAIL PROTECTED] > Subject: [Zope] DTML-LET problems > > > Why doesn't the following code work? > How do I achieve the desired functionality? > > > "> > > > > Mohan. > > ___ > 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 ) > ___ 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 )
[Zope] DTML-LET problems
Why doesn't the following code work? How do I achieve the desired functionality? "> Mohan. ___ 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] DTML-LET problems
Thanks Ivan & Peter, It work!. Mohan. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Ivan Cornell Sent: Friday, December 08, 2000 10:25 AM To: Mohan Baro Cc: [EMAIL PROTECTED] Subject: Re: [Zope] DTML-LET problems Mohan Baro wrote: > Why doesn't the following code work? > How do I achieve the desired functionality? > > "> > > > > Mohan. You can't embed dtml within dtml. Try: Ivan PS, I would have replied to your previous post if it hadn't been in HTML! ___ 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 ) ___ 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] DTML-LET problems
Mohan Baro wrote: > Why doesn't the following code work? > How do I achieve the desired functionality? > > "> > > > > Mohan. You can't embed dtml within dtml. Try: Ivan PS, I would have replied to your previous post if it hadn't been in HTML! ___ 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] dtml-let ?
Mark Twiddy writes: > Im totaling columns returned from a zsql thingy is there an easy way to do > this in dtml. can do that for you. Look at the documentation, section "variables for statistics". 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 )
[Zope] dtml-let ?
hi all Sorry fro the dumb question. Im totaling columns returned from a zsql thingy is there an easy way to do this in dtml. thanks mark ___ 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] dtml-let and quoting(?) or forcing to string
"Mayers, Philip J" wrote: > > > > > Anything in a DTML tag that's inside "" is python, usually ;-) So, your dtml-let should be: which is kinda yucky, don't you think? cheers, Chris ___ 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 )
[Zope] dtml-let and quoting(?) or forcing to string
All, I've just setup a test Zope installation. So far, very impressive. I'm using a Postgresql database containing a network hierarchy (basically, a table with a "network" column, and a "parentnet" column). I'm trying to display this with a tree view, using the following DTML: Where the network "0/0" is the pseudo-parent of every other network. The problem is, python (or DTML, I don't know) interprets this as a divide by zero, and it fails. The other alternative "0.0.0.0/0" also fails: Expression (Python) Syntax error: invalid syntax , for tag , on line 15 of test_html (I'm doing all this through the web management interface). I'm not familiar with Python (yet - the book is on it's way) but in the command-line interpreter, this works fine: >>> "0.0.0.0/0" '0.0.0.0/0' >>> "0/0" '0/0' >>> I need to cast the value to dtml-let to a string. How? I know how to do this in Perl/C/Java/Pascal, but it's not obvious to me why this isn't working. Yours, dumbly Regards, Phil +--+ | Phil Mayers, Network Support | | Centre for Computing Services| | Imperial College | +--+ ___ 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] dtml-let help
Pete Kazmier writes: > I'm trying to keep a cumulative count while sequencing over a list via > the dmtl-in tag. I tried this but it didn't work, Zope complained > about the syntax > > > > > > > > I can tell you, why you get the syntax error. Luis Cortes has told you, how you could do your job. Explanation: Python distinguishes between expressions which can be "eval"ed and commands which can be "exec"ed. Assignments are commands, as are definitions, if, for, while constructs. Zope uses "eval" to evaluate expressions in DTML-tags. "eval" raises a SyntaxError when confronted with a command. 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] dtml-let help
I tried the same thing, it doesn't work (or at least, I haven't found a way to make it work). What I do now is use REQUEST.set('totalActive',0 ) and REQUEST.get('totalActive') when I need the value. The other alternative is to write it in a python method. Regards, Luis. On Fri, 26 May 2000, you wrote: >> I'm trying to keep a cumulative count while sequencing over a list via >> the dmtl-in tag. I tried this but it didn't work, Zope complained >> about the syntax. Could someone help me or point me in the right >> direction, I search the archives but couldn't find anything relevant? >> Thanks! >> >> > totalUnknown="0" >> totalPorts="0"> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> -- >> Peter Kazmier http://www.kazmier.com >> PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654 >> >> ___ >> 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 ) -- == Luis Cortes Pollak EPD (915) 621-6113 == ___ 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 )
[Zope] dtml-let help
I'm trying to keep a cumulative count while sequencing over a list via the dmtl-in tag. I tried this but it didn't work, Zope complained about the syntax. Could someone help me or point me in the right direction, I search the archives but couldn't find anything relevant? Thanks! -- Peter Kazmier http://www.kazmier.com PGP Fingerprint 4FE7 8DA3 D0B5 9CAA 69DC 7243 1855 BC2E 4B43 5654 ___ 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 )