[tryton-debian-vcs] tryton-modules-party-vcarddav branch upstream updated. upstream/2.8.0-1-gf9abbbf

git repository hosting tryton-debian-vcs at m9s.biz
Mon Nov 25 19:35:36 UTC 2013


The following commit has been merged in the upstream branch:
http://debian.tryton.org/gitweb/?p=packages/tryton-modules-party-vcarddav.git;a=commitdiff;h=upstream/2.8.0-1-gf9abbbf

commit f9abbbffb1ebb8ff1de225fbde0eaa60171bc48b
Author: Mathias Behrle <mathiasb at m9s.biz>
Date:   Sun Nov 24 17:27:24 2013 +0100

    Adding upstream version 3.0.0.

diff --git a/CHANGELOG b/CHANGELOG
index 7f34659..7d5a2bd 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,6 @@
+Version 3.0.0 - 2013-10-21
+* Bug fixes (see mercurial logs for details)
+
 Version 2.8.0 - 2013-04-22
 * Bug fixes (see mercurial logs for details)
 
diff --git a/INSTALL b/INSTALL
index 1a36e89..4ece669 100644
--- a/INSTALL
+++ b/INSTALL
@@ -9,6 +9,7 @@ Prerequisites
  * trytond_party (http://www.tryton.org/)
  * vobject 0.8.0 or later (http://vobject.skyhouseconsulting.com/)
  * pywebdav 0.9.8 or later (http://sourceforge.net/projects/pywebdav/)
+ * python-sql (http://code.google.com/p/python-sql/)
 
 Installation
 ------------
diff --git a/PKG-INFO b/PKG-INFO
index 0fc8a56..e02ee4f 100644
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond_party_vcarddav
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module for CardDAV
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_party_vcarddav
         ======================
         
@@ -61,6 +61,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/locale/es_ES.po b/locale/es_ES.po
index e1adc11..1ada398 100644
--- a/locale/es_ES.po
+++ b/locale/es_ES.po
@@ -5,7 +5,7 @@ msgstr "Content-Type: text/plain; charset=utf-8\n"
 msgctxt "error:ir.action.report:"
 msgid "Invalid email definition on report \"%s\"."
 msgstr ""
-"La definición de correo electrónico sobre el informe \"%s\", no es correcta."
+"La definición de correo electrónico sobre el informe \"%s\" no es correcta."
 
 msgctxt "error:party.party:"
 msgid "The UUID of the party must be unique."
diff --git a/locale/sl_SI.po b/locale/sl_SI.po
new file mode 100644
index 0000000..cb74981
--- /dev/null
+++ b/locale/sl_SI.po
@@ -0,0 +1,23 @@
+# 
+msgid ""
+msgstr "Content-Type: text/plain; charset=utf-8\n"
+
+msgctxt "error:party.party:"
+msgid "The UUID of the party must be unique."
+msgstr "UUID stranke mora biti edinstven."
+
+msgctxt "field:party.party,uuid:"
+msgid "UUID"
+msgstr "UUID"
+
+msgctxt "field:party.party,vcard:"
+msgid "VCard"
+msgstr "VCard"
+
+msgctxt "help:party.party,uuid:"
+msgid "Universally Unique Identifier"
+msgstr "Vsesplošno edinstven identifikator"
+
+msgctxt "model:ir.action,name:report_party_vcard"
+msgid "VCard"
+msgstr "VCard"
diff --git a/party.py b/party.py
index 63712b7..2a9e860 100644
--- a/party.py
+++ b/party.py
@@ -5,7 +5,7 @@ import vobject
 
 from trytond.model import fields
 from trytond.report import Report
-from trytond.backend import TableHandler, FIELDS
+from trytond import backend
 from trytond.transaction import Transaction
 from trytond.pool import Pool, PoolMeta
 
@@ -29,18 +29,21 @@ class Party:
 
     @classmethod
     def __register__(cls, module_name):
+        TableHandler = backend.get('TableHandler')
         cursor = Transaction().cursor
         table = TableHandler(cursor, cls, module_name)
+        sql_table = cls.__table__()
 
         if not table.column_exist('uuid'):
             table.add_raw_column('uuid',
-                FIELDS[cls.uuid._type].sql_type(cls.uuid),
-                FIELDS[cls.uuid._type].sql_format, None, None)
-            cursor.execute('SELECT id FROM "' + cls._table + '"')
+                cls.uuid.sql_type(),
+                cls.uuid.sql_format, None, None)
+            cursor.execute(*sql_table.select(sql_table.id))
             for id, in cursor.fetchall():
-                cursor.execute('UPDATE "' + cls._table + '" '
-                    'SET "uuid" = %s WHERE id = %s',
-                    (cls.default_uuid(), id))
+                cursor.execute(*sql_table.update(
+                        columns=[sql_table.uuid],
+                        values=[cls.default_uuid()],
+                        where=sql_table.id == id))
         super(Party, cls).__register__(module_name)
 
     @staticmethod
diff --git a/setup.py b/setup.py
index b853d85..f188b3b 100644
--- a/setup.py
+++ b/setup.py
@@ -21,7 +21,7 @@ major_version, minor_version, _ = info.get('version', '0.0.1').split('.', 2)
 major_version = int(major_version)
 minor_version = int(minor_version)
 
-requires = ['vobject >= 0.8.0', 'PyWebDAV >= 0.9.8']
+requires = ['vobject >= 0.8.0', 'PyWebDAV >= 0.9.8', 'python-sql']
 for dep in info.get('depends', []):
     if not re.match(r'(ir|res|webdav)(\W|$)', dep):
         requires.append('trytond_%s >= %s.%s, < %s.%s' %
@@ -63,6 +63,7 @@ setup(name='trytond_party_vcarddav',
         'Natural Language :: French',
         'Natural Language :: German',
         'Natural Language :: Russian',
+        'Natural Language :: Slovenian',
         'Natural Language :: Spanish',
         'Operating System :: OS Independent',
         'Programming Language :: Python :: 2.6',
diff --git a/tryton.cfg b/tryton.cfg
index 273c8c4..802b318 100644
--- a/tryton.cfg
+++ b/tryton.cfg
@@ -1,5 +1,5 @@
 [tryton]
-version=2.8.0
+version=3.0.0
 depends:
     ir
     party
diff --git a/trytond_party_vcarddav.egg-info/PKG-INFO b/trytond_party_vcarddav.egg-info/PKG-INFO
index 7789dea..b08822f 100644
--- a/trytond_party_vcarddav.egg-info/PKG-INFO
+++ b/trytond_party_vcarddav.egg-info/PKG-INFO
@@ -1,12 +1,12 @@
 Metadata-Version: 1.1
 Name: trytond-party-vcarddav
-Version: 2.8.0
+Version: 3.0.0
 Summary: Tryton module for CardDAV
 Home-page: http://www.tryton.org/
 Author: Tryton
 Author-email: UNKNOWN
 License: GPL-3
-Download-URL: http://downloads.tryton.org/2.8/
+Download-URL: http://downloads.tryton.org/3.0/
 Description: trytond_party_vcarddav
         ======================
         
@@ -61,6 +61,7 @@ Classifier: Natural Language :: English
 Classifier: Natural Language :: French
 Classifier: Natural Language :: German
 Classifier: Natural Language :: Russian
+Classifier: Natural Language :: Slovenian
 Classifier: Natural Language :: Spanish
 Classifier: Operating System :: OS Independent
 Classifier: Programming Language :: Python :: 2.6
diff --git a/trytond_party_vcarddav.egg-info/SOURCES.txt b/trytond_party_vcarddav.egg-info/SOURCES.txt
index 6f88556..61ff6d3 100644
--- a/trytond_party_vcarddav.egg-info/SOURCES.txt
+++ b/trytond_party_vcarddav.egg-info/SOURCES.txt
@@ -22,6 +22,7 @@ locale/es_ES.po
 locale/fr_FR.po
 locale/nl_NL.po
 locale/ru_RU.po
+locale/sl_SI.po
 trytond_party_vcarddav.egg-info/PKG-INFO
 trytond_party_vcarddav.egg-info/SOURCES.txt
 trytond_party_vcarddav.egg-info/dependency_links.txt
diff --git a/trytond_party_vcarddav.egg-info/requires.txt b/trytond_party_vcarddav.egg-info/requires.txt
index 583404b..085c9e7 100644
--- a/trytond_party_vcarddav.egg-info/requires.txt
+++ b/trytond_party_vcarddav.egg-info/requires.txt
@@ -1,4 +1,5 @@
 vobject >= 0.8.0
 PyWebDAV >= 0.9.8
-trytond_party >= 2.8, < 2.9
-trytond >= 2.8, < 2.9
\ No newline at end of file
+python-sql
+trytond_party >= 3.0, < 3.1
+trytond >= 3.0, < 3.1
\ No newline at end of file
diff --git a/webdav.py b/webdav.py
index 9749c7a..fdab179 100644
--- a/webdav.py
+++ b/webdav.py
@@ -2,6 +2,10 @@
 #this repository contains the full copyright notices and license terms.
 from pywebdav.lib.errors import DAV_NotFound, DAV_Forbidden
 from pywebdav.lib.constants import COLLECTION, OBJECT
+from sql.functions import Extract
+from sql.aggregate import Max
+from sql.conditionals import Coalesce
+
 from trytond.tools import reduce_ids
 from trytond.transaction import Transaction
 from trytond.cache import Cache
@@ -170,6 +174,7 @@ class Collection:
     @classmethod
     def get_creationdate(cls, uri, cache=None):
         Party = Pool().get('party.party')
+        party = Party.__table__()
         party_id = cls.vcard(uri)
 
         cursor = Transaction().cursor
@@ -189,11 +194,10 @@ class Collection:
             res = None
             for i in range(0, len(ids), cursor.IN_MAX):
                 sub_ids = ids[i:i + cursor.IN_MAX]
-                red_sql, red_ids = reduce_ids('id', sub_ids)
-                cursor.execute('SELECT id, '
-                        'EXTRACT(epoch FROM create_date) '
-                    'FROM "' + Party._table + '" '
-                    'WHERE ' + red_sql, red_ids)
+                red_sql = reduce_ids(party.id, sub_ids)
+                cursor.execute(*party.select(party.id,
+                        Extract('EPOCH', party.create_date),
+                        where=red_sql))
                 for party_id2, date in cursor.fetchall():
                     if party_id2 == party_id:
                         res = date
@@ -210,6 +214,9 @@ class Collection:
         Party = pool.get('party.party')
         Address = pool.get('party.address')
         ContactMechanism = pool.get('party.contact_mechanism')
+        party = Party.__table__()
+        address = Address.__table__()
+        contact_mechanism = ContactMechanism.__table__()
 
         cursor = Transaction().cursor
 
@@ -227,21 +234,21 @@ class Collection:
             res = None
             for i in range(0, len(ids), cursor.IN_MAX):
                 sub_ids = ids[i:i + cursor.IN_MAX]
-                red_sql, red_ids = reduce_ids('p.id', sub_ids)
-                cursor.execute('SELECT p.id, '
-                        'MAX(EXTRACT(epoch FROM '
-                            'COALESCE(p.write_date, p.create_date))), '
-                        'MAX(EXTRACT(epoch FROM '
-                            'COALESCE(a.write_date, a.create_date))), '
-                        'MAX(EXTRACT(epoch FROM '
-                            'COALESCE(c.write_date, c.create_date))) '
-                    'FROM "' + Party._table + '" p '
-                    'LEFT JOIN "' + Address._table + '" a '
-                        'ON p.id = a.party '
-                    'LEFT JOIN "' + ContactMechanism._table + '" c '
-                        'ON p.id = c.party '
-                    'WHERE ' + red_sql + ' '
-                    'GROUP BY p.id', red_ids)
+                red_sql = reduce_ids(party.id, sub_ids)
+                cursor.execute(*party.join(address, 'LEFT',
+                        condition=party.id == address.party
+                        ).join(contact_mechanism, 'LEFT',
+                        condition=party.id == contact_mechanism.party
+                        ).select(party.id,
+                        Max(Extract('EPOCH', Coalesce(party.write_date,
+                                    party.create_date))),
+                        Max(Extract('EPOCH', Coalesce(address.write_date,
+                                    address.create_date))),
+                        Max(Extract('EPOCH', Coalesce(
+                                    contact_mechanism.write_date,
+                                    contact_mechanism.create_date))),
+                        where=red_sql,
+                        group_by=party.id))
                 for party_id2, date_p, date_a, date_c in cursor.fetchall():
                     date = max(date_p, date_a, date_c)
                     if party_id2 == party_id:
-- 
tryton-modules-party-vcarddav



More information about the tryton-debian-vcs mailing list