You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2014/02/20 21:49:58 UTC
git commit: [#7177] Fix Trac 1.0.1 import problems
Repository: incubator-allura
Updated Branches:
refs/heads/master 2faedb5ed -> eba8041f3
[#7177] Fix Trac 1.0.1 import problems
- Handle lack of timezone info gracefully
- Handle BOM markers at top of file
Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/eba8041f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/eba8041f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/eba8041f
Branch: refs/heads/master
Commit: eba8041f3c563ba7b2a7a5c144f504d4e793c817
Parents: 2faedb5
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Thu Feb 20 20:49:07 2014 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Thu Feb 20 20:49:07 2014 +0000
----------------------------------------------------------------------
Allura/allura/scripts/trac_export.py | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/eba8041f/Allura/allura/scripts/trac_export.py
----------------------------------------------------------------------
diff --git a/Allura/allura/scripts/trac_export.py b/Allura/allura/scripts/trac_export.py
index 5f2f8d4..8b6419d 100644
--- a/Allura/allura/scripts/trac_export.py
+++ b/Allura/allura/scripts/trac_export.py
@@ -102,7 +102,8 @@ class TracExport(object):
"Remap fields to adhere to standard taxonomy."
out = {}
for k, v in dict.iteritems():
- out[self.FIELD_MAP.get(k, k)] = v
+ key = self.match_pattern(r'\W*(\w+)\W*', k)
+ out[self.FIELD_MAP.get(key, key)] = v
out['id'] = int(out['id'])
if 'private' in out:
@@ -124,7 +125,8 @@ class TracExport(object):
@classmethod
def trac2z_date(cls, s):
d = dateutil.parser.parse(s)
- d = d.astimezone(pytz.UTC)
+ if d.tzinfo is not None:
+ d = d.astimezone(pytz.UTC)
return d.strftime("%Y-%m-%dT%H:%M:%SZ")
@staticmethod
@@ -299,7 +301,7 @@ class DateJSONEncoder(json.JSONEncoder):
def export(url, start_id=1, verbose=False, do_attachments=True,
- only_tickets=False, limit=None):
+ only_tickets=False, limit=None, **kw):
ex = TracExport(url, start_id=start_id,
verbose=verbose, do_attachments=do_attachments)