[Moin-user] Proper timezone support using pytz

Max Bowsher maxb at f2s.com
Sun Nov 1 12:52:36 EST 2009


I have just finished an initial draft of a patch to give MoinMoin proper
timezone support using pytz. (http://paste.ubuntu.com/306824/)

If you're not aware, the problem with the existing timezone support is
that it just allows configuration of a naive offset from UTC, which
means every user needs to reconfigure their timezone every time they
enter or exit DST.

I have a few questions on the preferred way to proceed:

One option would be for MoinMoin to require pytz - this has the
advantage of making the code simpler, as it is not necessary to maintain
parallel codepaths. Alternatively, I've currently got the patch set up
to conditionally import pytz - but the migration corner cases, which
I've yet to consider carefully, are more difficult this way, and I'm
sceptical that the extra complexity is worth it.


Another issue is user profile migration: I'm currently assuming that
user profiles will be left containing and using their tz_offset
immediately after an upgrade, and when users edit their profiles, they
will get migrated to a named timezone. but:

1) Do I bother writing code specifically to allow people to enter and
save the user prefs page (to change other prefs) without setting a
timezone? (Or just default it to UTC and hope they set it properly
whilst they're there)

2) Do I bother considering the potential for reverse-migration (e.g. 1.9
-> 1.8 rollback, or 1.9-with-pytz -> 1.9-without-pytz if we go the pytz
as optional dependency route) ?

Options would be:
* Delete the tz_offset from user profiles when edited after upgrade. If
you migrate back, users end up with a defaulted tz_offset.

* Keep the old tz_offset lying around unused just in case.

* Actually make an effort to update the tz_offset using the base offset
of the timezone when the user reconfigures their timezone. I'm not a fan
of this, as due to DST, it'll be a lie for half of the year anyway.



Thanks,
Max.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/moin-user/attachments/20091101/aa7318e0/attachment.sig>


More information about the Moin-user mailing list