[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] ViewMTN patch: accept timestamps with microseconds
From: |
Ludovic Brenta |
Subject: |
[Monotone-devel] ViewMTN patch: accept timestamps with microseconds |
Date: |
Wed, 4 Jul 2007 16:48:53 +0200 |
User-agent: |
Mutt/1.5.11 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I experimented with importing a project into Monotone using tailor.
This worked well, but the timestamps for most revisions contain
microseconds, like this: "2007-06-27T08:58:38.950999". As a result,
ViewMTN gets a ValueError from time.strptime() when trying to parse
the string, and sends a page with "internal server error". The patch
below solves this problem. You can see the result on
http://www.ada-france.org:8081/branch/changes/org.debian.gcc-4.2 . It
Just Works and is very uninteresting :)
Thanks for ViewMTN!
PS. I committed with key "address@hidden" but my usual key is
"address@hidden", also attached, just in case you think I
deserve commit rights on one of your databases. This email is
GPG-signed.
- --
Ludovic Brenta.
[keypair address@hidden
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6GLKlGOz43GGZxxgHPTunD/7Hj/65RFMW
ygr8wBBu68tYFf8Zgp5h/Szw/sVQi6VUDTZEoojPDhvQET5Ayon2SrmUGMd0vP3yoFIvj1gw
Ap1dAPh1u77uECejVflfIr0uS3q+mrwKn2kUCGxLs3fwq2UQY1gODQnSH2ak0nLv9wIDAQAB#
MIICyTBDBgkqhkiG9w0BBQ0wNjAeBgkqhkiG9w0BBQwwEQQI5E+msA8aSN4CAggAAgEYMBQG
CCqGSIb3DQMHBAgAp0szupRmzgSCAoCMhlSVsTut+bxt2AFtgNEtQjO7D6Je0K0LBiB9W4Ww
TNLJm5XGaBEt0hllEVd1v4x/CU2+6STT8ysmioEFk1WhCeVfYHD5nPyWX74tbx9A6+fVKtOE
MXYCnYU+vFaKb7AHi4VrlvUjy64VpVvAx8YhL6HHLAbHTuhN2TpxqkrQ5Cq/j13uInSO/PBA
VKr7xGPz7kznsoGzgdbjTb1AaHaWk8LvJjsa952WXrsOb+IzlgTXkvnSsgoTu1ROungoGmqI
ZdLA0+vtJLUVKrDvJSzIjuAfoWfYzgtuAHeXpoSEfGFHVGfy6B58inCANDPSVPY0faaZ7z1R
K6305rApGR5gbgcxu4xH5kZvT2Ey8a4dSUECmvjMx94dYJ7qC0/tbS+vYHQd12lgChiLL0Tv
HDw817K/STSN573c4oIf7mGWQEJt1rG8vobeD9h/gf3DlAVeAJWsrrDlepW85kC69AeGxVQX
EraVzj4DLOp6LO39/gb9N1E+xqUSTdCLVHUqv57yd0ZnKERPCvXD4Mp+ZsmYr7QFsv2uBIOf
/t8wLgTxGdCWOmOz5cNKpf6xrKFN5erNgwH6XrrIU/oF6HWuMj/beMNTrh4YdZVKro0Xx0wp
BBEqT++gOu8nlBzbIZ6A8vauaAYlvYmrhd4i2n0Gsvo2mK8YVByaNANcGZdzutnMWSno0KGw
C6mtzrgULSiy5+KfDu9V8hakd9lk7Hd1U7jRwRp/zuS+U17MAj3GYDQR0FZ9/sRMJO641qgp
uah4xd5PNFz+YZI4RWB+AImmIg7OV6NYwJlmHqFsTmQ+5+7FHFasI/mDS28k9jiT7BeFNw4i
eYr4Wrq19IwEvhhNPLBY
[end]
- -----------------------------------------------------------------
Revision: ef26ac329bb15b7607b0bb473c71c84564a2ac02
Ancestor: 7b40124b48efc337e16111a658ac636ae50ac52e
Author: address@hidden
Date: 2007-07-04T14:29:08
Branch: net.angrygoats.viewmtn
Modified files:
common.py
ChangeLog:
common.py: handle the special case when the timestamp in the Monotone
database contains microseconds, which time.strptime cannot parse.
============================================================
- --- common.py 2504e01f69f99347d0e8706fb7c344c6a6471e43
+++ common.py f8f7c657f7c531ed9c11ec3011b78913d971aa0c
@@ -17,6 +17,12 @@ def parse_timecert(value):
import traceback
def parse_timecert(value):
+ # The datetime may contain microseconds which time.strptime cannot parse.
+ # Drop them. This is easy because Monotone keeps timestamps in ISO 8601
+ # format, so microseconds necessarily start with a period.
+ index_of_period = value.find ('.')
+ if index_of_period > -1:
+ value = value[0:index_of_period]
return apply(datetime.datetime, time.strptime(value,
"%Y-%m-%dT%H:%M:%S")[:6])
def set_nonblocking(fd):
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQFGi7G2x9kwJZ3/qtQRAnfJAJ9+ab+eF8s0TqlViyuqFvObzJ9mPgCgtJe0
WbIrPiXvynX6YL+KOb79GAQ=
=b6Oj
-----END PGP SIGNATURE-----
- [Monotone-devel] ViewMTN patch: accept timestamps with microseconds,
Ludovic Brenta <=