Re: [Zope-dev] ZPatterns sub-Specialist traversal

2001-04-09 Thread Michael R. Bernstein

With some help from the kind folks on #zope, this has been
solved.

"Michael R. Bernstein" wrote:
 
 Here is what I've done:
 
 ArchiveImages (Specialist)
  defaultRack
   traversal_method (Python Script)
   traversal (SkinScript)
  Renderings (sub-Specialist)
   defaultRack

This was wrong in a couple of ways, here is how it needs to
be layed out:

ArchiveImages (Specialist)
 traversal_method (Python Script)
 defaultRack
  traversal (SkinScript)
 Renderings (sub-Specialist)
  defaultRack

As you can see, the Python Method needed to be moved from
within the Rack up into the Specialist.

 traversal_method has 'REQUEST, name' as parameters, and the
 following body:
 
 return getattr(container.Renderings, name)

The body of the traversal_method needed to change in two
ways:

 if name in ['index_html', 'editInstanceForm',
'editInstance']:
 return getattr(context, name)
 else:
 return container.Renderings.getItem(name)

First, it needed to pass unmolested those methods of the
ArchiveImage that were needed. Second, Specialists
apparently don't support getattr(), so I needed to change
this to call getItem() instead.

 The 'traversal' SkinScript has the following body:
 
 WITH SELF COMPUTE __bobo_traverse__=traversal_method

The SkinScript works fine as-is.

HTH,

Michael Bernstein.

___
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] ZPatterns sub-Specialist traversal

2001-04-06 Thread Michael R. Bernstein

Ulrich Eck wrote:
 
  traversal_method has 'REQUEST, name' as parameters, and the
  following body:
 
  return getattr(container.Renderings, name)
 
  The 'traversal' SkinScript has the following body:
 
  WITH SELF COMPUTE __bobo_traverse__=traversal_method
 
 
 
 try:
 
 if len(traverse_subpath)  0:
 name = traverse_subpath[0]
 
 return getattr(container.Renderings,name)

Nope, same error.

What should I try next?

Thanks,

Michael Bernstein

___
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] ZPatterns sub-Specialist traversal

2001-04-06 Thread Michael R. Bernstein

Hello all,

I've been trying to follow the instructions for getting
subSpecialist instances to appear as directly traversable
from Specialist instances, but have not yet had any success.

Here is what I've done:

ArchiveImages (Specialist)
 defaultRack
  traversal_method (Python Script)
  traversal (SkinScript)
 Renderings (sub-Specialist)
  defaultRack

traversal_method has 'REQUEST, name' as parameters, and the
following body:

return getattr(container.Renderings, name)

The 'traversal' SkinScript has the following body:

WITH SELF COMPUTE __bobo_traverse__=traversal_method


Nevertheless, when I try to traverse an instance in the
Specialist to an instance into the subspecialist, I get an
error:

http://localhost:8080/ArchiveImages/001/002

Resource not Found

Traceback (innermost last):
  File
/usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line
223, in publish_module
  File
/usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line
187, in publish
  File /usr/local/zope/2-3-0/lib/python/Zope/__init__.py,
line 221, in zpublisher_exception_hook
(Object: 001)
  File
/usr/local/zope/2-3-1/lib/python/ZPublisher/Publish.py, line
162, in publish
  File
/usr/local/zope/2-3-1/lib/python/ZPublisher/BaseRequest.py,
line 372, in traverse
  File
/usr/local/zope/2-3-1/lib/python/ZPublisher/HTTPResponse.py,
line 547, in notFoundError
NotFound: (see above)

The 002 sub-Specialist instance exists and is accessable
normally
(http://localhost:8080/ArchiveImages/Renderings/002), so I
must be doing something wrong in the PythonScript or the
SkinScript, but I don't know what.

Any help would be appreciated,

Michael Bernstein.

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