Re: [Zope-dev] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-14 Thread Dieter Maurer

The Doctor What writes:
  Using context.this().id, self.this().id, m_self.this().id all get me
  the same things:
  Folder, Zope, and my method.  None give me the DTML Document
  foo_html.
If it is indeed a DTML Document, then "this()" should reference
this document. If it is a DTML Method, then "this()" will
reference the methods 'client', usually the methods parent.

  
  Did you mean to do a this().id?  That doesn't work at all, it gives
  me a Name Error.
No.
I am not yet familiar with PythonMethods and what binding
they define automatically. Obviously, you have
"context", "m_self" and "self".
My older PythonMethods installed seem to support only "self",
but I am not sure.

I would expect, that "context.this()" has the highest chance
of success, maybe "self.this()".

Note, that "foo_html" must be a DTML Document not a DTML Method!


  There *must* be a way to do this.
There is none for DTML Methods (other than modifying the code).


Dieter

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-14 Thread The Doctor What

I got a reply from someone working on it.  It seems the answer is
that it doesn't exist yet, pending a change in ZOPE itself.

So I have to pass it in:
dtml-var expr="breadcrumbs(this())"

Not a big deal, but annoying.

I'll make the source available as soon as I coble together a
view-source method. :)

Ciao!

-- 
"Well, given that the universe is infinite, and that God is infinite, and that God 
created the universe, (pause) would you like a piece of toast?"
--Talkie Toaster (Red Dwarf episode: Dimension Jump)

The Doctor What: A Holtje Production http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-14 Thread Dieter Maurer

Evan Simpson writes:
  From: The Doctor What [EMAIL PROTECTED]
   Using context.this().id, self.this().id, m_self.this().id
  all get me
   the same things:
   Folder, Zope, and my method.  None give me the DTML
  Document
   foo_html.
  
   This would seem to be an important thing.
  
  The only information about your caller that you can get is
  the contents of their namespace.  So, in the final release,
  you would be able to bind the caller's namespace to "_" and
  write _.this().id.  That requires a change to Zope, though,
  so it doesn't work yet.  You *could* work around this by
  explicitly passing the namespace (or this(), for that
  matter).
Why can't I get the acquisition context as with External Methods?
(if they are called directly via the Web, namespaces are not
yet build and the acquisition context obtained via a "self"
parameter is everything I have).


Dieter

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-13 Thread Evan Simpson

From: The Doctor What [EMAIL PROTECTED]
 Using context.this().id, self.this().id, m_self.this().id
all get me
 the same things:
 Folder, Zope, and my method.  None give me the DTML
Document
 foo_html.

 This would seem to be an important thing.

The only information about your caller that you can get is
the contents of their namespace.  So, in the final release,
you would be able to bind the caller's namespace to "_" and
write _.this().id.  That requires a change to Zope, though,
so it doesn't work yet.  You *could* work around this by
explicitly passing the namespace (or this(), for that
matter).

Cheers,

Evan @ digicool  4-am


___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-12 Thread Dieter Maurer

The Doctor What writes:
  ...
  Now here is my next problem.
  
  Using context.REQUEST.PARENTS doesn't give me the DTML Document that
  called me (so to speak).
  
  I have:
  /test/new/foo_html
  
  My PARENTS shows Zope, Test, and New, but doesn't show foo_html.
"PARENTS" contain the objects from root up to but excluding
the final object on the URL.

You may try to reference the final object by "this()".


Dieter

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-12 Thread The Doctor What

* Dieter Maurer ([EMAIL PROTECTED]) [001112 17:12]:
 The Doctor What writes:
   ...
   Now here is my next problem.
   
   Using context.REQUEST.PARENTS doesn't give me the DTML Document that
   called me (so to speak).
   
   I have:
   /test/new/foo_html
   
   My PARENTS shows Zope, Test, and New, but doesn't show foo_html.
 "PARENTS" contain the objects from root up to but excluding
 the final object on the URL.
 
 You may try to reference the final object by "this()".

Dieter, thanks for your help, but I'm unsure where to use it.

Using context.this().id, self.this().id, m_self.this().id all get me
the same things:
Folder, Zope, and my method.  None give me the DTML Document
foo_html.

