Re: [Zope-dev] bizarre slicing behaviour in Zope

2003-12-17 Thread Terry Hancock
On Wednesday 17 December 2003 02:44 pm, Casey Duncan wrote:
> On Wed, 17 Dec 2003 15:30:50 -0500
> Gerry Kirk <[EMAIL PROTECTED]> 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

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


Re: [Zope-dev] bizarre slicing behaviour in Zope

2003-12-17 Thread Paul Winkler
On Wed, Dec 17, 2003 at 09:51:37PM -, gabrielg_laburando wrote:
> But this is a well documented behavior of ZPublisher. And I think it?s 
> used internally by Zope.
> See http://zope.org/Documentation/Books/ZDG/current/ObjectPublishing.
> stx#5-20
> The tuple magic is in HTTPResponse.setBody().

Oops, so it is.
Never mind!


-- 

Paul Winkler
http://www.slinkp.com
Look! Up in the sky! It's THE WEASLE-CAKE !
(random hero from isometric.spaceninja.com)

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


Re: [Zope-dev] bizarre slicing behaviour in Zope

2003-12-17 Thread Paul Winkler
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:



Workspace.2003-12-17.8140751750


gerry.2003-12-17.8140751750



It seems to happen with any tuple... I tried this script:

return ('foo', 'bar')

... and got this:



foo


bar



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


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


Re: [Zope-dev] bizarre slicing behaviour in Zope

2003-12-17 Thread Casey Duncan
On Wed, 17 Dec 2003 15:30:50 -0500
Gerry Kirk <[EMAIL PROTECTED]> 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

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


[Zope-dev] bizarre slicing behaviour in Zope

2003-12-17 Thread Gerry Kirk
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

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


Re: [Zope-dev] It's me again :(

2003-12-17 Thread Sidnei da Silva
On Wed, Dec 17, 2003 at 12:34:38AM -0500, Jeremy Hylton wrote:
| Does the last report mean your problem is fixed?  Or do you still need
| help tracking something down?

It's fixed, though I would like to discuss it a bit more. It *seems*
to me that the Zope HEAD is being more picky about storing acquisition
wrappers, which on one side is a good thing. OTOH, it was relatively
hard to track it down, meaning several visits to gdb. The fact that
the parameter is called 'Wrapper' at 'Wrappers_are_not_picklable'
makes it even harder, because is practically impossible to cast the
object to a Wrapper.

So, I would like to propose two changes:

1. Rename the 'Wrapper' parameter to 'wrapper' in that function
2. Include 'Wrapper->container' and 'Wrapper->obj' in the traceback,
   in order to make it easier for people to find out where is the
   problem when it happens. (note that the 'Wrapper' parameter is not
   even being used currently)

Thoughts?

-- 
Sidnei da Silva <[EMAIL PROTECTED]>
http://awkly.org - dreamcatching :: making your dreams come true
http://plone.org/about/team#dreamcatcher

"Don't fear the pen. When in doubt, draw a pretty picture." 
   --Baker's Third Law of Design.

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