Re: [Zope] A basic question

2012-07-14 Thread Kristian Thy
On Sat, Jul 14, Giampiero Benvenuti wrote:
 I have a python script in my zope instance:
 
 dt=DateTime(2012,1)
 print dt
 print dt.strftime('%Y')
 print dt.year()
 
 return printed
 2012/01/01 00:00:00 GMT+2
 2011
 2012
 
 Why do I get two different values for the year (2011, 2012)?

It would seem strftime defaults to a timezone to the left of GMT+2.

\\kristian
-- 
... et nemo ex vobis interrogat me: Quo vadis?
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] [JOB][OT?] Position for a Python/Zope developer in Pula, Cagliari (CA), Italy

2010-07-13 Thread Kristian Thy
On Tue, Jul 13, Stephan Richter wrote:
 On Tuesday, July 13, 2010, Marco Bizzarri wrote:
   * IDE tools (emacs does not count as an IDE; vi* neither; Eclipse+PyDev is
  preferred);
 
 I am usually not commenting on things like that, but: What a turn off! This 
 is 
 one of the worst requirements I have ever seen. ;-)

Yeah, that one had me shaking my head as well ...

\\kristian
-- 
... et nemo ex vobis interrogat me: »Quo vadis?«
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] AccessRule eats part of my URL

2010-06-23 Thread Kristian Thy
Dear List,

I am trying to add an AccessRule to a folder so our friendly Monster
redirects people to the same object in another folder in the Zope root,
i.e. if people visit
  https://myurl.invalid/foo/bar/baz

I would like them redirected to
  https://myurl.invalid/quux/bar/baz

I have a added a Script (Python) object to my foo folder that looks
like this:

  from zExceptions import Redirect
  moved = '%s?%s' % (context.REQUEST['URL'].replace('foo', 'quux'), 
context.REQUEST['QUERY_STRING'])
  raise Redirect, moved

Then I have set an access rule on the folder by adding a Set Access
Rule object through the ZMI which points to the script object. My
access rule fires as expected, but anything after the foo is dropped.
That is,
  https://myurl.invalid/foo/bar/baz
redirects to
  https://myurl.invalid/quux?
while
  https://myurl.invalid/foo/bar/baz?parm=val
redirects to
  https://myurl.invalid/quux?parm=val

How can I make it pick up the right object? Testing
context.REQUEST['URL'] outside of an access rule looks like it should
work, but apparently the access rule eats part of the URL.

The only documentation I have been able to conjure up is
http://wiki.zope.org/zope2/SiteAccess which doesn't help much. I have
also tried to make sense of the code in VirtualHostMonster.py but I'm
afraid the whole map-and-stack thing is a bit beyond me.

Environment: SiteAccess-2.0.0, Zope-2.9.8 with python 2.4.2 on SUSE.

\\kristian
-- 
... et nemo ex vobis interrogat me: »Quo vadis?«
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )


Re: [Zope] AccessRule eats part of my URL

2010-06-23 Thread Kristian Thy
On Wed, Jun 23, Kristian Thy wrote:
   Dear List,
 
 How can I make it pick up the right object?

An off-list solution made its way to me:

from zExceptions import Redirect
rewritten_url = context.REQUEST['URL'].replace('foo', 'quux')
rewritten_url += '/' + 
'/'.join(reversed(context.REQUEST.TraversalRequestNameStack))
query = context.REQUEST['QUERY_STRING']
if query:
  rewritten_url = '%s?%s' % (rewritten_url, query)
raise Redirect, rewritten_url

Thanks.

\\kristian
-- 
... et nemo ex vobis interrogat me: »Quo vadis?«
___
Zope maillist  -  Zope@zope.org
https://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 https://mail.zope.org/mailman/listinfo/zope-announce
 https://mail.zope.org/mailman/listinfo/zope-dev )