I would like to change the date format used in ExtFile to include the year like %Y%m%d%H%M%S. At present the script will on accept %m%d%H%M%S Using the extra characters created by %Y gets the zope error: Error Type: ValueError Error Value: int() literal too large: 20030123222057 I am setting the FILE_FORMAT = "%n-%t%e" Changing Line 590 to: counter = int(DateTime().strftime('%Y%m%d%H%M%S')) What's else needs to be changed please? TIA Mike Bunyan
Mike Bunyan wrote at 2003-1-23 22:22 +0000:
I would like to change the date format used in ExtFile to include the year like %Y%m%d%H%M%S. At present the script will on accept %m%d%H%M%S
Using the extra characters created by %Y gets the zope error: Error Type: ValueError Error Value: int() literal too large: 20030123222057
I am setting the FILE_FORMAT = "%n-%t%e" Changing Line 590 to: counter = int(DateTime().strftime('%Y%m%d%H%M%S'))
What's else needs to be changed please? The "int" data type has a limit: its a bit above 2.000.000.000.
If you need something bigger, you must use "long" (which does not have a limit). However, the "%i" and "%d" format specifiers can overflow. You can try "%s" or you need to provide your own conversion from long to string. Dieter
Many thanks. I was not aware of the 'int' max. I have tried your suggestions with some success. I have decided to try and introduce a new option for 'year' which I think will be more flexible for use by others. Mike B On Fri, 24 Jan 2003 22:56:32 +0100, Dieter Maurer <dieter@handshake.de> wrote:
Mike Bunyan wrote at 2003-1-23 22:22 +0000:
I would like to change the date format used in ExtFile to include the year like %Y%m%d%H%M%S. At present the script will on accept %m%d%H%M%S
Using the extra characters created by %Y gets the zope error: Error Type: ValueError Error Value: int() literal too large: 20030123222057
I am setting the FILE_FORMAT = "%n-%t%e" Changing Line 590 to: counter = int(DateTime().strftime('%Y%m%d%H%M%S'))
What's else needs to be changed please? The "int" data type has a limit: its a bit above 2.000.000.000.
If you need something bigger, you must use "long" (which does not have a limit). However, the "%i" and "%d" format specifiers can overflow. You can try "%s" or you need to provide your own conversion from long to string.
Dieter
_______________________________________________ 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)
-
Dieter Maurer -
Mike Bunyan