Share account_id argument between parsers.
This commit is contained in:
parent
abcdfcf48c
commit
4b1313e65c
@ -14,6 +14,7 @@
|
|||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
|
along with Accountant. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""
|
"""
|
||||||
|
from copy import deepcopy
|
||||||
import dateutil.parser
|
import dateutil.parser
|
||||||
|
|
||||||
from flask.ext.restful import reqparse
|
from flask.ext.restful import reqparse
|
||||||
@ -29,9 +30,15 @@ range_parser.add_argument(
|
|||||||
type=lambda a: dateutil.parser.parse(a) if a else None
|
type=lambda a: dateutil.parser.parse(a) if a else None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Parser for an account id.
|
||||||
|
account_id_parser = reqparse.RequestParser()
|
||||||
|
account_id_parser.add_argument('account_id', type=int)
|
||||||
|
|
||||||
# Parser for a date range and an account id.
|
# Parser for a date range and an account id.
|
||||||
account_range_parser = range_parser.copy()
|
account_range_parser = range_parser.copy()
|
||||||
account_range_parser.add_argument('account_id', type=int)
|
account_range_parser.add_argument(
|
||||||
|
deepcopy(account_id_parser.args[0])
|
||||||
|
)
|
||||||
|
|
||||||
# Parser for an account.
|
# Parser for an account.
|
||||||
account_parser = reqparse.RequestParser()
|
account_parser = reqparse.RequestParser()
|
||||||
@ -53,10 +60,6 @@ operation_parser.add_argument('scheduled_operation_id', type=int)
|
|||||||
operation_parser.add_argument('confirmed', type=bool)
|
operation_parser.add_argument('confirmed', type=bool)
|
||||||
operation_parser.add_argument('canceled', type=bool)
|
operation_parser.add_argument('canceled', type=bool)
|
||||||
|
|
||||||
# Parser for an account id.
|
|
||||||
account_id_parser = reqparse.RequestParser()
|
|
||||||
account_id_parser.add_argument('account_id', type=int)
|
|
||||||
|
|
||||||
# Parser for a scheduled operation.
|
# Parser for a scheduled operation.
|
||||||
scheduled_operation_parser = reqparse.RequestParser()
|
scheduled_operation_parser = reqparse.RequestParser()
|
||||||
scheduled_operation_parser.add_argument(
|
scheduled_operation_parser.add_argument(
|
||||||
|
Loading…
Reference in New Issue
Block a user