[tryton-debian-vcs] tryton-proteus branch upstream-2.2 created. 843e76c5c68b6b88341cba5bdc84716ea385b107
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Wed Nov 27 17:13:10 UTC 2013
The following commit has been merged in the upstream-2.2 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-proteus.git;a=commitdiff;h=843e76c5c68b6b88341cba5bdc84716ea385b107
commit 843e76c5c68b6b88341cba5bdc84716ea385b107
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sat May 4 15:49:47 2013 +0200
Adding upstream version 2.2.4.
diff --git a/CHANGELOG b/CHANGELOG
index 79cc9ff..9f81994 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.2.4 - 2013-05-02
+* Bug fixes (see mercurial logs for details)
+
Version 2.2.3 - 2012-09-10
* Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index e792a2c..7e8c156 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2010-2012 Cédric Krier.
-Copyright (C) 2010-2012 B2CK SPRL.
+Copyright (C) 2010-2013 Cédric Krier.
+Copyright (C) 2010-2013 B2CK SPRL.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 8656034..ac50280 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: proteus
-Version: 2.2.3
+Version: 2.2.4
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus.egg-info/PKG-INFO b/proteus.egg-info/PKG-INFO
index 8656034..ac50280 100644
--- a/proteus.egg-info/PKG-INFO
+++ b/proteus.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.0
+Metadata-Version: 1.1
Name: proteus
-Version: 2.2.3
+Version: 2.2.4
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus/__init__.py b/proteus/__init__.py
index 3c23a8f..5792ac7 100644
--- a/proteus/__init__.py
+++ b/proteus/__init__.py
@@ -3,7 +3,7 @@
'''
A library to access Tryton's models like a client.
'''
-__version__ = "2.2.3"
+__version__ = "2.2.4"
__all__ = ['Model', 'Wizard']
from types import NoneType
import threading
@@ -521,6 +521,9 @@ class Model(object):
@classmethod
def get(cls, name, config=None):
'Get a class for the named Model'
+ if isinstance(name, unicode):
+ name = name.encode('utf-8')
+
class Spam(Model):
__metaclass__ = MetaModelFactory(name, config=config)()
return Spam
commit 64045876acbbd5f6f80df30f2a4c0b8fff09397f
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Tue Sep 11 19:24:38 2012 +0200
Adding upstream version 2.2.3.
diff --git a/CHANGELOG b/CHANGELOG
index 6c7f35f..79cc9ff 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.2.3 - 2012-09-10
+* Bug fixes (see mercurial logs for details)
+
Version 2.2.2 - 2012-05-07
* Bug fixes (see mercurial logs for details)
diff --git a/PKG-INFO b/PKG-INFO
index 76603a0..8656034 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.0
Name: proteus
-Version: 2.2.2
+Version: 2.2.3
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus.egg-info/PKG-INFO b/proteus.egg-info/PKG-INFO
index 76603a0..8656034 100644
--- a/proteus.egg-info/PKG-INFO
+++ b/proteus.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.0
Name: proteus
-Version: 2.2.2
+Version: 2.2.3
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus/__init__.py b/proteus/__init__.py
index 24e5ac5..3c23a8f 100644
--- a/proteus/__init__.py
+++ b/proteus/__init__.py
@@ -3,14 +3,13 @@
'''
A library to access Tryton's models like a client.
'''
-__version__ = "2.2.2"
+__version__ = "2.2.3"
__all__ = ['Model', 'Wizard']
from types import NoneType
import threading
import datetime
from decimal import Decimal
import proteus.config
-from proteus.pyson import PYSONDecoder
_MODELS = threading.local()
@@ -171,7 +170,8 @@ class Many2OneDescriptor(FieldDescriptor):
value = relation(value)
elif not value:
value = None
- instance._values[self.name] = value
+ if self.name in instance._values:
+ instance._values[self.name] = value
return value
def __set__(self, instance, value):
@@ -580,7 +580,7 @@ class Model(object):
'Save the record'
context = self._config.context
if self.id < 0:
- values = self._get_values(fields=self._changed)
+ values = self._get_values()
self.__id = self._proxy.create(values, context)
else:
if not self._changed:
@@ -730,6 +730,8 @@ class Model(object):
def _on_change(self, name):
'Call on_change for field'
+ # Import locally to not break installation
+ from proteus.pyson import PYSONDecoder
definition = self._fields[name]
if definition.get('on_change'):
if isinstance(definition['on_change'], basestring):
commit 14c068f2d7b8a45185b6fafcff30382ac2768514
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Wed May 9 11:47:29 2012 +0200
Adding upstream version 2.2.2.
diff --git a/CHANGELOG b/CHANGELOG
index ff71820..6c7f35f 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 2.2.2 - 2012-05-07
+* Bug fixes (see mercurial logs for details)
+
Version 2.2.1 - 2011-12-26
* Bug fixes (see mercurial logs for details)
diff --git a/COPYRIGHT b/COPYRIGHT
index de261a6..e792a2c 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,5 +1,5 @@
-Copyright (C) 2010-2011 Cédric Krier.
-Copyright (C) 2010-2011 B2CK SPRL.
+Copyright (C) 2010-2012 Cédric Krier.
+Copyright (C) 2010-2012 B2CK SPRL.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/PKG-INFO b/PKG-INFO
index 5737c16..76603a0 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: proteus
-Version: 2.2.1
+Version: 2.2.2
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus.egg-info/PKG-INFO b/proteus.egg-info/PKG-INFO
index 5737c16..76603a0 100644
--- a/proteus.egg-info/PKG-INFO
+++ b/proteus.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: proteus
-Version: 2.2.1
+Version: 2.2.2
Summary: Library to access Tryton server as a client
Home-page: http://www.tryton.org/
Author: B2CK
diff --git a/proteus.egg-info/requires.txt b/proteus.egg-info/requires.txt
index 747ad85..c3bb918 100644
--- a/proteus.egg-info/requires.txt
+++ b/proteus.egg-info/requires.txt
@@ -1,4 +1,4 @@
-
+python-dateutil
[trytond]
trytond >= 2.2, < 2.3
\ No newline at end of file
diff --git a/proteus/__init__.py b/proteus/__init__.py
index f07cd72..24e5ac5 100644
--- a/proteus/__init__.py
+++ b/proteus/__init__.py
@@ -3,7 +3,7 @@
'''
A library to access Tryton's models like a client.
'''
-__version__ = "2.2.1"
+__version__ = "2.2.2"
__all__ = ['Model', 'Wizard']
from types import NoneType
import threading
@@ -486,7 +486,7 @@ class Model(object):
_config = None
_fields = None
- def __init__(self, id=None, **kwargs):
+ def __init__(self, id=None, _default=True, **kwargs):
super(Model, self).__init__()
if id:
assert not kwargs
@@ -498,7 +498,7 @@ class Model(object):
self._parent = None # store the parent record
self._parent_field_name = '' # store the field name in parent record
self._parent_name = '' # store the field name to parent record
- if self.id < 0:
+ if self.id < 0 and _default:
self._default_get()
for field_name, value in kwargs.iteritems():
@@ -691,11 +691,8 @@ class Model(object):
return res
def _on_change_set(self, field, value):
- if self._fields[field]['type'] in ('one2many', 'many2many'):
- if isinstance(value, (list, tuple)):
- self._values[field] = value
- self._changed.add(field)
- return
+ if (self._fields[field]['type'] in ('one2many', 'many2many')
+ and not isinstance(value, (list, tuple))):
to_remove = []
if value and value.get('remove'):
for record_id in value['remove']:
@@ -709,8 +706,10 @@ class Model(object):
for vals in value.get('add', []):
relation = Model.get(self._fields[field]['relation'],
self._config)
- record = relation()
+ record = relation(_default=False)
for i, j in vals.iteritems():
+ if '.' in i:
+ continue
record._values[i] = j
record._changed.add(i)
# append without signal
@@ -721,11 +720,13 @@ class Model(object):
for record in getattr(self, field):
if record.id == vals['id']:
for i, j in vals.iteritems():
+ if '.' in i:
+ continue
record._values[i] = j
record._changed.add(i)
else:
self._values[field] = value
- self._changed.add(field)
+ self._changed.add(field)
def _on_change(self, name):
'Call on_change for field'
diff --git a/proteus/pyson.py b/proteus/pyson.py
index 5eca3cb..45bcbaa 100644
--- a/proteus/pyson.py
+++ b/proteus/pyson.py
@@ -8,6 +8,7 @@ if sys.version_info < (2, 6):
else:
import json
import datetime
+from dateutil.relativedelta import relativedelta
class PYSON(object):
@@ -396,23 +397,14 @@ class Date(PYSON):
@staticmethod
def eval(dct, context):
- date = datetime.date.today()
- replace = {}
- for i, j in (('y', 'year'), ('M', 'month'), ('d', 'day')):
- if dct[i] is not None:
- replace[j] = dct[i]
- date = date.replace(**replace)
- if dct['dy']:
- year = date.year + dct['dy']
- date = date.replace(year=year)
- if dct['dM']:
- month = date.month + dct['dM']
- year = date.year + month / 12
- month = month % 12
- date = date.replace(year=year, month=month)
- if dct['dd']:
- date += datetime.timedelta(days=dct['dd'])
- return date
+ return datetime.date.today() + relativedelta(
+ year=dct['y'],
+ month=dct['M'],
+ day=dct['d'],
+ years=dct['dy'],
+ months=dct['dM'],
+ days=dct['dd'],
+ )
class DateTime(Date):
@@ -460,22 +452,23 @@ class DateTime(Date):
@staticmethod
def eval(dct, context):
- date = Date.eval(dct, context)
- datetime_ = datetime.datetime.combine(date,
- datetime.datetime.now().time())
- replace = {}
- for i, j in (('h', 'hour'), ('m', 'minute'), ('s', 'second'),
- ('ms', 'microsecond')):
- if dct[i] is not None:
- replace[j] = dct[i]
- datetime_ = datetime_.replace(**replace)
- delta = {}
- for i, j in (('dh', 'hours'), ('dm', 'minutes'), ('ds', 'seconds'),
- ('dms', 'microseconds')):
- if dct[i]:
- delta[j] = dct[i]
- datetime_ += datetime.timedelta(**delta)
- return datetime_
+ return datetime.datetime.now() + relativedelta(
+ year=dct['y'],
+ month=dct['M'],
+ day=dct['d'],
+ hour=dct['h'],
+ minute=dct['m'],
+ second=dct['s'],
+ microsecond=dct['ms'],
+ years=dct['dy'],
+ months=dct['dM'],
+ days=dct['dd'],
+ hours=dct['dh'],
+ minutes=dct['dm'],
+ seconds=dct['ds'],
+ microseconds=dct['dms'],
+ )
+
CONTEXT = {
'Eval': Eval,
diff --git a/setup.py b/setup.py
index 4d1e957..b9348d5 100644
--- a/setup.py
+++ b/setup.py
@@ -36,6 +36,9 @@ setup(name='proteus',
'Topic :: Office/Business',
],
license='LGPL-3',
+ install_requires=[
+ "python-dateutil",
+ ],
extras_require={
'trytond': ['trytond >= %s.%s, < %s.%s' %
(major_version, minor_version, major_version, minor_version + 1)],
--
tryton-proteus
More information about the tryton-debian-vcs
mailing list