Skip to content

Commit

Permalink
Merge pull request #48 from ucfopen/develop
Browse files Browse the repository at this point in the history
Release v0.5.1

Resolves #49
  • Loading branch information
Thetwam authored Aug 2, 2017
2 parents 94bdb9f + 0c7b1fb commit af2c080
Show file tree
Hide file tree
Showing 78 changed files with 229 additions and 169 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Change Log

## [0.5.1] - 2017-08-02
### General
- Moved documentation to [Read the Docs](http://canvasapi.readthedocs.io).

### Bugfixes

- Fixed an issue where kwargs in Python 2.7 wouldn't be properly formatted when converted to get parameters.

## [0.5.0] - 2017-07-10
### New Endpoint Coverage

Expand Down Expand Up @@ -99,6 +107,8 @@
- Fixed some incorrectly defined parameters
- Fixed an issue where tests would fail due to an improperly configured requires block

[0.5.1]: https://github.com/ucfopen/canvasapi/compare/v0.5.0...v0.5.1
[0.5.0]: https://github.com/ucfopen/canvasapi/compare/v0.4.0...v0.5.0
[0.4.0]: https://github.com/ucfopen/canvasapi/compare/v0.3.0...v0.4.0
[0.3.0]: https://github.com/ucfopen/canvasapi/compare/v0.2.0...v0.3.0
[0.2.0]: https://github.com/ucfopen/canvasapi/compare/v0.1.2...v0.2.0
Expand Down
4 changes: 2 additions & 2 deletions canvasapi/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# -*- coding: utf-8 -*-

from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from canvasapi.canvas import Canvas

__all__ = ["Canvas"]

__version__ = '0.5.0'
__version__ = '0.5.1'
13 changes: 9 additions & 4 deletions canvasapi/account.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import str
from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.paginated_list import PaginatedList
from canvasapi.util import combine_kwargs, obj_or_id


@python_2_unicode_compatible
class Account(CanvasObject):

def __str__(self):
Expand Down Expand Up @@ -920,25 +921,29 @@ def update_account_auth_settings(self, **kwargs):
return SSOSettings(self._requester, response.json())


@python_2_unicode_compatible
class AccountNotification(CanvasObject):

def __str__(self): # pragma: no cover
return str(self.subject)
return "{}".format(self.subject)


@python_2_unicode_compatible
class AccountReport(CanvasObject):

def __str__(self): # pragma: no cover
return "{} ({})".format(self.report, self.id)


@python_2_unicode_compatible
class Role(CanvasObject):

def __str__(self): # pragma: no cover
return "{} ({})".format(self.label, self.base_role_type)


@python_2_unicode_compatible
class SSOSettings(CanvasObject):

def __str___(self): # pragma: no cover
def __str__(self): # pragma: no cover
return"{} ({})".format(self.login_handle_name, self.change_password_url)
11 changes: 7 additions & 4 deletions canvasapi/appointment_group.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.exceptions import RequiredFieldMissing
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class AppointmentGroup(CanvasObject):

def __str__(self):
return "{} ({})".format(self.title, self.id)

def delete(self, **kwargs):
"""
Delete this appointment group.
Expand Down Expand Up @@ -49,6 +55,3 @@ def edit(self, appointment_group, **kwargs):
super(AppointmentGroup, self).set_attributes(response.json())

return AppointmentGroup(self._requester, response.json())

def __str__(self):
return "{} ({})".format(self.title, self.id)
6 changes: 5 additions & 1 deletion canvasapi/assignment.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class Assignment(CanvasObject):

def __str__(self):
Expand Down Expand Up @@ -45,6 +48,7 @@ def edit(self, **kwargs):
return Assignment(self._requester, response.json())


@python_2_unicode_compatible
class AssignmentGroup(CanvasObject):

def __str__(self):
Expand Down
5 changes: 4 additions & 1 deletion canvasapi/authentication_provider.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class AuthenticationProvider(CanvasObject):

def __str__(self): # pragma: no cover
Expand Down
7 changes: 4 additions & 3 deletions canvasapi/avatar.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import str
from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject


@python_2_unicode_compatible
class Avatar(CanvasObject):

def __str__(self): # pragma: no cover
return str(self.display_name)
return "{}".format(self.display_name)
11 changes: 7 additions & 4 deletions canvasapi/bookmark.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class Bookmark(CanvasObject):

def __str__(self):
return "{} ({})".format(self.name, self.id)

def delete(self):
"""
Delete this bookmark.
Expand Down Expand Up @@ -40,6 +46,3 @@ def edit(self, **kwargs):
super(Bookmark, self).set_attributes(response.json())

return Bookmark(self._requester, response.json())

def __str__(self):
return "{} ({})".format(self.name, self.id)
8 changes: 4 additions & 4 deletions canvasapi/calendar_event.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


class CalendarEvent(CanvasObject):

def __str__(self):
return "{} ({})".format(self.title, self.id)

def delete(self, **kwargs):
"""
Delete this calendar event.
Expand Down Expand Up @@ -41,6 +44,3 @@ def edit(self, **kwargs):
super(CalendarEvent, self).set_attributes(response.json())

return CalendarEvent(self._requester, response.json())

def __str__(self):
return "{} ({})".format(self.title, self.id)
4 changes: 1 addition & 3 deletions canvasapi/canvas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from __future__ import unicode_literals

from builtins import object
from __future__ import absolute_import, division, print_function, unicode_literals

from canvasapi.account import Account
from canvasapi.course import Course
Expand Down
6 changes: 3 additions & 3 deletions canvasapi/canvas_object.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals
from datetime import datetime
import json
import re

from builtins import str, object
from six import text_type

DATE_PATTERN = re.compile('[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z')

Expand Down Expand Up @@ -68,6 +68,6 @@ def set_attributes(self, attributes):
self.__setattr__(attribute, value)

# datetime field
if DATE_PATTERN.match(str(value)):
if DATE_PATTERN.match(text_type(value)):
date = datetime.strptime(value, '%Y-%m-%dT%H:%M:%SZ')
self.__setattr__(attribute + '_date', date)
5 changes: 4 additions & 1 deletion canvasapi/communication_channel.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.notification_preference import NotificationPreference


@python_2_unicode_compatible
class CommunicationChannel(CanvasObject):

def __str__(self):
Expand Down
5 changes: 4 additions & 1 deletion canvasapi/conversation.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class Conversation(CanvasObject):

def __str__(self):
Expand Down
6 changes: 5 additions & 1 deletion canvasapi/course.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.discussion_topic import DiscussionTopic
Expand All @@ -13,6 +15,7 @@
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class Course(CanvasObject):

def __str__(self):
Expand Down Expand Up @@ -1409,6 +1412,7 @@ def update_tab(self, tab_id, **kwargs):
return Tab(self._requester, response.json())


@python_2_unicode_compatible
class CourseNickname(CanvasObject):

def __str__(self):
Expand Down
5 changes: 4 additions & 1 deletion canvasapi/discussion_topic.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.paginated_list import PaginatedList
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class DiscussionTopic(CanvasObject):
def __str__(self):
return "{} ({})".format(self.title, self.id)
Expand Down
5 changes: 4 additions & 1 deletion canvasapi/enrollment.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject


@python_2_unicode_compatible
class Enrollment(CanvasObject):

def __str__(self):
Expand Down
11 changes: 7 additions & 4 deletions canvasapi/enrollment_term.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject
from canvasapi.util import combine_kwargs


@python_2_unicode_compatible
class EnrollmentTerm(CanvasObject):

def __str__(self):
return "{} ({})".format(self.name, self.id)

def delete(self):
"""
Delete this Enrollment Term.
Expand Down Expand Up @@ -37,6 +43,3 @@ def edit(self, **kwargs):
)

return EnrollmentTerm(self._requester, response.json())

def __str__(self):
return "{} ({})".format(self.name, self.id)
9 changes: 5 additions & 4 deletions canvasapi/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import str
from six import python_2_unicode_compatible, text_type


@python_2_unicode_compatible
class CanvasException(Exception): # pragma: no cover
"""
Base class for all errors returned by the Canvas API.
Expand All @@ -13,14 +14,14 @@ def __init__(self, message):

errors = message.get('errors', False)
if errors:
self.message = str(errors)
self.message = errors
else:
self.message = ('Something went wrong. ', message)
else:
self.message = message

def __str__(self):
return self.message
return text_type(self.message)


class BadRequest(CanvasException):
Expand Down
7 changes: 4 additions & 3 deletions canvasapi/external_feed.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
from __future__ import unicode_literals
from __future__ import absolute_import, division, print_function, unicode_literals

from builtins import str
from six import python_2_unicode_compatible

from canvasapi.canvas_object import CanvasObject


@python_2_unicode_compatible
class ExternalFeed(CanvasObject):

def __str__(self):
return str(self.display_name)
return "{}".format(self.display_name)
Loading

0 comments on commit af2c080

Please sign in to comment.