[ZCM] [ZC] 1027/ 8 Wontfix "PyScript: unable to return an item from a tuple"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Wed Jan 19 00:32:48 EST 2005


Issue #1027 Update (Wontfix) "PyScript: unable to return an item from a tuple"
 Status Wontfix, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/1027

==============================================================
= Wontfix - Entry #8 by ajung on Jan 19, 2005 12:32 am

 Status: Pending => Wontfix

It is unlikely that someone will fix this in the future. This feature will remain as-it-is (or are you going to fix it).
I think I can reject my own issues if necessary.

-aj
________________________________________
= Resubmit - Entry #7 by chrisw on Jan 18, 2005 3:25 pm

 Status: Rejected => Pending

Yes, but this is a feature request that it should be.
Maybe something to add to Products.PythonScript.standard.

Please stop rejecting this issue.
________________________________________
= Reject - Entry #6 by ajung on Nov 26, 2004 9:53 am

 Status: Pending => Rejected

'time' is officially not supported to be imported directly.
________________________________________
= Resubmit - Entry #5 by chrisw on Jun 25, 2004 6:11 am

 Status: Rejected => Pending

But it is a feature request, and quite a valid one...
________________________________________
= Reject - Entry #4 by ajung on Jun 25, 2004 5:53 am

 Status: Pending => Rejected

Not a bug
________________________________________
= Comment - Entry #3 by ajung on Aug 27, 2003 9:55 am

Ah ok...the doc string fooled me:

>> import time
>>> time.localtime.__doc__
"localtime([seconds]) -> (tm_year,tm_mon,tm_day,tm_hour,tm_min,tm_sec,tm_wday,tm_yday,tm_isdst)\n\nConvert seconds since the Epoch to a time tuple expressing local time.\nWhen 'seconds' is not passed in, convert the current time instead."

Also the representation looked like a tuple and I used it
as a tuple for years.


________________________________________
= Comment - Entry #2 by shane on Aug 27, 2003 9:46 am

Here is the reason:

>>> import time
>>> t = time.localtime(time.mktime((2003, 2, 2, 0, 0, 0, 0, 0, 0)))
>>> t
(2003, 2, 2, 0, 0, 0, 6, 33, 0)
>>> type(t)
<type 'time.struct_time'>

localtime() returns a struct_time rather than a tuple.  Zope should explicitly allow access to struct_time objects, I suppose.

________________________________________
= Request - Entry #1 by ajung on Aug 27, 2003 8:57 am


The PyScript

import time

return time.localtime(time.mktime((2003, 2, 2, 0, 0, 0, 0, 0, 0)))[6]

raises

Error Type: Unauthorized
Error Value: You are not allowed to access '6' in this context

The import of 'time' is allowed through allow_module().
This behaviour is very odd since time.localtime()
returns a tuple and it does not make sense to forbid
the access to the items of a tuple. 

A workaround is to use tuple(time.localtime(....))[6]
This creates a new tuple from the old one....very wierd.
==============================================================



More information about the Zope-Collector-Monitor mailing list