I am new to Zope and OOP, so please bear with my ignorance and stupidity!! I am attempting to retrieve a Date from an interbase DB (using Kinterbas) into Zope (v 2.5.1), but not in the YYYY-MM-DD HH:MM:SS.ss format that it wants me to. I am having trouble with this, and have installed mxDateTime in an attempt to resolve the problem. I have written a small Python script in Zope to confirm that it works, and it doesn't. I get errors. the script and error are below: ************************************************************* from mx.DateTime import * while 1: return now().hour ************************************************************* Error Type: Unauthorized Error Value: You are not allowed to access DateTime in this context ************************************************************* Can anyone help with either (or both!) problem(s)? Kind regards Ashley _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
You could retrieve the time from Interbase in a standard Python DateTime object (should be the default) and then render the appropriate portion using Python's strftime function: now = DateTime() # or however you get it... return now.strftime('%I') # will return just the hour See Python documentation for more information on strftime. Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Ashley Lloyd Sent: Monday, January 06, 2003 7:07 AM To: zope@zope.org Subject: [Zope] Newbie Question: date formatting/Context I am new to Zope and OOP, so please bear with my ignorance and stupidity!! I am attempting to retrieve a Date from an interbase DB (using Kinterbas) into Zope (v 2.5.1), but not in the YYYY-MM-DD HH:MM:SS.ss format that it wants me to. I am having trouble with this, and have installed mxDateTime in an attempt to resolve the problem. I have written a small Python script in Zope to confirm that it works, and it doesn't. I get errors. the script and error are below: ************************************************************* from mx.DateTime import * while 1: return now().hour ************************************************************* Error Type: Unauthorized Error Value: You are not allowed to access DateTime in this context ************************************************************* Can anyone help with either (or both!) problem(s)? Kind regards Ashley _________________________________________________________________ Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963 _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (2)
-
Ashley Lloyd -
Kevin Carlson