This would seem to be an important thing.

To re-iterate in a different way, it's the same as trying to do:
dtml-var id in a DTML Method that is called by a DTML Document.
You expect the id of the DTML Document that called you, not the
Folder that the DTML Document resides in.

Did you mean to do a this().id?  That doesn't work at all, it gives
me a Name Error.

There *must* be a way to do this.

Ciao!

-- 
It has just been discovered that research causes cancer in rats.

The Doctor What: A Holtje Production http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-11 Thread The Doctor What

Okay, I figured that bit of braindeadness out (I just use a range
that goes backwards, no .reverse() so everything is left as is.

Now here is my next problem.

Using context.REQUEST.PARENTS doesn't give me the DTML Document that
called me (so to speak).

I have:
/test/new/foo_html

My PARENTS shows Zope, Test, and New, but doesn't show foo_html.

Is this because my PythonMethod is Internal vs. External?  I didn't
see any descriptions of what the differences are.

The DTML Method version of my code can see the id/title of the
foo_html via 'id', 'title' and 'title_or_id', but under python I
just get:
self.title_or_id() -- Zope, the folder that my method lives at
m_self.title_or_id() -- Breadcrumbs (my method)
context.title_or_id() -- New, the folder foo_html lives at

And I have no idea what _ is for

Any help is appreciated.

Ciao!

-- 
"Well Pumpkins, It looks like it comes down to that age old decision: Style or 
Substance.  Hmm."
--Vida and the "Girls" ( To Wong Foo, Thanks for everything, Julie 
Newmar )

The Doctor What: "What, Doctor What" http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC

___
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] PythonMethods: Can't Slice context.REQUEST.PARENTS

2000-11-10 Thread The Doctor What

I cannot slice context.REQUEST.PARENTS

The reason I want to do this is to travel up the URL tree for a
breadcrumb navigation do-hicky.

I want to slice it so I can make a copy because if I just do
...reverse() on it, I screw up everything afterwards.

It says I'm unauthorized (Guarded.py __careful_getattr__) so I
assume this is a feature.

I suppose I can just .reverse() it back again at the end, but it
seems.wrong some how.

Attached is my code at the moment...it sucks, I know.  This is
python project numero uno and zope project duo...

If anyone has a better example of how to hand text (I'm using buff
and returning it) back, I'd appreciate it.

I'm much to tired, so off I go to bed...


Ciao!


-- 
Man is the best computer we can put aboard a spacecraft ... and the only one that can 
be mass produced with unskilled labor.
 -- Wernher von Braun

The Doctor What: fill in the blank http://docwhat.gerf.org/
[EMAIL PROTECTED]   KF6VNC


paramsbuff='',lose=1/params
"""
This is a breadcrumb generator.  A breadcrumb trail is what you get at yahoo as
you traverse downward in their directory structure:
computers-video-blah-etc.

It shows you where you are in your site.

My breadcrumbs shall follow these rules:
1) The current DTML Document shall be the last item.  It will not be a link.
2) If the current DTML Document isn't index_html, then the parent crumb will be
   the index_html for the folder
3) All crumb names are overridable by setting the 'nickname' attribute.
4) The root folder will always be called "Home"

Ciao!

[EMAIL PROTECTED]
"""

## Start being crumb-y!
buff = "\n!-- start Breadcrumbs --\n[ "

# Get the list of parents and reverse it
list = context.REQUEST.PARENTS[:]
list.reverse()

# Iterate over all the parent objects, skipping the 'current'one
# (see below for dealing with that
for x in range(lose,len(list)-1):
obj = list[x]

url = obj.absolute_url()
name = obj.title_or_id()
buff = "%s\n - a href='%s'%s/a" % (buff, url, name)

# Deal with the 'current' object(s)
obj = list[-1]

buff = "%s\n'%s'" % (buff, obj)
buff = "%s\n'%s'" % (buff, context.id)

if obj != context:
buff = "%s\n  - '%s'" % (buff, obj.title_or_id())

buff = "%s\n  - '%s'" % (buff, obj.title_or_id())



buff = buff + "\n]\n!-- end Breadcrumbs --\n"

return buff