Removed default value for session.

This commit is contained in:
Alexis Lahouze 2015-06-15 13:05:52 +02:00
parent 278fa7f816
commit f9acff50d1
3 changed files with 14 additions and 14 deletions

View File

@ -71,7 +71,7 @@ date_parser.add_argument('end',
class AccountListResource(Resource): class AccountListResource(Resource):
@session_aware @session_aware
@marshal_with_field(fields.List(Object(resource_fields))) @marshal_with_field(fields.List(Object(resource_fields)))
def get(self, session=None): def get(self, session):
""" """
Returns accounts with their balances. Returns accounts with their balances.
""" """
@ -85,7 +85,7 @@ class AccountListResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def post(self, session=None): def post(self, session):
""" """
Create a new account. Create a new account.
""" """
@ -107,7 +107,7 @@ class AccountListResource(Resource):
class AccountResource(Resource): class AccountResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def get(self, account_id, session=None): def get(self, account_id, session):
""" """
Get account. Get account.
""" """
@ -120,7 +120,7 @@ class AccountResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def delete(self, account_id, session=None): def delete(self, account_id, session):
try: try:
account = Account.get(session, account_id) account = Account.get(session, account_id)
except NoResultFound: except NoResultFound:
@ -135,7 +135,7 @@ class AccountResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def put(self, account_id, session=None): def put(self, account_id, session):
kwargs = parser.parse_args() kwargs = parser.parse_args()
assert (id not in kwargs or kwargs.id is None assert (id not in kwargs or kwargs.id is None

View File

@ -64,7 +64,7 @@ range_parser.add_argument('end', type=lambda a: dateutil.parser.parse(a))
class EntryListResource(Resource): class EntryListResource(Resource):
@session_aware @session_aware
@marshal_with_field(fields.List(Object(resource_fields))) @marshal_with_field(fields.List(Object(resource_fields)))
def get(self, session=None): def get(self, session):
kwargs = range_parser.parse_args() kwargs = range_parser.parse_args()
return Operation.get_for_account_and_range(session, **kwargs).all() return Operation.get_for_account_and_range(session, **kwargs).all()
@ -74,7 +74,7 @@ class EntryListResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def post(self, session=None): def post(self, session):
kwargs = parser.parse_args() kwargs = parser.parse_args()
entry = Entry(**kwargs) entry = Entry(**kwargs)
@ -87,7 +87,7 @@ class EntryListResource(Resource):
class EntryResource(Resource): class EntryResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def get(self, entry_id, session=None): def get(self, entry_id, session):
""" """
Get entry. Get entry.
""" """
@ -98,7 +98,7 @@ class EntryResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def put(self, entry_id, session=None): def put(self, entry_id, session):
kwargs = parser.parse_args() kwargs = parser.parse_args()
assert (id not in kwargs or kwargs.id is None assert (id not in kwargs or kwargs.id is None
@ -119,7 +119,7 @@ class EntryResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def delete(self, entry_id, session=None): def delete(self, entry_id, session):
try: try:
entry = Entry.get(session, entry_id) entry = Entry.get(session, entry_id)
except NoResultFound: except NoResultFound:

View File

@ -79,7 +79,7 @@ parser.add_argument('account_id', type=int)
class ScheduledOperationListResource(Resource): class ScheduledOperationListResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def put(self, session=None): def put(self, session):
""" """
Add a new scheduled operation. Add a new scheduled operation.
""" """
@ -95,7 +95,7 @@ class ScheduledOperationListResource(Resource):
class ScheduledOperationResource(Resource): class ScheduledOperationResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def get(self, scheduled_operation_id, session=None): def get(self, scheduled_operation_id, session):
""" """
Get scheduled operation. Get scheduled operation.
""" """
@ -106,7 +106,7 @@ class ScheduledOperationResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def delete(self, scheduled_operation_id, session=None): def delete(self, scheduled_operation_id, session):
try: try:
scheduled_operation = ScheduledOperation.get( scheduled_operation = ScheduledOperation.get(
session, scheduled_operation_id) session, scheduled_operation_id)
@ -119,7 +119,7 @@ class ScheduledOperationResource(Resource):
@session_aware @session_aware
@marshal_with_field(Object(resource_fields)) @marshal_with_field(Object(resource_fields))
def put(self, scheduled_operation_id, session=None): def put(self, scheduled_operation_id, session):
kwargs = parser.parse_args() kwargs = parser.parse_args()
assert (id not in kwargs or kwargs.id is None assert (id not in kwargs or kwargs.id is None