[tryton-debian-vcs] tryton-proteus branch upstream updated. upstream/4.4.0-1-g90a5150

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Fri Nov 10 12:24:43 UTC 2017


The following commit has been merged in the upstream branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-proteus.git;a=commitdiff;h=upstream/4.4.0-1-g90a5150

commit 90a5150b23ef8feaacc794c99ca5dba63e4e1d6a
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Mon Nov 6 14:41:33 2017 +0100

    Adding upstream version 4.6.0.
    
    Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>

diff --git a/.drone.yml b/.drone.yml
new file mode 100644
index 0000000..48230a2
--- /dev/null
+++ b/.drone.yml
@@ -0,0 +1,23 @@
+clone:
+    hg:
+        image: plugins/hg
+
+pipeline:
+    tox:
+        image: ${IMAGE}
+        commands:
+            - pip install tox pydot
+            - tox -e "${TOXENV}"
+        volumes:
+             - cache:/root/.cache
+
+matrix:
+    include:
+        - IMAGE: python:2.7
+          TOXENV: py27
+        - IMAGE: python:3.4
+          TOXENV: py34
+        - IMAGE: python:3.5
+          TOXENV: py35
+        - IMAGE: python:3.6
+          TOXENV: py36
diff --git a/CHANGELOG b/CHANGELOG
index 1826ea4..7428907 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,9 @@
+Version 4.6.0 - 2017-10-30
+* Bug fixes (see mercurial logs for details)
+* Add set_sequence method to ModelList
+* Add __int__ to Model
+* Allow to use keyword arguments with trytond configuration
+
 Version 4.4.0 - 2017-05-01
 * Bug fixes (see mercurial logs for details)
 
diff --git a/PKG-INFO b/PKG-INFO
index 7d91fdb..06ef427 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: proteus
-Version: 4.4.0
+Version: 4.6.0
 Summary: Library to access Tryton server as a client
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: LGPL-3
-Download-URL: http://downloads.tryton.org/4.4/
+Download-URL: http://downloads.tryton.org/4.6/
 Description: proteus
         =======
         
@@ -115,6 +115,28 @@ Description: proteus
         
             >>> type_, data, print_, name = label.execute([party], {})
         
+        Sorting addresses and register order
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        
+        Addresses are ordered by sequence which means they can be stored following a
+        specific order. The `set_sequence` method stores the current order.
+        
+            >>> address = party.addresses.new(zip='69')
+            >>> party.save()
+            >>> address = party.addresses.new(zip='23')
+            >>> party.save()
+        
+        Now changing the order.
+        
+            >>> reversed_addresses = list(reversed(party.addresses))
+            >>> while party.addresses:
+            ...     _ = party.addresses.pop()
+            >>> party.addresses.extend(reversed_addresses)
+            >>> party.addresses.set_sequence()
+            >>> party.save()
+            >>> party.addresses == reversed_addresses
+            True
+        
         Support
         -------
         
@@ -152,9 +174,9 @@ Classifier: Intended Audience :: Legal Industry
 Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/README b/README
index 91ea807..39b1222 100644
--- a/README
+++ b/README
@@ -106,6 +106,28 @@ The report is executed with a list of records and some extra data.
 
     >>> type_, data, print_, name = label.execute([party], {})
 
+Sorting addresses and register order
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Addresses are ordered by sequence which means they can be stored following a
+specific order. The `set_sequence` method stores the current order.
+
+    >>> address = party.addresses.new(zip='69')
+    >>> party.save()
+    >>> address = party.addresses.new(zip='23')
+    >>> party.save()
+
+Now changing the order.
+
+    >>> reversed_addresses = list(reversed(party.addresses))
+    >>> while party.addresses:
+    ...     _ = party.addresses.pop()
+    >>> party.addresses.extend(reversed_addresses)
+    >>> party.addresses.set_sequence()
+    >>> party.save()
+    >>> party.addresses == reversed_addresses
+    True
+
 Support
 -------
 
diff --git a/proteus.egg-info/PKG-INFO b/proteus.egg-info/PKG-INFO
index 7d91fdb..06ef427 100644
--- a/proteus.egg-info/PKG-INFO
+++ b/proteus.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: proteus
-Version: 4.4.0
+Version: 4.6.0
 Summary: Library to access Tryton server as a client
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: issue_tracker at tryton.org
 License: LGPL-3
