bizarre slicing behaviour in Zope
try this in a script in zope 2.7b3 (maybe others, too) if you want to go crazy: dd = ('dd', 'diocese', 'Parish.2003-12-16.8636751973', 'bob', 'Workspace.2003-12-17.8140751750','gerry.2003-12-17.8140751750') return dd[4:] you should get the last two items from the tuple, but I get the last item returned as a string if i loop through the slice, it's ok. it seems to be a publishing problem. Gerry
On Wed, 17 Dec 2003 15:30:50 -0500 Gerry Kirk <gerry@faithonline.com> wrote:
try this in a script in zope 2.7b3 (maybe others, too) if you want to go crazy:
dd = ('dd', 'diocese', 'Parish.2003-12-16.8636751973', 'bob', 'Workspace.2003-12-17.8140751750','gerry.2003-12-17.8140751750')
return dd[4:]
you should get the last two items from the tuple, but I get the last item returned as a string
if i loop through the slice, it's ok. it seems to be a publishing problem.
Gerry
Look at the title of the browser window to see the other item of the tuple. Welcome to 2-tuple publication ;^) -Casey
On Wednesday 17 December 2003 02:44 pm, Casey Duncan wrote:
On Wed, 17 Dec 2003 15:30:50 -0500 Gerry Kirk <gerry@faithonline.com> wrote:
try this in a script in zope 2.7b3 (maybe others, too) if you want to go crazy:
dd = ('dd', 'diocese', 'Parish.2003-12-16.8636751973', 'bob', 'Workspace.2003-12-17.8140751750','gerry.2003-12-17.8140751750')
return dd[4:]
you should get the last two items from the tuple, but I get the last item returned as a string
if i loop through the slice, it's ok. it seems to be a publishing problem.
Look at the title of the browser window to see the other item of the tuple. Welcome to 2-tuple publication ;^)
Perhaps more constructively, I think you can solve this by either adding a dummy element to the tuple: return dd[4:] + (None,) or making it a list instead of a tuple: return list(dd[4:]) Cheers, Terry -- Terry Hancock ( hancock at anansispaceworks.com ) Anansi Spaceworks http://www.anansispaceworks.com
On Wed, Dec 17, 2003 at 03:30:50PM -0500, Gerry Kirk wrote:
try this in a script in zope 2.7b3 (maybe others, too) if you want to go crazy:
dd = ('dd', 'diocese', 'Parish.2003-12-16.8636751973', 'bob', 'Workspace.2003-12-17.8140751750','gerry.2003-12-17.8140751750')
return dd[4:]
you should get the last two items from the tuple, but I get the last item returned as a string
I tried 2.6 as well. Check the source of the returned page. I think you will find this: <html> <head> <title>Workspace.2003-12-17.8140751750</title> </head> <body> gerry.2003-12-17.8140751750 </body> </html> It seems to happen with any tuple... I tried this script: return ('foo', 'bar') ... and got this: <html> <head> <title>foo</title> </head> <body> bar </body> </html> Returning a list instead of a tuple is OK - it shows a string representation of the list. I would guess that you are right, this is odd publisher behavior. File a collector issue. -- Paul Winkler http://www.slinkp.com
participants (4)
-
Casey Duncan -
Gerry Kirk -
Paul Winkler -
Terry Hancock