[tryton-debian-vcs] tryton-server branch upstream-4.2 updated. upstream/4.2.3-1-g31b16b2
Mathias Behrle
tryton-debian-vcs at alioth.debian.org
Sun Jun 11 22:39:18 UTC 2017
The following commit has been merged in the upstream-4.2 branch:
https://alioth.debian.org/plugins/scmgit/cgi-bin/gitweb.cgi/?p=tryton/tryton-server.git;a=commitdiff;h=upstream/4.2.3-1-g31b16b2
commit 31b16b27b60a71c0176d998ede2b6217089b2740
Author: Mathias Behrle <mathiasb at m9s.biz>
Date: Sun Jun 11 22:28:52 2017 +0200
Adding upstream version 4.2.4.
Signed-off-by: Mathias Behrle <mathiasb at m9s.biz>
diff --git a/CHANGELOG b/CHANGELOG
index 1d39cc9..8b2f67c 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 4.2.4 - 2017-06-05
+* Bug fixes (see mercurial logs for details)
+
Version 4.2.3 - 2017-04-03
* Bug fixes (see mercurial logs for details)
* Sanitize path in file_open against suffix (CVE-2017-0360)
diff --git a/PKG-INFO b/PKG-INFO
index cfd1c8f..b197080 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 4.2.3
+Version: 4.2.4
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
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/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index cfd1c8f..b197080 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: trytond
-Version: 4.2.3
+Version: 4.2.4
Summary: Tryton server
Home-page: http://www.tryton.org/
Author: Tryton
diff --git a/trytond/__init__.py b/trytond/__init__.py
index 7a81fd1..80146bb 100644
--- a/trytond/__init__.py
+++ b/trytond/__init__.py
@@ -5,7 +5,7 @@ import time
import logging
from email import charset
-__version__ = "4.2.3"
+__version__ = "4.2.4"
logger = logging.getLogger(__name__)
os.environ['TZ'] = 'UTC'
diff --git a/trytond/backend/sqlite/database.py b/trytond/backend/sqlite/database.py
index 7f45a47..c0efcd5 100644
--- a/trytond/backend/sqlite/database.py
+++ b/trytond/backend/sqlite/database.py
@@ -22,7 +22,7 @@ except ImportError:
from sqlite3 import OperationalError as DatabaseOperationalError
from sql import Flavor, Table
from sql.functions import (Function, Extract, Position, Substring,
- Overlay, CharLength, CurrentTimestamp)
+ Overlay, CharLength, CurrentTimestamp, Trim)
__all__ = ['Database', 'DatabaseIntegrityError', 'DatabaseOperationalError']
@@ -142,6 +142,27 @@ class SQLiteCurrentTimestamp(Function):
_function = 'NOW' # More precise
+class SQLiteTrim(Trim):
+
+ def __str__(self):
+ flavor = Flavor.get()
+ param = flavor.param
+
+ function = {
+ 'BOTH': 'TRIM',
+ 'LEADING': 'LTRIM',
+ 'TRAILING': 'RTRIM',
+ }[self.position]
+
+ def format(arg):
+ if isinstance(arg, basestring):
+ return param
+ else:
+ return str(arg)
+ return function + '(%s, %s)' % (
+ format(self.string), format(self.characters))
+
+
def sign(value):
if value > 0:
return 1
@@ -174,6 +195,7 @@ MAPPING = {
Overlay: SQLiteOverlay,
CharLength: SQLiteCharLength,
CurrentTimestamp: SQLiteCurrentTimestamp,
+ Trim: SQLiteTrim,
}
diff --git a/trytond/ir/translation.py b/trytond/ir/translation.py
index 952bdaf..5c5aa55 100644
--- a/trytond/ir/translation.py
+++ b/trytond/ir/translation.py
@@ -433,7 +433,7 @@ class Translation(ModelSQL, ModelView):
if not Transaction().context.get(
'fuzzy_translation', False):
for obj_id in ids:
- trans = cls._translation_cache.get((lang, ttype, name, obj_id),
+ trans = cls._translation_cache.get((name, ttype, lang, obj_id),
-1)
if trans != -1:
translations[obj_id] = trans
@@ -474,7 +474,7 @@ class Translation(ModelSQL, ModelView):
value = translations.setdefault(res_id)
# Don't store fuzzy translation in cache
if not Transaction().context.get('fuzzy_translation', False):
- cls._translation_cache.set((lang, ttype, name, res_id), value)
+ cls._translation_cache.set((name, ttype, lang, res_id), value)
return translations
@classmethod
@@ -636,7 +636,7 @@ class Translation(ModelSQL, ModelView):
lang = unicode(lang)
if source is not None:
source = unicode(source)
- trans = cls._translation_cache.get((lang, ttype, name, source), -1)
+ trans = cls._translation_cache.get((name, ttype, lang, source), -1)
if trans != -1:
res[(name, ttype, lang, source)] = trans
else:
diff --git a/trytond/model/fields/field.py b/trytond/model/fields/field.py
index 0f07729..563e7d8 100644
--- a/trytond/model/fields/field.py
+++ b/trytond/model/fields/field.py
@@ -65,6 +65,21 @@ def size_validate(value):
'size must return integer'
+def _set_value(record, field):
+ try:
+ field, nested = field.split('.', 1)
+ except ValueError:
+ nested = None
+ if field.startswith('_parent_'):
+ field = field[8:] # Strip '_parent_'
+ if not hasattr(record, field):
+ setattr(record, field, None)
+ elif nested:
+ parent = getattr(record, field)
+ if parent:
+ _set_value(parent, nested)
+
+
def depends(*fields, **kwargs):
methods = kwargs.pop('methods', None)
assert not kwargs
@@ -82,11 +97,7 @@ def depends(*fields, **kwargs):
@wraps(func)
def wrapper(self, *args, **kwargs):
for field in fields:
- field = field.split('.')[0]
- if field.startswith('_parent_'):
- field = field[8:] # Strip '_parent_'
- if not hasattr(self, field):
- setattr(self, field, None)
+ _set_value(self, field)
return func(self, *args, **kwargs)
return wrapper
return decorator
diff --git a/trytond/model/fields/many2one.py b/trytond/model/fields/many2one.py
index f5bfaed..2a697c6 100644
--- a/trytond/model/fields/many2one.py
+++ b/trytond/model/fields/many2one.py
@@ -1,6 +1,8 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
-from sql import Query, Expression, Literal
+from sql import Query, Expression, Literal, Column
+from sql.aggregate import Max
+from sql.conditionals import Coalesce
from sql.operators import Or
from .field import Field, SQLType
@@ -248,13 +250,27 @@ class Many2One(Field):
Target = self.get_target()
table, _ = tables[None]
target_tables = tables.get(self.name)
+ context = Transaction().context
if target_tables is None:
- if Target._history and Transaction().context.get('_datetime'):
+ if Target._history and context.get('_datetime'):
target = Target.__table_history__()
+ target_history = Target.__table_history__()
+ history_condition = Column(target, '__id').in_(
+ target_history.select(
+ Max(Column(target_history, '__id')),
+ where=Coalesce(
+ target_history.write_date,
+ target_history.create_date)
+ <= context['_datetime'],
+ group_by=target_history.id))
else:
target = Target.__table__()
+ history_condition = None
+ condition = target.id == self.sql_column(table)
+ if history_condition:
+ condition &= history_condition
target_tables = {
- None: (target, target.id == self.sql_column(table)),
+ None: (target, condition),
}
tables[self.name] = target_tables
return target_tables
--
tryton-server
More information about the tryton-debian-vcs
mailing list