-Download-URL: http://downloads.tryton.org/4.4/
+Download-URL: http://downloads.tryton.org/4.6/
 Description: proteus
         =======
         
@@ -115,6 +115,28 @@ Description: proteus
         
             >>> type_, data, print_, name = label.execute([party], {})
         
+        Sorting addresses and register order
+        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+        
+        Addresses are ordered by sequence which means they can be stored following a
+        specific order. The `set_sequence` method stores the current order.
+        
+            >>> address = party.addresses.new(zip='69')
+            >>> party.save()
+            >>> address = party.addresses.new(zip='23')
+            >>> party.save()
+        
+        Now changing the order.
+        
+            >>> reversed_addresses = list(reversed(party.addresses))
+            >>> while party.addresses:
+            ...     _ = party.addresses.pop()
+            >>> party.addresses.extend(reversed_addresses)
+            >>> party.addresses.set_sequence()
+            >>> party.save()
+            >>> party.addresses == reversed_addresses
+            True
+        
         Support
         -------
         
@@ -152,9 +174,9 @@ Classifier: Intended Audience :: Legal Industry
 Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.7
-Classifier: Programming Language :: Python :: 3.3
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
+Classifier: Programming Language :: Python :: 3.6
 Classifier: Programming Language :: Python :: Implementation :: CPython
 Classifier: Programming Language :: Python :: Implementation :: PyPy
 Classifier: Topic :: Office/Business
diff --git a/proteus.egg-info/SOURCES.txt b/proteus.egg-info/SOURCES.txt
index b19dc88..bf445ef 100644
--- a/proteus.egg-info/SOURCES.txt
+++ b/proteus.egg-info/SOURCES.txt
@@ -1,3 +1,5 @@
+.drone.yml
+.hgtags
 CHANGELOG
 COPYRIGHT
 INSTALL
@@ -5,6 +7,7 @@ LICENSE
 MANIFEST.in
 README
 setup.py
+tox.ini
 proteus/__init__.py
 proteus/config.py
 proteus/pyson.py
diff --git a/proteus.egg-info/requires.txt b/proteus.egg-info/requires.txt
index 6405c2a..9f13c93 100644
--- a/proteus.egg-info/requires.txt
+++ b/proteus.egg-info/requires.txt
@@ -4,4 +4,4 @@ python-dateutil
 cdecimal
 
 [trytond]
-trytond >= 4.4, < 4.5
+trytond >= 4.6, < 4.7
diff --git a/proteus/__init__.py b/proteus/__init__.py
index 8dd575e..fa64bf7 100644
--- a/proteus/__init__.py
+++ b/proteus/__init__.py
@@ -3,8 +3,6 @@
 '''
 A library to access Tryton's models like a client.
 '''
-__version__ = "4.4.0"
-__all__ = ['Model', 'Wizard', 'Report']
 import sys
 try:
     import cdecimal
@@ -21,6 +19,9 @@ from decimal import Decimal
 
 import proteus.config
 
+__version__ = "4.6.0"
+__all__ = ['Model', 'Wizard', 'Report']
+
 _MODELS = threading.local()
 
 
@@ -545,6 +546,8 @@ class ModelList(list):
                 definition = record._fields[self.parent_name]
                 if definition['type'] in ('many2one', 'reference'):
                     setattr(record, self.parent_name, self.parent)
+        self.record_removed.difference_update(records)
+        self.record_deleted.difference_update(records)
 
     def append(self, record):
         self.__check([record])
@@ -617,6 +620,36 @@ class ModelList(list):
         with Relation._config.set_context(self._get_context()):
             return Relation.find(new_domain, offset, limit, order)
 
+    def set_sequence(self, field='sequence'):
+        changed = False
+        prev = None
+        for record in self:
+            if prev:
+                index = getattr(prev, field)
+            else:
+                index = None
+            update = False
+            value = getattr(record, field)
+            if value is None:
+                if index:
+                    update = True
+                elif prev and record.id >= 0:
+                    update = record.id < prev.id
+            if value == index:
+                if prev and record.id >= 0:
+                    update = record.id < prev.id
+            elif value <= (index or 0):
+                update = True
+            if update:
+                if index is None:
+                    index = 0
+                index += 1
+                setattr(record, field, index)
+                changed = record
+            prev = record
+        if changed:
+            self._changed()
+
 
 class Model(object):
     'Model class for Tryton records'
