Re: [Zope-dev] Bug in OFS/Traversable.py

2000-09-12 Thread Chris Withers



David Alexander Ranvig wrote:
 The unrestrictedTraverse method creates a fake REQUEST "object"
 (really a dictionary) and sends this to a __bobo_traverse__. If this
 __bobo_traverse__ uses the object properties of the REQUEST object, or
 needs the real REQUEST object it will fail.

I chuck that in the collector... it'll probably just get lost in the
lists otherwise...

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Andy McKay

Hmm well ive found i have TemplateDict object and of course my self.
Perhaps there is a pythonism I have to research here.

- Original Message -
From: "Andy McKay" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, September 11, 2000 4:03 PM
Subject: [Zope-dev] Custom dtml tag


 Im playing with a custom dtml-tag along the lines of dtm-query foo
 constructs a url to a catalog query. It works fine, I would just like to
 extend it a bit and for this I would need to get to the calling object.

 For example, there will be a different query depending upon the object the
 dtml-query tag is contained in. Does this make sense, does anyone know the
 answer?

 Thanks in advance.

 --
   Andy McKay, Developer.
   ActiveState.




 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Brett Carter

 "Andy" == Andy McKay [EMAIL PROTECTED] writes:
Andy - see the thread I started called 'Acqusition in a DTML tag'
I have a similar question.
-Brett

Andy Hmm well ive found i have TemplateDict object and of
Andy course my self.  Perhaps there is a pythonism I have to
Andy research here.

