Thread: [SQLObject] DateCol format on default
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: Gustavo A. D. <gus...@gm...> - 2015-08-26 17:07:45
|
Hi, Is there anyway to change for date format on DateCol default value? I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but does not work: unhandled formencode.api.Invalid "expected a date/time string of the '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> '26-08-2015' instead" Thanks! -- Gustavo A. Díaz GDNet - www.gdnet.com.ar "Servicios TI para tus necesidades" |
From: Gustavo A. D. <gus...@gm...> - 2015-08-26 17:23:06
|
Forget this question, I just stored with default=DateTimeCol.now and when read it, just formated with datetime.strftime. Thanks! -- Gustavo A. Díaz GDNet - www.gdnet.com.ar "Servicios TI para tus necesidades" 2015-08-26 14:07 GMT-03:00 Gustavo A. Díaz <gus...@gm...>: > Hi, > > Is there anyway to change for date format on DateCol default value? > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but > does not work: > > unhandled formencode.api.Invalid "expected a date/time string of the > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > '26-08-2015' instead" > > Thanks! > > -- > > Gustavo A. Díaz > GDNet - www.gdnet.com.ar > "Servicios TI para tus necesidades" > |
From: Oleg B. <ph...@ph...> - 2015-08-26 17:48:48
|
Hi! On Wed, Aug 26, 2015 at 02:07:38PM -0300, "Gustavo A. D??az" <gus...@gm...> wrote: > Is there anyway to change for date format on DateCol default value? > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but > does not work: > > unhandled formencode.api.Invalid "expected a date/time string of the > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > '26-08-2015' instead" The problem is that the code that's used to parse user input is also used to parse output from the backend, so if you want to change the format yo have to change it at the DB level too. And then you have to change DateTimeConverter to pass date/time strings to the backing in the proper format. See the discussion and some examples at https://github.com/sqlobject/sqlobject/issues/114 Your best bet, I think, is to parse d/t strings yourself and pass date/datetime instances to your column(s). > Thanks! > > -- ^ You have forgotten a space here; signatures are separated by two dashes and a space. (-: > Gustavo A. D??az > GDNet - www.gdnet.com.ar > "Servicios TI para tus necesidades" Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Gustavo A. D. <gus...@gm...> - 2015-08-26 19:46:43
|
Oleg! Thanks for reply. Yeah, but is ok since finally I don't care how is stored in the DB since I can parse it later (sometimes I ask questions in lists, forums and in a few minutes I reply myself with a solution... sorry :P) About signature: lol (If true I didn't know :P) Thanks! -- Gustavo A. Díaz GDNet - www.gdnet.com.ar "Servicios TI para tus necesidades" 2015-08-26 14:26 GMT-03:00 Oleg Broytman <ph...@ph...>: > Hi! > > On Wed, Aug 26, 2015 at 02:07:38PM -0300, "Gustavo A. D??az" < > gus...@gm...> wrote: > > Is there anyway to change for date format on DateCol default value? > > > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but > > does not work: > > > > unhandled formencode.api.Invalid "expected a date/time string of the > > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > > '26-08-2015' instead" > > The problem is that the code that's used to parse user input is also > used to parse output from the backend, so if you want to change the > format yo have to change it at the DB level too. And then you have to > change DateTimeConverter to pass date/time strings to the backing in the > proper format. > See the discussion and some examples at > https://github.com/sqlobject/sqlobject/issues/114 > > Your best bet, I think, is to parse d/t strings yourself and pass > date/datetime instances to your column(s). > > > Thanks! > > > > -- > ^ You have forgotten a space here; signatures are separated by two > dashes and a space. (-: > > > Gustavo A. D??az > > GDNet - www.gdnet.com.ar > > "Servicios TI para tus necesidades" > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Oleg B. <ph...@ph...> - 2015-08-26 20:12:03
|
On Wed, Aug 26, 2015 at 04:46:35PM -0300, "Gustavo A. D??az" <gus...@gm...> wrote: > Oleg! > > Thanks for reply. Yeah, but is ok since finally I don't care how is stored > in the DB since I can parse it later (sometimes I ask questions in lists, Ok. > forums and in a few minutes I reply myself with a solution... sorry :P) No problem! > About signature: lol (If true I didn't know :P) https://tools.ietf.org/html/rfc3676#section-4.3 https://en.wikipedia.org/wiki/Signature_block "The Usenet standards specify that a signature block should be displayed as plain text in a fixed-width font (no HTML, images, or other rich text), and should be delimited from the body of the message by a single line consisting of exactly two hyphens, followed by a space, followed by the end of line (i.e., "-- \n"). This latter prescription, which goes by many names, including "sig dashes", "signature cut line", "sig-marker", "sig separator" and "signature delimiter", allows software to automatically mark or remove the sig block as the receiver desires." > Thanks! You are welcome! > -- > > Gustavo A. D??az > GDNet - www.gdnet.com.ar > "Servicios TI para tus necesidades" > > 2015-08-26 14:26 GMT-03:00 Oleg Broytman <ph...@ph...>: > > > On Wed, Aug 26, 2015 at 02:07:38PM -0300, "Gustavo A. D??az" < > > gus...@gm...> wrote: > > > Is there anyway to change for date format on DateCol default value? > > > > > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') but > > > does not work: > > > > > > unhandled formencode.api.Invalid "expected a date/time string of the > > > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > > > '26-08-2015' instead" > > > > The problem is that the code that's used to parse user input is also > > used to parse output from the backend, so if you want to change the > > format yo have to change it at the DB level too. And then you have to > > change DateTimeConverter to pass date/time strings to the backing in the > > proper format. > > See the discussion and some examples at > > https://github.com/sqlobject/sqlobject/issues/114 > > > > Your best bet, I think, is to parse d/t strings yourself and pass > > date/datetime instances to your column(s). > > > > > Thanks! > > > > > > -- > > ^ You have forgotten a space here; signatures are separated by two > > dashes and a space. (-: Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Gustavo A. D. <gus...@gm...> - 2015-08-26 20:35:43
|
Thanks for the info! :) Now I think my signature is fixed :D Cheers. -- Gustavo A. Díaz GDNet - www.gdnet.com.ar "Servicios TI para tus necesidades" 2015-08-26 17:11 GMT-03:00 Oleg Broytman <ph...@ph...>: > On Wed, Aug 26, 2015 at 04:46:35PM -0300, "Gustavo A. D??az" < > gus...@gm...> wrote: > > Oleg! > > > > Thanks for reply. Yeah, but is ok since finally I don't care how is > stored > > in the DB since I can parse it later (sometimes I ask questions in lists, > > Ok. > > > forums and in a few minutes I reply myself with a solution... sorry :P) > > No problem! > > > About signature: lol (If true I didn't know :P) > > https://tools.ietf.org/html/rfc3676#section-4.3 > > https://en.wikipedia.org/wiki/Signature_block > > "The Usenet standards specify that a signature block should be > displayed as plain text in a fixed-width font (no HTML, images, or other > rich text), and should be delimited from the body of the message by a > single line consisting of exactly two hyphens, followed by a space, > followed by the end of line (i.e., "-- \n"). This latter prescription, > which goes by many names, including "sig dashes", "signature cut line", > "sig-marker", "sig separator" and "signature delimiter", allows software > to automatically mark or remove the sig block as the receiver desires." > > > Thanks! > > You are welcome! > > > -- > > > > Gustavo A. D??az > > GDNet - www.gdnet.com.ar > > "Servicios TI para tus necesidades" > > > > 2015-08-26 14:26 GMT-03:00 Oleg Broytman <ph...@ph...>: > > > > > On Wed, Aug 26, 2015 at 02:07:38PM -0300, "Gustavo A. D??az" < > > > gus...@gm...> wrote: > > > > Is there anyway to change for date format on DateCol default value? > > > > > > > > I use DateCol(default=datetime.strftime(datetime.now(), '%d-%m-%Y') > but > > > > does not work: > > > > > > > > unhandled formencode.api.Invalid "expected a date/time string of the > > > > '%Y-%m-%d' format in the DateTimeCol 'modified', got <class 'str'> > > > > '26-08-2015' instead" > > > > > > The problem is that the code that's used to parse user input is also > > > used to parse output from the backend, so if you want to change the > > > format yo have to change it at the DB level too. And then you have to > > > change DateTimeConverter to pass date/time strings to the backing in > the > > > proper format. > > > See the discussion and some examples at > > > https://github.com/sqlobject/sqlobject/issues/114 > > > > > > Your best bet, I think, is to parse d/t strings yourself and pass > > > date/datetime instances to your column(s). > > > > > > > Thanks! > > > > > > > > -- > > > ^ You have forgotten a space here; signatures are separated by two > > > dashes and a space. (-: > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |