Issue 1236087
Created on 2005-07-11 14:11 by schlatterbeck, last changed 2005-07-12 01:36 by richard.
File name |
Uploaded |
Description |
Edit |
Remove |
roundup.patch
|
schlatterbeck,
2005-07-11 14:11
|
refactoring of hyperdb.rawToHyperdb |
|
|
msg2760 |
Author: [hidden] (schlatterbeck) |
Date: 2005-07-11 14:11 |
|
This patch refactors hyperdb.rawToHyperdb from a long
if/elsif cascade into individual "from_raw" methods of
the various hyperdb classes like String, Date, ...
I have retained rawToHyperdb but replaced the "pwre"
regex -- seems it is not used anywhere so far -- by a
**kw parameter. In this way you can still pass in
overrides for various properties. But you may want to
remove the **kw altogether.
I have created new constructor parameters for
- Date: added an "offset" parameter for specifying
offset to UTC. In this way I can create Date objects
without timezone awareness (called naive dates in
python) by setting this offset to 0 in schema.py
The Date class got additional methods "offset" (for
computing the offset from UTC by either using
self._offset or db.getUserTimezone if _offset is None)
and "range_from_raw" for computing a date.Range object
from a raw value taking the timezone/offset into
account. I have replaced (hopefully all) instances of
Range computations in various backends with the new
function. This also lays ground for later refactoring
the timezone stuff to use symbolic timezones instead of
a fixed hour offset.
- Password: added a pwre parameter for specifying the
password regex. The default is the same as in the old
rawToHyperdb function. You might want to search for
instances of the string "pwre" in the whole codebase,
it seems this information is in many places and should
probably be centralised.
I've also changed DateHTMLcgi.templating -- which
already had an offset parameter -- to use the offset
from the wrapped Date object if not given in the
constructor. It also uses the offset now for the field
method -- although I'm not quite sure if this is
correct -- it is correct if the wrapped date property
has an _offset, but maybe not if only the wrapper has
an offset (but I'm unsure if retaining an additional
offset in the wrapper makes much sense -- it depends on
who uses this already).
I need naive dates in a project, so even if you do not
want the additional parameter on hyperdb.Date, please
consider the refactoring as it makes my life easier for
maintaining a branch... I also think that this
refactoring lays some ground in implementing symbolic
timezones instead of a fixed hour offset...
Ralf
|
msg2761 |
Author: [hidden] (richard) |
Date: 2005-07-12 01:36 |
|
Logged In: YES
user_id=6405
I've cleaned up the pwre stuff so there's a single instance of it.
Thanks for the excellent work!
|
|
Date |
User |
Action |
Args |
2005-07-11 14:11:04 | schlatterbeck | create | |
|