Andy - Original Message - From: "Andy McKay"
Andy [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent:
Andy Monday, September 11, 2000 4:03 PM Subject: [Zope-dev]
Andy Custom dtml tag


 Im playing with a custom dtml-tag along the lines of dtm-query
 foo constructs a url to a catalog query. It works fine, I
 would just like to extend it a bit and for this I would need to
 get to the calling object.
 
 For example, there will be a different query depending upon the
 object the dtml-query tag is contained in. Does this make
 sense, does anyone know the answer?
 
 Thanks in advance.
 
 -- Andy McKay, Developer.  ActiveState.
 
 
 
 
 ___ Zope-Dev
 maillist - [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev ** No cross
 posts or HTML encoding!  ** (Related lists -
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )
 


Andy ___ Zope-Dev
Andy maillist - [EMAIL PROTECTED]
Andy http://lists.zope.org/mailman/listinfo/zope-dev ** No cross
Andy posts or HTML encoding!  ** (Related lists -
Andy http://lists.zope.org/mailman/listinfo/zope-announce
Andy http://lists.zope.org/mailman/listinfo/zope )


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Acquisition in a DTML Tag

2000-09-12 Thread Brett Carter

 "Shane" == Shane Hathaway [EMAIL PROTECTED] writes:

Shane Brett Carter wrote:
   "Brett" == Brett Carter [EMAIL PROTECTED] writes:
 
Brett I've defined my own dtml tag (i.e. dtml-foo/dtml-foo)
Brett and I am trying to look up an object depending on the
Brett arguments passed to my tag.  The python class that defines
Brett the tag inherits from Acquisition.Implicit, but 'self'
Brett doesn't contain any of the Acquisition hiarchy.  It seems
Brett like this must be possible, since the dtml-var tag must
Brett have to do an object lookup somewhere for objects passed to
Brett it to render.  Can anybody shed some light on this?  Is it
Brett doable?  TIA -Brett
  Ok, So after some *major* hacking, i've realized that the 'md'
 passed into the render() method of my dtml tag contains the
 namespace, and is of type 'TemplateDict' which appears to
 contain a stack of 'MultiMapping's.  Weird.  Well, anyways, I
 just used the 'has_key' and 'getitem' methods to lookup my
 item.  The question now is how do I create a new object in the
 current namespace?  It looks like the TemplateDict is a
 read-only type of data structure.  Anybody?  TIA -Brett

Shane Look at render() of DT_With.py.  It does an
Shane md._push(mapping containing new names) then, in a
Shane try/finally clause, calls DT_Util.render_blocks().  In the
Shane finally clause, it does md._pop().

Shane Shane

I'm still confused.  Ok, so render gets passed 'md', which is a
TemplateDict, which contains a MultiMapping, which looks like a stack
of dictionaries, which I am guessing is some sort of namespace stack.
So looking at the DT_with.py, it looks like, to create an object in
the current namespace, I have to wrap it in an InstanceDict, and push
it onto the 'md' using 'md._push'.  Does this also cause the new
object to be saved in the ZODB?  Or do I have to manually add it there
too?  Also, what does render_blocks do?  Why does DT_with.py's
render() return it?  Do I have to run render_blocks() to insert my new
object into the namespace?  TIA
-Brett

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Acquisition in a DTML Tag

2000-09-12 Thread Martijn Pieters

On Tue, Sep 12, 2000 at 10:57:57AM -0700, Brett Carter wrote:
  "Shane" == Shane Hathaway [EMAIL PROTECTED] writes:
 
 Shane Brett Carter wrote:
"Brett" == Brett Carter [EMAIL PROTECTED] writes:
  
 Brett I've defined my own dtml tag (i.e. dtml-foo/dtml-foo)
 Brett and I am trying to look up an object depending on the
 Brett arguments passed to my tag.  The python class that defines
 Brett the tag inherits from Acquisition.Implicit, but 'self'
 Brett doesn't contain any of the Acquisition hiarchy.  It seems
 Brett like this must be possible, since the dtml-var tag must
 Brett have to do an object lookup somewhere for objects passed to
 Brett it to render.  Can anybody shed some light on this?  Is it
 Brett doable?  TIA -Brett
   Ok, So after some *major* hacking, i've realized that the 'md'
  passed into the render() method of my dtml tag contains the
  namespace, and is of type 'TemplateDict' which appears to
  contain a stack of 'MultiMapping's.  Weird.  Well, anyways, I
  just used the 'has_key' and 'getitem' methods to lookup my
  item.  The question now is how do I create a new object in the
  current namespace?  It looks like the TemplateDict is a
  read-only type of data structure.  Anybody?  TIA -Brett
 
 Shane Look at render() of DT_With.py.  It does an
 Shane md._push(mapping containing new names) then, in a
 Shane try/finally clause, calls DT_Util.render_blocks().  In the
 Shane finally clause, it does md._pop().
 
 Shane Shane
 
 I'm still confused.  Ok, so render gets passed 'md', which is a
 TemplateDict, which contains a MultiMapping, which looks like a stack
 of dictionaries, which I am guessing is some sort of namespace stack.
 So looking at the DT_with.py, it looks like, to create an object in
 the current namespace, I have to wrap it in an InstanceDict, and push
 it onto the 'md' using 'md._push'.  Does this also cause the new
 object to be saved in the ZODB?  Or do I have to manually add it there
 too?  Also, what does render_blocks do?  Why does DT_with.py's
 render() return it?  Do I have to run render_blocks() to insert my new
 object into the namespace?  TIA

There are two seperate things here: The namespace, and the ZODB. I am
assuming you want to add an object to the ZODB.

The namespace reflects, amongst others, the attributes on the current
object, and if it inherits from Acquisition.Implicit, the rest of the
ZODB contents. You can add additional lookup objects to that stack, and
anything using the namespace can then access those extra attributes.

(render_blocks() is just a call to render all DTML contained within the
with tag, and the with tag then removes all additions to the namespace
again with md._pop() at the end.)

If you want to manipulate the ZODB, you can just take a reference to the
object you want to manipulate (add subobjects to), and add these directly
as attributes. Or better still, if the object inherits from ObjectManager
(like a Folder), use the ObjectManager API to add objects. If the
subobjects in question are standard Zope objects, use the Class Factory
API that the 'Add' list in the management interface uses.

Important to remember is here that the namespace only gives you access to
the objetcs. Adding to the namespace only gives you a larger namespace,
which only has meaning in the context of the current DTML code tree. If
you want to manipulate the ZODB contained objects, manipulate them
directly.

-- 
Martijn Pieters
| Software Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Martijn Pieters

On Tue, Sep 12, 2000 at 09:26:49AM -0700, Andy McKay wrote:
 Hmm well ive found i have TemplateDict object and of course my self.
 Perhaps there is a pythonism I have to research here.
 
 - Original Message -
 From: "Andy McKay" [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Monday, September 11, 2000 4:03 PM
 Subject: [Zope-dev] Custom dtml tag
 
 
  Im playing with a custom dtml-tag along the lines of dtm-query foo
  constructs a url to a catalog query. It works fine, I would just like to
  extend it a bit and for this I would need to get to the calling object.
 
  For example, there will be a different query depending upon the object the
  dtml-query tag is contained in. Does this make sense, does anyone know the
  answer?
 
  Thanks in advance.
 
  --
Andy McKay, Developer.
ActiveState.

The namespace just reflects the attributes of the current object, plus
whatever other tags push onto that stack (such as the in tag, which pushes
the current element of the list it iterates over on top).

If you retrieve the 'this' method from the stack, and call it, it'll
return the topmost object on the stack. It is implemented in
SimpleItem.Item:

def this(self):
# Handy way to talk to ourselves in document templates.
return self

-- 
Martijn Pieters
| Software Engineermailto:[EMAIL PROTECTED]
| Digital Creations  http://www.digicool.com/
| Creators of Zope   http://www.zope.org/
| ZopeStudio: http://www.zope.org/Products/ZopeStudio
-

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Andy McKay

I can see how this would be useful in a situation where I dont have an
instance of self. But in this case I do, so Im not sure how this helps.

I guess you're saying once I have self I can find out what called the
function. More fiddling I guess.

- Original Message -
From: "Martijn Pieters" [EMAIL PROTECTED]
To: "Andy McKay" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 12, 2000 11:29 AM
Subject: Re: [Zope-dev] Custom dtml tag


 On Tue, Sep 12, 2000 at 09:26:49AM -0700, Andy McKay wrote:
  Hmm well ive found i have TemplateDict object and of course my self.
  Perhaps there is a pythonism I have to research here.
 
  - Original Message -
  From: "Andy McKay" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, September 11, 2000 4:03 PM
  Subject: [Zope-dev] Custom dtml tag
 
 
   Im playing with a custom dtml-tag along the lines of dtm-query foo
   constructs a url to a catalog query. It works fine, I would just like
to
   extend it a bit and for this I would need to get to the calling
object.
  
   For example, there will be a different query depending upon the object
the
   dtml-query tag is contained in. Does this make sense, does anyone know
the
   answer?
  
   Thanks in advance.
  
   --
 Andy McKay, Developer.
 ActiveState.

 The namespace just reflects the attributes of the current object, plus
 whatever other tags push onto that stack (such as the in tag, which pushes
 the current element of the list it iterates over on top).

 If you retrieve the 'this' method from the stack, and call it, it'll
 return the topmost object on the stack. It is implemented in
 SimpleItem.Item:

 def this(self):
 # Handy way to talk to ourselves in document templates.
 return self

 --
 Martijn Pieters
 | Software Engineermailto:[EMAIL PROTECTED]
 | Digital Creations  http://www.digicool.com/
 | Creators of Zope   http://www.zope.org/
 | ZopeStudio: http://www.zope.org/Products/ZopeStudio
 -



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Brett Carter

Andy: here's what I've gleaned - in a dtml tag's render() method, you
get passed in self and a template dict, in my example let's call it
'md'.  md is essentially a stack/dictionaryish object of the *current*
namespace - and one of the handy things that's always around in the
namespace is the 'this' function, which returns the object on the top
of the stack.

Just lookup 'this', run it, and there you have a reference to the
calling object!  Ex:

def render(self, md)
  this = md.getitem('this')
  callingObj = this()
  return "Calling object was %s" % (callingObj.id())

Note I haven't tested this code.  Good luck!
-Brett

 "Andy" == Andy McKay [EMAIL PROTECTED] writes:

Andy I can see how this would be useful in a situation where I dont have an
Andy instance of self. But in this case I do, so Im not sure how this helps.

Andy I guess you're saying once I have self I can find out what called the
Andy function. More fiddling I guess.

Andy - Original Message -
Andy From: "Martijn Pieters" [EMAIL PROTECTED]
Andy To: "Andy McKay" [EMAIL PROTECTED]
Andy Cc: [EMAIL PROTECTED]
Andy Sent: Tuesday, September 12, 2000 11:29 AM
Andy Subject: Re: [Zope-dev] Custom dtml tag


 On Tue, Sep 12, 2000 at 09:26:49AM -0700, Andy McKay wrote:
  Hmm well ive found i have TemplateDict object and of course my self.
  Perhaps there is a pythonism I have to research here.
 
  - Original Message -
  From: "Andy McKay" [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Sent: Monday, September 11, 2000 4:03 PM
  Subject: [Zope-dev] Custom dtml tag
 
 
   Im playing with a custom dtml-tag along the lines of dtm-query foo
   constructs a url to a catalog query. It works fine, I would just like
Andy to
   extend it a bit and for this I would need to get to the calling
Andy object.
  
   For example, there will be a different query depending upon the object
Andy the
   dtml-query tag is contained in. Does this make sense, does anyone know
Andy the
   answer?
  
   Thanks in advance.
  
   --
 Andy McKay, Developer.
 ActiveState.
 
 The namespace just reflects the attributes of the current object, plus
 whatever other tags push onto that stack (such as the in tag, which pushes
 the current element of the list it iterates over on top).
 
 If you retrieve the 'this' method from the stack, and call it, it'll
 return the topmost object on the stack. It is implemented in
 SimpleItem.Item:
 
 def this(self):
 # Handy way to talk to ourselves in document templates.
 return self
 
 --
 Martijn Pieters
 | Software Engineermailto:[EMAIL PROTECTED]
 | Digital Creations  http://www.digicool.com/
 | Creators of Zope   http://www.zope.org/
 | ZopeStudio: http://www.zope.org/Products/ZopeStudio
 -
 


Andy ___
Andy Zope-Dev maillist  -  [EMAIL PROTECTED]
Andy http://lists.zope.org/mailman/listinfo/zope-dev
Andy **  No cross posts or HTML encoding!  **
Andy (Related lists - 
Andy http://lists.zope.org/mailman/listinfo/zope-announce
Andy http://lists.zope.org/mailman/listinfo/zope )


___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Custom dtml tag

2000-09-12 Thread Andy McKay

Really? Ive looked up this and get nothing (an attribute error actually) and
its not in globals. If that would work that would be great - but a it
certainly doesnt seem to on a standard DTMLDocument / Method.

- Original Message -
From: "Brett Carter" [EMAIL PROTECTED]
To: "Andy McKay" [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tuesday, September 12, 2000 4:17 PM
Subject: Re: [Zope-dev] Custom dtml tag


 Andy: here's what I've gleaned - in a dtml tag's render() method, you
 get passed in self and a template dict, in my example let's call it
 'md'.  md is essentially a stack/dictionaryish object of the *current*
 namespace - and one of the handy things that's always around in the
 namespace is the 'this' function, which returns the object on the top
 of the stack.

 Just lookup 'this', run it, and there you have a reference to the
 calling object!  Ex:

 def render(self, md)
   this = md.getitem('this')
   callingObj = this()
   return "Calling object was %s" % (callingObj.id())

 Note I haven't tested this code.  Good luck!
 -Brett

  "Andy" == Andy McKay [EMAIL PROTECTED] writes:

 Andy I can see how this would be useful in a situation where I dont
have an
 Andy instance of self. But in this case I do, so Im not sure how this
helps.

 Andy I guess you're saying once I have self I can find out what
called the
 Andy function. More fiddling I guess.

 Andy - Original Message -
 Andy From: "Martijn Pieters" [EMAIL PROTECTED]
 Andy To: "Andy McKay" [EMAIL PROTECTED]
 Andy Cc: [EMAIL PROTECTED]
 Andy Sent: Tuesday, September 12, 2000 11:29 AM
 Andy Subject: Re: [Zope-dev] Custom dtml tag


  On Tue, Sep 12, 2000 at 09:26:49AM -0700, Andy McKay wrote:
   Hmm well ive found i have TemplateDict object and of course my
self.
   Perhaps there is a pythonism I have to research here.
  
   - Original Message -
   From: "Andy McKay" [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Sent: Monday, September 11, 2000 4:03 PM
   Subject: [Zope-dev] Custom dtml tag
  
  
Im playing with a custom dtml-tag along the lines of dtm-query
foo
constructs a url to a catalog query. It works fine, I would
just like
 Andy to
extend it a bit and for this I would need to get to the calling
 Andy object.
   
For example, there will be a different query depending upon the
object
 Andy the
dtml-query tag is contained in. Does this make sense, does
anyone know
 Andy the
answer?
   
Thanks in advance.
   
--
  Andy McKay, Developer.
  ActiveState.
 
  The namespace just reflects the attributes of the current object,
plus
  whatever other tags push onto that stack (such as the in tag, which
pushes
  the current element of the list it iterates over on top).
 
  If you retrieve the 'this' method from the stack, and call it,
it'll
  return the topmost object on the stack. It is implemented in
  SimpleItem.Item:
 
  def this(self):
  # Handy way to talk to ourselves in document templates.
  return self
 
  --
  Martijn Pieters
  | Software Engineermailto:[EMAIL PROTECTED]
  | Digital Creations  http://www.digicool.com/
  | Creators of Zope   http://www.zope.org/
  | ZopeStudio: http://www.zope.org/Products/ZopeStudio
  -
 


 Andy ___
 Andy Zope-Dev maillist  -  [EMAIL PROTECTED]
 Andy http://lists.zope.org/mailman/listinfo/zope-dev
 Andy **  No cross posts or HTML encoding!  **
 Andy (Related lists -
 Andy http://lists.zope.org/mailman/listinfo/zope-announce
 Andy http://lists.zope.org/mailman/listinfo/zope )


 ___
 Zope-Dev maillist  -  [EMAIL PROTECTED]
 http://lists.zope.org/mailman/listinfo/zope-dev
 **  No cross posts or HTML encoding!  **
 (Related lists -
  http://lists.zope.org/mailman/listinfo/zope-announce
  http://lists.zope.org/mailman/listinfo/zope )



___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




[Zope-dev] Zdebug not working with mailhost and PTK

2000-09-12 Thread James Johnson

I can't send mail using Zdebug and PTK latest versions.  Here is the 
error.
exceptions.TypeError
Error value: len() of unsized object

this part was highlighted as the problem
dtml-sendmail mailhost="MailHost"
Any suggestions?

Get your Free E-mail at http://tacoma.zzn.com

Get your own Web-Based E-mail Service at http://www.zzn.com

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )