diff --git a/setup.py b/setup.py index d22f85875f..47cbf5ef06 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ } setup(name='openprocurement.api', - version='2.4.20dp', + version='2.4.21dp', description='openprocurement.api', long_description=README, classifiers=[ diff --git a/src/openprocurement/api/models.py b/src/openprocurement/api/models.py index 3fe76dea15..59fbec761b 100644 --- a/src/openprocurement/api/models.py +++ b/src/openprocurement/api/models.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- import re -from datetime import datetime +from datetime import datetime, timedelta from decimal import Decimal, InvalidOperation, ROUND_HALF_UP from iso8601 import parse_date, ParseError from isodate import ISO8601Error, parse_duration, duration_isoformat @@ -172,7 +172,7 @@ class IsoDurationType(BaseType): } def to_native(self, value, context=None): - if isinstance(value, Duration): + if isinstance(value, Duration) or isinstance(value, timedelta): return value try: return parse_duration(value) diff --git a/src/openprocurement/api/tests/dev_tools.py b/src/openprocurement/api/tests/dev_tools.py index bfb628760c..0dcbaef83e 100644 --- a/src/openprocurement/api/tests/dev_tools.py +++ b/src/openprocurement/api/tests/dev_tools.py @@ -2,7 +2,7 @@ import os import sys import unittest - +from datetime import timedelta from isodate import duration_isoformat from isodate.duration import Duration from schematics.transforms import whitelist @@ -104,6 +104,15 @@ def test_iso_duration_type(self): self.assertEqual('P3Y6M4DT12H30M5S', res_dur1) self.assertEqual('P2Y18M4DT12H30M5S', res_dur2) + def test_iso_duration_type_from_timedelta(self): + duration_instance = IsoDurationType() + duration = timedelta(days=1) + self.assertEqual(duration_instance(duration), duration) + + def test_iso_duration_type_from_Duration(self): + duration_instance = IsoDurationType() + duration = Duration(months=1, days=1) + self.assertEqual(duration_instance(duration), duration) def suite(): suite = unittest.TestSuite() diff --git a/versions.cfg b/versions.cfg index a4b015ab07..eb28d7d228 100644 --- a/versions.cfg +++ b/versions.cfg @@ -1,48 +1,153 @@ [versions] + +APScheduler = 3.0.6 +CouchDB = 1.0.1 +Genshi = 0.7 +Jinja2 = 2.7.3 +Paste = 1.7.5.1 +PasteDeploy = 1.5.2 +Pygments = 2.0.2 +Sphinx = 1.3.4 +WebOb = 1.6.1 +WebTest = 2.0.20 +ZEO = 4.0.0 +ZODB = 4.0.1 +circus = 0.13.0 +circus-web = 1.0.0 +collective.recipe.sphinxbuilder = 0.8.2 +collective.recipe.template = 1.11 +coverage = 4.0.3 +jsonpointer = 1.9 +mr.developer = 1.31 +nose = 1.3.7 +persistent = 4.0.8 +py = 1.4.26 +repoze.lru = 0.6 +repoze.profile = 2.1 +translationstring = 1.3 +venusian = 1.0 +waitress = 0.8.10 +zc.buildout = 2.2.5 +zc.recipe.egg = 2.0.3 +zdaemon = 4.0.0 +zope.configuration = 4.0.3 +zope.deprecation = 4.1.1 +zope.interface = 4.1.1 +zope.proxy = 4.1.4 +ExtendedJournalHandler = 0.0.1 +mock = 1.0 +BTrees = 4.0.8 +Mako = 1.0.0 +MarkupSafe = 0.23 +TornadIO2 = 0.0.3 +ZConfig = 3.0.4 +ZODB3 = 3.11.0 +anyjson = 0.3.3 +backports.ssl-match-hostname = 3.4.0.2 beautifulsoup4 = 4.3.2 boto = 2.31.1 +certifi = 14.05.14 chaussette = 1.3.0 cornice = 1.2.0.dev0 -CouchDB = 1.0 couchdb-schematics = 1.1.1 -coverage = 4.0.3 docutils = 0.12 +futures = 2.2.0 gevent = 1.1.1 greenlet = 0.4.9 +iowait = 0.2 iso8601 = 0.1.11 -Jinja2 = 2.7.3 jsonpatch = 1.13-jsondiff.unicode.replacefix.0 -jsonpointer = 1.9 -LEPL = 5.1.3 -MarkupSafe = 0.23 -mock = 1.0.1 -nose = 1.3.7 -PasteDeploy = 1.5.2 -pbkdf2 = 1.3 -py = 1.4.26 -Pygments = 2.0.2 -pyramid = 1.6.1 -pyramid-exclog = 0.7 +psutil = 2.1.3 +pyprof2calltree = 1.3.2 +pyramid = 1.7 +pyramid-zcml = 1.0.0 pytest = 2.6.4 pytest-cov = 2.5.1 -python-coveralls = 2.9.1 pytz = 2014.10 -PyYAML = 3.11 -repoze.lru = 0.6 -requests = 2.7.0 -rfc6266 = 0.0.6 +pyzmq = 14.4.1 +requests = 2.10.0 schematics = 1.1.1 -sh = 1.11 +setuptools = 7.0 simplejson = 3.6.5 six = 1.9.0 -Sphinx = 1.3.1 sphinxcontrib-httpdomain = 1.4.0 -translationstring = 1.3 -tzlocal = 1.1.2 -venusian = 1.0 -waitress = 0.8.10 -WebOb = 1.5.1 -WebTest = 2.0.20 -zc.recipe.egg = 2.0.1 -zope.deprecation = 4.1.1 -zope.interface = 4.1.1 +tomako = 0.1.0 +tornado = 4.0.2 +transaction = 1.4.3 +tzlocal = 1.2.1 +zc.lockfile = 1.1.0 +zope.annotation = 4.2.0 +zope.authentication = 4.1.0 +zope.browser = 2.0.2 +zope.component = 4.1.0 +zope.event = 4.0.3 +zope.i18nmessageid = 4.0.3 +zope.location = 4.0.3 +zope.schema = 4.4.2 +zope.security = 4.0.1 +zope.securitypolicy = 3.7.0 +loggly-handler = 0.1.2 +requests-futures = 0.9.5 +SQLAlchemy = 1.0.9 +pysqlite = 2.8.2 +pyramid-exclog = 0.7 +Babel = 1.3 +netaddr = 0.7.13 +oslo.config = 1.6.0 +oslo.context = 0.1.0 +oslo.i18n = 1.3.1 +pbr = 0.10.7 +request-id-middleware = 0.1.2 +stevedore = 1.2.0 +argparse = 1.3.0 +oslo.middleware = 0.4.0 +pip = 6.0.7 +rfc6266 = 0.0.6 +LEPL = 5.1.3 +z3c.recipe.usercrontab = 1.1 +awscli = 1.7.12 +bcdoc = 0.13.0 +botocore = 0.93.0 +colorama = 0.3.3 +python-dateutil = 2.4.0 +rsa = 3.1.4 +pbkdf2 = 1.3 +pycrypto = 2.6.1 +grequests = 0.2.0 +cffi = 1.4.1 +cryptography = 1.2.3 +idna = 2.0 +pyOpenSSL = 0.15.1 +enum34 = 1.0.4 +ipaddress = 1.0.14 +ndg-httpsclient = 0.4.0 +pycparser = 2.14 +pyasn1 = 0.1.8 +server-cookie-middleware = 0.2 +barbecue = 0.2 +unweb.recipe.uwsgi = 0.4 +alabaster = 0.7.6 +snowballstemmer = 1.2.0 +sphinx-rtd-theme = 0.1.9 +zc.sourcerelease = 0.4.0 +repoze.retry = 1.3 +funcsigs = 0.4 +http-parser = 0.8.3 +socketpool = 0.5.3 +PyYAML = 3.11 +munch = 2.0.4 +restkit = 4.2.2 +retrying = 1.3.3 +python-consul = 0.6.0 +LazyDB = 0.1.68 +openprocurement-client = 2.0.0 +libnacl = 1.4.5 +redis = 2.10.5 +sact.recipe.jinjatemplate = 1.3.0 +z3c.recipe.mkdir = 0.6 +openprocurement.circus.plugins = 1.0 +openprocurement.subscribers.serverid = 1.0 +esculator = 0.0.2 +python-coveralls = 2.9.1 +jmespath = 0.9.3 +isodate = 0.6.0