[tryton-debian-vcs] tryton-server branch upstream updated. upstream/3.4.1-1-g3c19fa8

Mathias Behrle tryton-debian-vcs at alioth.debian.org
Wed Feb 18 10:07:26 UTC 2015


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

commit 3c19fa84b1e217ac3d06b20aba1fbb649b264553
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Wed Feb 18 10:34:15 2015 +0100

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

diff --git a/CHANGELOG b/CHANGELOG
index 471defc..b1c26ec 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.4.2 - 2015-02-16
+* Bug fixes (see mercurial logs for details)
+
 Version 3.4.1 - 2014-12-03
 * Bug fixes (see mercurial logs for details)
 
diff --git a/COPYRIGHT b/COPYRIGHT
index 56848fa..16cc09a 100644
--- a/COPYRIGHT
+++ b/COPYRIGHT
@@ -1,7 +1,7 @@
 Copyright (C) 2004-2008 Tiny SPRL.
-Copyright (C) 2007-2014 Cédric Krier.
+Copyright (C) 2007-2015 Cédric Krier.
 Copyright (C) 2007-2013 Bertrand Chenal.
-Copyright (C) 2008-2014 B2CK SPRL.
+Copyright (C) 2008-2015 B2CK SPRL.
 Copyright (C) 2011 Openlabs Technologies & Consulting (P) Ltd.
 
 This program is free software: you can redistribute it and/or modify
diff --git a/PKG-INFO b/PKG-INFO
index efce51d..87e6093 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.4.1
+Version: 3.4.2
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond.egg-info/PKG-INFO b/trytond.egg-info/PKG-INFO
index efce51d..87e6093 100644
--- a/trytond.egg-info/PKG-INFO
+++ b/trytond.egg-info/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.1
 Name: trytond
-Version: 3.4.1
+Version: 3.4.2
 Summary: Tryton server
 Home-page: http://www.tryton.org/
 Author: Tryton
diff --git a/trytond/backend/mysql/database.py b/trytond/backend/mysql/database.py
index 96627d5..4960cfc 100644
--- a/trytond/backend/mysql/database.py
+++ b/trytond/backend/mysql/database.py
@@ -131,7 +131,7 @@ class Database(DatabaseInterface):
         if uri.hostname:
             cmd.append('--host=' + uri.hostname)
         if uri.port:
-            cmd.append('--port=' + uri.port)
+            cmd.append('--port=' + str(uri.port))
         if uri.password:
             cmd.append('--password=' + uri.password)
         cmd.append(database_name)
@@ -161,7 +161,7 @@ class Database(DatabaseInterface):
         if uri.hostname:
             cmd.append('--host=' + uri.hostname)
         if uri.port:
-            cmd.append('--port=' + uri.port)
+            cmd.append('--port=' + str(uri.port))
         if uri.password:
             cmd.append('--password=' + uri.password)
         cmd.append(database_name)
diff --git a/trytond/backend/postgresql/database.py b/trytond/backend/postgresql/database.py
index 8323557..8316f63 100644
--- a/trytond/backend/postgresql/database.py
+++ b/trytond/backend/postgresql/database.py
@@ -117,7 +117,7 @@ class Database(DatabaseInterface):
         if uri.hostname:
             cmd.append('--host=' + uri.hostname)
         if uri.port:
-            cmd.append('--port=' + uri.port)
+            cmd.append('--port=' + str(uri.port))
         if uri.password:
             # if db_password is set in configuration we should pass
             # an environment variable PGPASSWORD to our subprocess
@@ -151,7 +151,7 @@ class Database(DatabaseInterface):
         if uri.hostname:
             cmd.append('--host=' + uri.hostname)
         if uri.port:
-            cmd.append('--port=' + uri.port)
+            cmd.append('--port=' + str(uri.port))
         if uri.password:
             env['PGPASSWORD'] = uri.password
         cmd.append('--dbname=' + database_name)
@@ -192,7 +192,7 @@ class Database(DatabaseInterface):
         if res and abs(Database._list_cache_timestamp - now) < timeout:
             return res
         uri = parse_uri(config.get('database', 'uri'))
