Re: [Zope] DateTime problem

2005-11-09 Thread Lennart Regebro
On 11/8/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> I have the following code that works on one Zope install and does not work
> on another. I would like to be able to use the same code under both, but am
> at a loss as to why there is a difference. I do not control the Zope
> servers running this application. Any help would be appreciated:
>
> On one server, the following code works fine: python:
>  myrecordset[0][0].strftime('%m/%d/%Y')
>
> But, when I move the page template containing that code to a different
> server, the following error is generated:
>
> 
> Exception Type AttributeError
> Exception Value 'str' object has no attribute 'strftime'

So, on the second server, you do not get a date time from SQL, but a string.
Seems to me that either the tables are set up differently, or there is
some change in the sql libraries.

I should also take this time to remind you that you are using very old
versions, which have serious amounts of bugs fixed in later versions.
But, yes, upgrading to newer versions is a lot of work.
--
Lennart Regebro, Nuxeo http://www.nuxeo.com/
CPS Content Management http://www.cps-project.org/
___
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )


[Zope] DateTime problem

2005-11-08 Thread [EMAIL PROTECTED]
I have the following code that works on one Zope install and does not work
on another. I would like to be able to use the same code under both, but am
at a loss as to why there is a difference. I do not control the Zope
servers running this application. Any help would be appreciated:

On one server, the following code works fine: python: 
 myrecordset[0][0].strftime('%m/%d/%Y') 

But, when I move the page template containing that code to a different
server, the following error is generated:


Exception Type AttributeError 
Exception Value 'str' object has no attribute 'strftime' 

Traceback (innermost last): 

Module ZPublisher.Publish, line 98, in publish 
Module ZPublisher.mapply, line 88, in mapply 
Module ZPublisher.Publish, line 39, in call_object 
Module Shared.DC.Scripts.Bindings, line 306, in __call__ 
Module Shared.DC.Scripts.Bindings, line 343, in _bindAndExec 
Module Products.PageTemplates.ZopePageTemplate, line 228, in _exec 
Module Products.PageTemplates.PageTemplate, line 95, in pt_render
 
Module TAL.TALInterpreter, line 200, in __call__ 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 703, in do_useMacro 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 726, in do_defineSlot 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 669, in do_condition 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 477, in do_setGlobal_tal 
Module Products.PageTemplates.TALES, line 220, in evaluate
URL: /Time/time_home.html
Line 60, Column 4
Expression: 
Names:
{'container': ,
 'default': ,
 'here': ,
 'loop': ,
 'modules': ,
 'nothing': None,
 'options': {'args': ()},
 'repeat': ,
 'request': http://myserver.mydomain.org/Time/time_home.html>,
 'root': ,
 'template': ,
 'traverse_subpath': [],
 'user': lford}
Module Products.PageTemplates.ZRPythonExpr, line 47, in __call__
__traceback_info__: myrecordset[0] [0].strftime('%m/%d/%Y') 
Module Python expression "myrecordset[0] [0].strftime('%m/%d/%Y')", line 1,
in 
AttributeError: 'str' object has no attribute 'strftime'


I can get it to run properly on this server by rewriting the code to:  
DateTime(sqlwkstart[0][0].strftime('%m/%d/%Y')

However, if I then take this corrected code and move it back to the first
server, I get the following error:
===
Exception Type TypeError 
Exception Value unsupported operand type(s) for / 

Traceback (innermost last): 

Module ZPublisher.Publish, line 98, in publish 
Module ZPublisher.mapply, line 88, in mapply 
Module ZPublisher.Publish, line 39, in call_object 
Module Shared.DC.Scripts.Bindings, line 252, in __call__ 
Module Shared.DC.Scripts.Bindings, line 283, in _bindAndExec 
Module Products.PageTemplates.ZopePageTemplate, line 228, in _exec 
Module Products.PageTemplates.PageTemplate, line 95, in pt_render
 
Module TAL.TALInterpreter, line 200, in __call__ 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 703, in do_useMacro 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 726, in do_defineSlot 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 669, in do_condition 
Module TAL.TALInterpreter, line 244, in interpret 
Module TAL.TALInterpreter, line 477, in do_setGlobal_tal 
Module Products.PageTemplates.TALES, line 217, in evaluate
URL: /Time/time_home.html
Line 60, Column 4
Expression: 
Names:
{'container': ,
 'default': ,
 'here': ,
 'loop': ,
 'modules': ,
 'nothing': None,
 'options': {'args': ()},
 'repeat': ,
 'request': http://otherserver.otherdomain.org/Time/time_home.html>,
 'root': ,
 'template': ,
 'traverse_subpath': [],
 'user': lford}
Module Products.PageTemplates.ZRPythonExpr, line 48, in __call__
__traceback_info__: DateTime(myrecordset[0][0]).strftime('%m/%d/%Y') 
Module Python expression
"DateTime(myrecordset[0][0]).strftime('%m/%d/%Y')", line 2, in f 
Module DateTime.DateTime, line 684, in __init__ 
Module DateTime.DateTime, line 281, in _calcSD
TypeError: unsupported operand type(s) for /

===
The DateTime.py modules are the same rev. on these 2 boxes. The Zope builds
are slightly different, but both are 2.6. The first appears to be using
Python 2.1, the other Python 2.2.3. The latter box is using a Debian
package of Zope and python-mysql.

Where do I start tracking this down?
Lee


mail2web - Check your email from the web at
http://mail2web.com/ .


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


Re: [Zope] DateTime problem

2000-11-14 Thread Aaron Payne

To view it as a DateTime object:



or
Create a DateTime object with an id of datestring to be rendered later.


To view it:


At 12:03 AM 11/15/00 -0300, Alejandro Pancani wrote:
>if I have a string that represent a date with the format dd/mm/
>How could I do to obtain a DateTime object from it?
>
>
>Alejandro Pancani
>[EMAIL PROTECTED]
>
>
>
>___
>Zope maillist  -  [EMAIL PROTECTED]
>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 )



___
Zope maillist  -  [EMAIL PROTECTED]
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 )




Re: [Zope] DateTime problem

2000-11-14 Thread Dieter Maurer

Alejandro Pancani writes:
 > if I have a string that represent a date with the format dd/mm/
 > How could I do to obtain a DateTime object from it?

  
  
  

is one solution.


Dieter

___
Zope maillist  -  [EMAIL PROTECTED]
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 )




[Zope] DateTime problem

2000-11-14 Thread Alejandro Pancani

if I have a string that represent a date with the format dd/mm/
How could I do to obtain a DateTime object from it?


Alejandro Pancani
[EMAIL PROTECTED]



___
Zope maillist  -  [EMAIL PROTECTED]
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 )