Re: [Zope] Special-name of variables called 'name' or 'domain'

2001-01-10 Thread Chris Withers

"Mayers, Philip J" wrote:
snip
Try this:

Change your show method in root to be as follows:

dtml-in get_machine_hosts
 dtml-var show_row
 dtml-in get_host_aliases
  dtml-var show_row
 /dtml-in
/dtml-in

And add another DTML method in root as follows:

show_row:
TR
  TDdtml-var ip missing/TD
  TDdtml-name;/TD
  TDdtml-domain;/TD
/TR 

so you have:
 /root
   get_machine_hosts (SQL method)
   get_host_aliases (SQL method)
   show (dtml method)
   show_row (dtml method)

Does that solve your problem?
(I know it doesn't sovle any concerns you have about dtml-with and SQL
method, but your posting wasn't exactly to reproduce, and so even if
submitted to the collector, isn't likely to get followed up)

 While I'm at it, is dtml-with foldernamedtml-var dtmlmethod/dtml-with
 really the best way to call a DTML method of a folder?

Mostly, yes...

BTW, checkout http://www.zope.org/Members/michel/ZB/ and have a good
read :-)

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 )




RE: [Zope] Special-name of variables called 'name' or 'domain'

2001-01-10 Thread Mayers, Philip J

That was how I had the code originally. Didn't help. I've already read the
Zope 'book' (if I were using 2.3 (which I can't, because LoginManager
doesn't work OOTB), I'd be using Python methods to do most of this instead.
I'm not, I'm using 2.2.5)

Thanks anyway.

Regards,
Phil

+--+
| Phil Mayers, Network Support |
| Centre for Computing Services|
| Imperial College |
+--+  

-Original Message-
From: Chris Withers [mailto:[EMAIL PROTECTED]]
Sent: 10 January 2001 13:09
To: Mayers, Philip J
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] Special-name of variables called 'name' or 'domain'


"Mayers, Philip J" wrote:
snip
Try this:

Change your show method in root to be as follows:

dtml-in get_machine_hosts
 dtml-var show_row
 dtml-in get_host_aliases
  dtml-var show_row
 /dtml-in
/dtml-in

And add another DTML method in root as follows:

show_row:
TR
  TDdtml-var ip missing/TD
  TDdtml-name;/TD
  TDdtml-domain;/TD
/TR 

so you have:
 /root
   get_machine_hosts (SQL method)
   get_host_aliases (SQL method)
   show (dtml method)
   show_row (dtml method)

Does that solve your problem?
(I know it doesn't sovle any concerns you have about dtml-with and SQL
method, but your posting wasn't exactly to reproduce, and so even if
submitted to the collector, isn't likely to get followed up)

 While I'm at it, is dtml-with foldernamedtml-var
dtmlmethod/dtml-with
 really the best way to call a DTML method of a folder?

Mostly, yes...

BTW, checkout http://www.zope.org/Members/michel/ZB/ and have a good
read :-)

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] Special-name of variables called 'name' or 'domain'

2001-01-09 Thread Mayers, Philip J

I've got some SQL method, and a folder structure, and am seeing some *very*
annoying results. Namely, dtml-with seems to cancel out variable
assignments from an enclosing dtml-in

/root
  get_machine_hosts (SQL method)
  get_host_aliases (SQL method)
  show (dtml method)
  /host
show (dtml method)
  /alias
show (dtml method)

get_machine_hosts takes 'machineid' and returns 'name','domain','ip', e.g.

(for a 5-homed box) get_machine_hosts('535252'):

www,random.com,192.168.3.2
mail,hosting.com,192.168.3.3
news,random.com,192.168.3.4
sqldb,random.com,192.168.3.5
workstation,random.com,192.168.3.6

get_host_aliases takes 'ip' and returns 'name','domain' e.g.

get_host_aliases('192.168.3.3') [mail.random.com]:

'pop3','random.com'
'smtp','random.com'
'mail','random.com'
'imap','random.com'

But, I'm having problems with the 'in' and 'with' tags using the variable
'name'. The DTML methods are:

/root/show

dtml-in get_machine_hosts
  dtml-with hostdtml-var show/dtml-with
/dtml-in

/root/host/show

TR
  TDdtml-ip;/TD
  TDdtml-name;/TD
  TDdtml-domain;/TD
/TR

dtml-in get_host_aliases
  dtml-commentPOINT A/dtml-with
  dtml-with alias
dtml-commentPOINT B/dtml-with
dtml-var show
  /dtml-with
/dtml-in

/root/alias/show

TR
  TD/TD
  TDdtml-name;/TD
  TDdtml-domain;/TD
/TR


Now, assuming I'm looking at machineid 535252 (mail.random.com). I get this:


|  192.168.3.3  |   mail   |  hosting.com  |
|   |   mail   |  hosting.com  |
|   |   mail   |  hosting.com  |
|   |   mail   |  hosting.com  |
|   |   mail   |  hosting.com  |


That is, the variable 'name' and 'domain' aren't set correctly. But, if I
modify /root/host/show as follows:

TR
  TDdtml-ip;/TD
  TDdtml-name;/TD
  TDdtml-domain;/TD
/TR

dtml-in get_host_aliases
  dtml-commentPOINT A/dtml-with
  TR
TD/TD
TDdtml-name;/TD
TDdtml-name;/TD
  /TR
  dtml-with alias
dtml-commentPOINT B/dtml-with
dtml-var show
  /dtml-with
/dtml-in



I get:


|  192.168.3.3  |   mail   |  hosting.com  |
|   |   pop3   |  random.com  |
|   |   mail   |  hosting.com  |
|   |   imap   |  random.com  |
|   |   mail   |  hosting.com  |
|   |   smtp   |  random.com  |
|   |   mail   |  hosting.com  |
|   |  webmail |  random.com  |
|   |   mail   |  hosting.com  |


It would appear that the dtml-with alias tag wipes out the 'name' and
'domain' variables back to the values they had outside the dtml-in
get_host_aliases tag, so calling /root/alias/show gives wrong data. Very
odd. *BUT*, if I use 'aliasname' and 'aliasdomain' as the variable names,
everything is OK.

WTF?

While I'm at it, is dtml-with foldernamedtml-var dtmlmethod/dtml-with
really the best way to call a DTML method of a folder?

Regard,
Phil


___
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 )