-        db_user = uri.username
+        db_user = uri.username or os.environ.get('PGUSER')
         if not db_user and os.name == 'posix':
             db_user = pwd.getpwuid(os.getuid())[0]
         if db_user:
@@ -356,7 +356,7 @@ class Cursor(CursorInterface):
         return self.cursor.fetchone()[0]
 
     def lock(self, table):
-        self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE' % table)
+        self.cursor.execute('LOCK "%s" IN EXCLUSIVE MODE NOWAIT' % table)
 
     def has_constraint(self):
         return True
diff --git a/trytond/backend/sqlite/database.py b/trytond/backend/sqlite/database.py
index 7ee1e2b..dd9b2c8 100644
--- a/trytond/backend/sqlite/database.py
+++ b/trytond/backend/sqlite/database.py
@@ -8,7 +8,6 @@ import datetime
 import time
 import sys
 import threading
-import math
 
 _FIX_ROWCOUNT = False
 try:
@@ -140,7 +139,12 @@ class SQLiteCharLength(Function):
 
 
 def sign(value):
-    return math.copysign(1, value)
+    if value > 0:
+        return 1
+    elif value < 0:
+        return -1
+    else:
+        return value
 
 
 MAPPING = {
diff --git a/trytond/ir/rule.py b/trytond/ir/rule.py
index 8491514..0c60fe7 100644
--- a/trytond/ir/rule.py
+++ b/trytond/ir/rule.py
@@ -150,7 +150,8 @@ class Rule(ModelSQL, ModelView):
 
     @staticmethod
     def _get_cache_key():
-        return (Transaction().user,)
+        # _datetime value will be added to the domain
+        return (Transaction().user, Transaction().context.get('_datetime'))
 
     @classmethod
     def domain_get(cls, model_name, mode='read'):
diff --git a/trytond/model/fields/one2one.py b/trytond/model/fields/one2one.py
index 7e29afd..4e6fe87 100644
--- a/trytond/model/fields/one2one.py
+++ b/trytond/model/fields/one2one.py
@@ -25,7 +25,7 @@ class One2One(Many2Many):
         '''
         res = super(One2One, self).get(ids, model, name, values=values)
         for i, vals in res.iteritems():
-            res[i] = vals[0] if vals else False
+            res[i] = vals[0] if vals else None
         return res
 
     def set(self, Model, name, ids, value, *args):
@@ -43,7 +43,6 @@ class One2One(Many2Many):
                     ])
             to_delete.extend(relations)
             if value:
-                to_create = []
                 for record_id in ids:
                     to_create.append({
                             self.origin: record_id,
diff --git a/trytond/model/modelsql.py b/trytond/model/modelsql.py
index 4f3cf43..2fc90bb 100644
--- a/trytond/model/modelsql.py
+++ b/trytond/model/modelsql.py
@@ -1081,30 +1081,34 @@ class ModelSQL(ModelStorage):
             return ifilter(lambda r: history_key(r) == ids_history[r['id']]
                 and r['id'] not in to_delete, rows)
 
-        rows = list(filter_history(rows))
-        keys = None
-        for data in islice(rows, 0, cache.size_limit):
-            if data['id'] in delete_records:
-                continue
-            if keys is None:
-                keys = data.keys()
-                for k in keys[:]:
-                    if k in ('_timestamp', '_datetime', '__id'):
-                        keys.remove(k)
-                        continue
-                    field = cls._fields[k]
-                    if not getattr(field, 'datetime_field', None):
-                        keys.remove(k)
-                        continue
-            for k in keys:
-                del data[k]
-            cache[cls.__name__].setdefault(data['id'], {}).update(data)
+        # Can not cache the history value if we are not sure to have fetch all
+        # the rows for each records
+        if (not (cls._history and transaction.context.get('_datetime'))
+                or len(rows) < cursor.IN_MAX):
+            rows = list(filter_history(rows))
+            keys = None
+            for data in islice(rows, 0, cache.size_limit):
+                if data['id'] in delete_records:
+                    continue
+                if keys is None:
+                    keys = data.keys()
+                    for k in keys[:]:
+                        if k in ('_timestamp', '_datetime', '__id'):
+                            keys.remove(k)
+                            continue
+                        field = cls._fields[k]
+                        if not getattr(field, 'datetime_field', None):
+                            keys.remove(k)
+                            continue
+                for k in keys:
+                    del data[k]
+                cache[cls.__name__].setdefault(data['id'], {}).update(data)
 
         if len(rows) >= cursor.IN_MAX:
             if (cls._history
                     and Transaction().context.get('_datetime')
                     and not query):
-                columns = columns[:2]
+                columns = columns[:3]
             else:
                 columns = columns[:1]
             cursor.execute(*table.select(*columns,
diff --git a/trytond/model/modelview.py b/trytond/model/modelview.py
index 643bcba..5d1950f 100644
--- a/trytond/model/modelview.py
+++ b/trytond/model/modelview.py
@@ -334,7 +334,8 @@ class ModelView(Model):
             fields_def.setdefault(field_children, {'name': field_children})
             if field_children in cls._fields:
                 field = cls._fields[field_children]
-                fields_def.setdefault(field.field, {'name': field.field})
+                if hasattr(field, 'field'):
+                    fields_def.setdefault(field.field, {'name': field.field})
 
         for field_name in fields_def.keys():
             if field_name in cls._fields:
diff --git a/trytond/protocols/dispatcher.py b/trytond/protocols/dispatcher.py
index 2ba1d10..05e3345 100644
--- a/trytond/protocols/dispatcher.py
+++ b/trytond/protocols/dispatcher.py
@@ -81,7 +81,7 @@ def dispatch(host, port, protocol, database_name, user, session, object_type,
             except Exception:
                 return False
         elif method == 'list':
-            if not config.get('database', 'list'):
+            if not config.getboolean('database', 'list'):
                 raise Exception('AccessDenied')
             with Transaction().start(None, 0, close=True) as transaction:
                 return transaction.database.list(transaction.cursor)
diff --git a/trytond/protocols/webdav.py b/trytond/protocols/webdav.py
index f820280..584a7c3 100644
--- a/trytond/protocols/webdav.py
+++ b/trytond/protocols/webdav.py
@@ -528,7 +528,8 @@ class WebDAVAuthRequestHandler(WebDAVServer.DAVRequestHandler):
         dbname = Transaction().cursor.database_name
         Transaction().stop()
         if dbname:
-            Cache.resets(dbname)
+            with Transaction().start(dbname, 0):
+                Cache.resets(dbname)
 
     def parse_request(self):
         if not BaseHTTPServer.BaseHTTPRequestHandler.parse_request(self):
@@ -581,7 +582,7 @@ class WebDAVAuthRequestHandler(WebDAVServer.DAVRequestHandler):
             if not user:
                 return None
 
-        Transaction().start(dbname, user, {
+        Transaction().start(dbname, user, context={
                 '_check_access': True,
                 })
         Cache.clean(dbname)
diff --git a/trytond/pyson.py b/trytond/pyson.py
index bab351c..28979fd 100644
--- a/trytond/pyson.py
+++ b/trytond/pyson.py
@@ -594,4 +594,5 @@ CONTEXT = {
     'Date': Date,
     'DateTime': DateTime,
     'Len': Len,
+    'Id': Id,
 }
diff --git a/trytond/server.py b/trytond/server.py
index a5df713..7cf414c 100644
--- a/trytond/server.py
+++ b/trytond/server.py
@@ -49,8 +49,8 @@ class TrytonServer(object):
         self.webdavd = []
         self.options = options
 
-        if time.tzname != ('UTC', 'UTC'):
-            self.logger.error('timezeone is not set to UTC')
+        if time.tzname[0] != 'UTC':
+            self.logger.error('timezone is not set to UTC')
 
     def run(self):
         "Run the server and never return"
diff --git a/trytond/version.py b/trytond/version.py
index ab5e25a..a9f38cc 100644
--- a/trytond/version.py
+++ b/trytond/version.py
@@ -1,6 +1,6 @@
 #This file is part of Tryton.  The COPYRIGHT file at the top level of
 #this repository contains the full copyright notices and license terms.
 PACKAGE = "trytond"
-VERSION = "3.4.1"
+VERSION = "3.4.2"
 LICENSE = "GPL-3"
 WEBSITE = "http://www.tryton.org/"
-- 
tryton-server



More information about the tryton-debian-vcs mailing list