From 5bd3a9da8a8b3878fd7bfa4b3aced3d85baaa5f0 Mon Sep 17 00:00:00 2001 From: David Medina Date: Sun, 3 Jun 2012 14:43:00 +0200 Subject: WIP on issues Fix GET params Config precendence of user/repo TODO: milestones , fix tests and test it --- pygithub3/resources/base.py | 7 +++++-- pygithub3/resources/issues.py | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'pygithub3/resources') diff --git a/pygithub3/resources/base.py b/pygithub3/resources/base.py index 7045529..4c65b8b 100644 --- a/pygithub3/resources/base.py +++ b/pygithub3/resources/base.py @@ -1,8 +1,12 @@ #!/usr/bin/env python # -*- encoding: utf-8 -*- +from datetime import datetime + from pygithub3.core.utils import json +GITHUB_DATE_FORMAT = '%Y-%m-%dT%H:%M:%SZ' + class Resource(object): @@ -44,9 +48,8 @@ class Resource(object): return wrapper def parse_date(string_date): - from datetime import datetime try: - date = datetime.strptime(string_date, '%Y-%m-%dT%H:%M:%SZ') + date = datetime.strptime(string_date, GITHUB_DATE_FORMAT) except TypeError: date = None return date diff --git a/pygithub3/resources/issues.py b/pygithub3/resources/issues.py index 69f905a..b2301a6 100644 --- a/pygithub3/resources/issues.py +++ b/pygithub3/resources/issues.py @@ -35,13 +35,13 @@ class Issue(Resource): _dates = ('created_at', 'updated_at', 'closed_at') _maps = { - 'assignee': User, - 'user': User, + 'assignee': User, + 'user': User, 'milestone': Milestone, 'pull_request': PullRequest } - _collection_maps = {'labels': Label} + _collection_maps = {'labels': Label} def __str__(self): return '' % getattr(self, 'number', '') -- cgit v1.2.3-59-g8ed1b