Re: [Zope] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Chris Withers

"Mayers, Philip J" wrote:
 
  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)
 
 That was how I had the code originally. Didn't help. 

What happens when you try that? Errors? Unexpected values?

 I've already read the
 Zope 'book' 

Yes, it is frustrating how long it's taking for that to get printed, I
wonder what's holding it up?

 (if I were using 2.3 (which I can't, because LoginManager
 doesn't work OOTB),

I remember seeing the posts relating to that, did you ever find out why
it wasn't working? 

 I'd be using Python methods to do most of this instead.
 I'm not, I'm using 2.2.5)

Wise choice, but you mean python scripts in 2.3 ;-)
You can actually download Python _Methods_ right now and use them in
2.2.5:
http://www.zope.org/Members/4am/PythonMethod

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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Mayers, Philip J

Sorry - I'm being unclear: the result is exactly the same either way i.e.
the variables "name" and "domain" seem to be reset to the values from
outside the dtml-in block when entering the dtml-with block.

I'm wondering if it's a bug in the postgres DA, since I can't reproduce it
with a quick gadfly test. I'm just going to try it out now.

I'm using Zope 2.2.5, PoPy 2.0.1 from SourceForce, and ZPoPyDA-1.1-pre2 - I
couldn't get any (potentially more stable) combination of PoPy or ZPoPyDA to
work.

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:30
To: Mayers, Philip J
Cc: '[EMAIL PROTECTED]'
Subject: Re: [Zope] SQL Method, dtml-with and namespace weirdness


"Mayers, Philip J" wrote:
 
  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)
 
 That was how I had the code originally. Didn't help. 

What happens when you try that? Errors? Unexpected values?

 I've already read the
 Zope 'book' 

Yes, it is frustrating how long it's taking for that to get printed, I
wonder what's holding it up?

 (if I were using 2.3 (which I can't, because LoginManager
 doesn't work OOTB),

I remember seeing the posts relating to that, did you ever find out why
it wasn't working? 

 I'd be using Python methods to do most of this instead.
 I'm not, I'm using 2.2.5)

Wise choice, but you mean python scripts in 2.3 ;-)
You can actually download Python _Methods_ right now and use them in
2.2.5:
http://www.zope.org/Members/4am/PythonMethod

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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Chris Withers

"Mayers, Philip J" wrote:
 
 Sorry - I'm being unclear: the result is exactly the same either way i.e.
 the variables "name" and "domain" seem to be reset to the values from
 outside the dtml-in block when entering the dtml-with block.

   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

Now I could grep the above to be sure, but I'm prety certain there
aren't any dtml-with's in there...
Perhaps the above might be worth trying out? ;-)

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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Mayers, Philip J

Ok, using Postgresql 7.0.2-2, PoPo 2.0.1, ZPoPyDA 1.1-pre2, Zope 2.2.5,
here's a reproducible scenario:

Create the following tables in your database:

create table bugtest1 (
name text,
domain text,
);

create table bugtest2 (
name text,
domain text,
refer text,
foreign key(refer) references bugtest1(name)
);

insert into bugtest1 values ('a','aa');
insert into bugtest1 values ('b','bb');
insert into bugtest1 values ('c','cc');
insert into bugtest2 values ('w','ww','a');
insert into bugtest2 values ('x','xx','a');
insert into bugtest2 values ('y','yy','a');
insert into bugtest2 values ('z','zz','a');
insert into bugtest2 values ('g','gg','b');
insert into bugtest2 values ('h','hh','b');
insert into bugtest2 values ('i','hh','b');

Create the following folder structure:

/root
  dbconn (ZPoPyDA connection to whatever database you just put the tables
in)
  index_html
  get_host (Z SQL method)
  get_alias (Z SQL method)
  /alias
show
  /host
show

/root/get_host

select * from bugtest1

/root/get_alias

select * from bugtest2
dtml-sqlgroup where
  dtml-sqltest name column=refer type=string
/dtml-sqlgroup

/root/alias/show

TRTD/TDTDdtml-name;/TDTDdtml-domain;/TD/TR

/root/host/host

TRTDdtml-name;/TDTDdtml-domain;/TD/TR

/root/index_html:

  1: dtml-var standard_html_header
  2: TABLE
  3: dtml-in get_host
  4:   dtml-with hostdtml-var show/dtml-with
  5:   dtml-in "get_alias(name=name)"
  6: dtml-let name2=name
  7:   domain2=domain
  8: dtml-with alias
  9:   TRTDPOINT
A/TDTDdtml-name;/TDTDdtml-domain;/TD/TR
 10:   TRTDPOINT
B/TDTDdtml-name2;/TDTDdtml-domain2;/TD/TR
 11:   dtml-var show
 12: /dtml-with
 13: TRTDPOINT C/TDTDdtml-name;/TDTDdtml-domain;/TD/TR
 14: TRTDPOINT
D/TDTDdtml-name2;/TDTDdtml-domain2;/TD/TR
 15: /dtml-let
 16:   /dtml-in
 17: /dtml-in
 18: /TABLE
 19: dtml-var standard_html_footer


The output of all that is (a bit hard to read):

a aa 

POINT A a aa 
POINT B w ww 
 a aa 
POINT C w ww 
POINT D w ww 

POINT A a aa 
POINT B x xx 
 a aa 
POINT C x xx 
POINT D x xx 

POINT A a aa 
POINT B y yy 
 a aa 
POINT C y yy 
POINT D y yy 

POINT A a aa 
POINT B z zz 
 a aa 
POINT C z zz 
POINT D z zz 

snipped for clarity


So: at point A, the "name" and "domain" variables have been overwritten with
the "name" and "domain" variables as they were on line 6/7, *BUT* name2 and
domain2 haven't been overwritten (point B). BUT, outside the dtml-with tab
(point C) "name" and "domain" are at their correct values.

So - given that the dtml-with tag "must" work, I'm clearly not understanding
*how* it works.

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] SQL Method, dtml-with and namespace weirdness

2001-01-10 Thread Dieter Maurer

Mayers, Philip J writes:
  I'm wondering if it's a bug in the postgres DA, since I can't reproduce it
  with a quick gadfly test. I'm just going to try it out now.
That would be very astonishing, as a database adapter
does not have anything to do with namespaces.


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 )