Neil Schemenauer wrote:
> On Sat, Jan 04, 2003 at 12:04:27PM -0500, Tom Jenkins wrote:
>
>>The problem is for the url: /department/1/agency/5 the traversal stops
>>at 'agency' with a TraversalError exception raised. In Publisher's
>>get_component method the container is checked for the existence of
>>_q_exports. The bound method 'agency' does not have this and so it
>>fails.
>>
>>What I did instead was give DepartmentUI a _q_getname method. i check
>>for the explicit string 'agency'
>
>
> I think a better solution would be to add "_q_exports = ['agency']" to
> DepartmentUI and "_q_exports = ['showSomeInfo']" to AgencyUI. Adding a
> _q_getname seems like overkill.
>
Hi Neil,
well my original (non-working) version had the following
class DepartmentUI:
_q_exports = ['view', 'showAgencies', 'agency']
...
def view(self, request):
''' show some stuff here '''
return someFormatStuff(self)
def agency(self, request):
''' return an AgencyUI instance '''
return AgencyUI(self.department)
def showAgencies(self, request
return someOtherFormatStuff(self)
class AgencyUI:
_q_exports = ['view']
...
def view(self, request):
''' show some agency stuff'''
return someAgencyStuff(self)
...
now when i tried hitting
/department/2/agency/4/view
I would get an exception in Publisher on
# First security check: if the container doesn't even have an
# _q_exports list, fail now: all Quixote-traversable namespaces
# (modules, packages, instances) must have an export list!
if not hasattr(container, '_q_exports'):
raise errors.TraversalError(
private_msg="%r has no _q_exports list" %
container)
at the time of failure,
container = and
component = 4
(sorry i don't have the log of the actual output, but i do know it was
identified as DepartmentUI's bound method agency)
i doesn't look like during the transversal any methods are called
(except for the _q_getname method) so the AgencyUI instance never gets
returned and placed in the namespace_stack.
Gotta run to dinner. thanks for the time
Tom