@@ -710,6 +743,9 @@ class Model(object):
     def __hash__(self):
         return hash(self.__class__.__name__) ^ hash(self.id)
 
+    def __int__(self):
+        return self.id
+
     @property
     def id(self):
         'The unique ID'
diff --git a/proteus/config.py b/proteus/config.py
index 4f69e9b..63d9ef8 100644
--- a/proteus/config.py
+++ b/proteus/config.py
@@ -152,7 +152,7 @@ class _TrytondMethod(object):
         self._object = model
         self._config = config
 
-    def __call__(self, *args):
+    def __call__(self, *args, **kwargs):
         from trytond.transaction import Transaction
         from trytond.rpc import RPC
 
@@ -166,7 +166,7 @@ class _TrytondMethod(object):
         with Transaction().start(self._config.database_name,
                 self._config.user, readonly=rpc.readonly) as transaction:
             args, kwargs, transaction.context, transaction.timestamp = \
-                rpc.convert(self._object, *args)
+                rpc.convert(self._object, *args, **kwargs)
             meth = getattr(self._object, self._name)
             if not hasattr(meth, 'im_self') or meth.im_self:
                 result = rpc.result(meth(*args, **kwargs))
diff --git a/proteus/tests/test_config.py b/proteus/tests/test_config.py
index d6420a7..9e1d436 100644
--- a/proteus/tests/test_config.py
+++ b/proteus/tests/test_config.py
@@ -13,6 +13,13 @@ class TestConfig(ProteusTestCase):
                 config.context)[0]
         self.assert_(user_id == config.user)
 
+    def test_proxy_keyword(self):
+        config = proteus.config.get_config()
+        user_proxy = config.get_proxy('res.user')
+        user_id, = user_proxy.search(
+            [('login', '=', 'admin')], limit=1, context=config.context)
+        self.assert_(user_id == config.user)
+
     def test_proxy_methods(self):
         config = proteus.config.get_config()
         self.assert_('search' in config.get_proxy_methods('res.user'))
diff --git a/proteus/tests/test_model.py b/proteus/tests/test_model.py
index 1c3d1df..e9781fc 100644
--- a/proteus/tests/test_model.py
+++ b/proteus/tests/test_model.py
@@ -19,6 +19,11 @@ class TestModel(ProteusTestCase):
         User = Model.get('res.user')
         self.assert_(len(User.search([('login', '=', 'admin')], {})))
 
+    def test_int(self):
+        User = Model.get('res.user')
+        admin = User.find([('login', '=', 'admin')])[0]
+        self.assertEqual(int(admin), admin.id)
+
     def test_find(self):
         User = Model.get('res.user')
         admin = User.find([('login', '=', 'admin')])[0]
diff --git a/setup.cfg b/setup.cfg
index 861a9f5..8bfd5a1 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,5 +1,4 @@
 [egg_info]
 tag_build = 
 tag_date = 0
-tag_svn_revision = 0
 
diff --git a/setup.py b/setup.py
index e17376c..d0cddc7 100644
--- a/setup.py
+++ b/setup.py
@@ -66,9 +66,9 @@ setup(name=name,
         'GNU Library or Lesser General Public License (LGPL)',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.7',
-        'Programming Language :: Python :: 3.3',
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
+        'Programming Language :: Python :: 3.6',
         'Programming Language :: Python :: Implementation :: CPython',
         'Programming Language :: Python :: Implementation :: PyPy',
         'Topic :: Office/Business',
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..f86d242
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,10 @@
+[tox]
+envlist = py27,py34,py35,py36,pypy
+
+[testenv]
+commands = {envpython} setup.py test
+deps =
+setenv =
+    TRYTOND_DATABASE_URI={env:TRYTOND_DATBASE_URI:sqlite://}
+    DB_NAME={env:DB_NAME::memory:}
+install_command = pip install --pre --find-links https://trydevpi.tryton.org/ {opts} {packages}
-- 
tryton-proteus



More information about the tryton-debian-vcs mailing list