diff --git a/test/test_board.py b/test/test_board.py index 4bd9a3e1..d8319ce5 100644 --- a/test/test_board.py +++ b/test/test_board.py @@ -129,7 +129,7 @@ def test52_add_card_set_due(self): expected_due_date = card.due # Refresh the due date from cloud card.fetch() - actual_due_date = card.due[:10] + actual_due_date = card.due self.assertEquals(expected_due_date, actual_due_date) def test53_checklist(self): diff --git a/trello/__init__.py b/trello/__init__.py index 1fca89a2..2358005d 100644 --- a/trello/__init__.py +++ b/trello/__init__.py @@ -1,13 +1,13 @@ -#!/usr/bin/python -from board import * -from card import * -from checklist import * -from exceptions import * -from label import * -from member import * -from organization import * -from trelloclient import * -from trellolist import * -from webhook import * +# -*- coding: utf-8 -*- +from trello.board import * +from trello.card import * +from trello.checklist import * +from trello.exceptions import * +from trello.label import * +from trello.member import * +from trello.organization import * +from trello.trelloclient import * +from trello.trellolist import * +from trello.webhook import * # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4 diff --git a/trello/board.py b/trello/board.py index ebd880e0..709f7454 100644 --- a/trello/board.py +++ b/trello/board.py @@ -1,9 +1,9 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function -from member import Member -from card import Card -from trellolist import List -from label import Label +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import +from trello.member import Member +from trello.card import Card +from trello.trellolist import List +from trello.label import Label class Board(object): diff --git a/trello/card.py b/trello/card.py index 320e1dbb..c2c4d7b5 100644 --- a/trello/card.py +++ b/trello/card.py @@ -1,9 +1,8 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import from dateutil import parser as dateparser -from checklist import Checklist -from label import Label -import trellolist +from trello.checklist import Checklist +from trello.label import Label class Card(object): @@ -77,7 +76,7 @@ def __init__(self, parent, card_id, name=''): :trello_list: reference to the parent list :card_id: ID for this card """ - if isinstance(parent, trellolist.List): + if isinstance(parent, List): self.trello_list = parent self.board = parent.board else: @@ -133,9 +132,8 @@ def fetch(self, eager=True): self.labels = Label.from_json_list(self.board, json_obj['labels']) self.badges = json_obj['badges'] self.pos = json_obj['pos'] - # For consistency, due date is in YYYY-MM-DD format if json_obj.get('due', ''): - self.due = json_obj.get('due', '')[:10] + self.due = json_obj.get('due', '') else: self.due = '' self.checked = json_obj['checkItemStates'] @@ -156,7 +154,7 @@ def fetch_comments(self): def get_list(self): obj = self.client.fetch_json('/lists/' + self.idList) - return trellolist.List.from_json(board=self, json_obj=obj) + return List.from_json(board=self, json_obj=obj) def get_comments(self): comments = [] @@ -379,3 +377,6 @@ def _post_remote_data(self, attribute, files=None, **kwargs): http_method='POST', files=files, post_args=kwargs) + + +from trello.trellolist import List diff --git a/trello/checklist.py b/trello/checklist.py index 0ce01bb3..ad1134cc 100644 --- a/trello/checklist.py +++ b/trello/checklist.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import class Checklist(object): diff --git a/trello/exceptions.py b/trello/exceptions.py index b0cf8daf..cf323426 100644 --- a/trello/exceptions.py +++ b/trello/exceptions.py @@ -1,5 +1,4 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- class ResourceUnavailable(Exception): diff --git a/trello/label.py b/trello/label.py index 356a79b5..1010b993 100644 --- a/trello/label.py +++ b/trello/label.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import class Label(object): diff --git a/trello/member.py b/trello/member.py index bf97f6c3..79b0a067 100644 --- a/trello/member.py +++ b/trello/member.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import class Member(object): diff --git a/trello/organization.py b/trello/organization.py index 4636a6d6..279424f5 100644 --- a/trello/organization.py +++ b/trello/organization.py @@ -1,7 +1,7 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function -from board import Board -from member import Member +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import +from trello.board import Board +from trello.member import Member class Organization(object): @@ -9,7 +9,7 @@ class Organization(object): """ Class representing an organization """ - def __init__(self, client, organization_id, name=''): + def __init__(self, client, organization_id, name=''): self.client = client self.id = organization_id self.name = name diff --git a/trello/trelloclient.py b/trello/trelloclient.py index f9d9c382..b6b983e9 100644 --- a/trello/trelloclient.py +++ b/trello/trelloclient.py @@ -1,10 +1,15 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import +import json import requests from requests_oauthlib import OAuth1 -from board import Board -from card import Card -from exceptions import * +from trello.board import Board +from trello.card import Card +from trello.trellolist import List +from trello.organization import Organization +from trello.member import Member +from trello.webhook import WebHook +from trello.exceptions import * class TrelloClient(object): diff --git a/trello/trellolist.py b/trello/trellolist.py index 1c9c1a30..581b95f2 100644 --- a/trello/trellolist.py +++ b/trello/trellolist.py @@ -1,6 +1,5 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function -import card +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import class List(object): @@ -44,7 +43,7 @@ def fetch(self): def list_cards(self): """Lists all cards in this list""" json_obj = self.client.fetch_json('/lists/' + self.id + '/cards') - return [card.Card.from_json(self, c) for c in json_obj] + return [Card.from_json(self, c) for c in json_obj] def add_card(self, name, desc=None, labels=[], due="null"): """Add a card to this list @@ -61,7 +60,7 @@ def add_card(self, name, desc=None, labels=[], due="null"): '/cards', http_method='POST', post_args={'name': name, 'idList': self.id, 'desc': desc, 'idLabels': labels_str[:-1], 'due': due}) - return card.Card.from_json(self, json_obj) + return Card.from_json(self, json_obj) def archive_all_cards(self): self.client.fetch_json( @@ -100,3 +99,6 @@ def open(self): def cardsCnt(self): return len(self.list_cards()) + + +from trello.card import Card diff --git a/trello/util.py b/trello/util.py index e8adaf6e..961b3bff 100755 --- a/trello/util.py +++ b/trello/util.py @@ -1,7 +1,6 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import import os - from requests_oauthlib import OAuth1Session diff --git a/trello/webhook.py b/trello/webhook.py index 3f0979d1..f983d00c 100644 --- a/trello/webhook.py +++ b/trello/webhook.py @@ -1,5 +1,5 @@ -#!/usr/bin/python -from __future__ import with_statement, print_function +# -*- coding: utf-8 -*- +from __future__ import with_statement, print_function, absolute_import class WebHook(object):