[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, debian, updated. upstream/0.9.5.5-717-g0f98819

Sebastian Krzyszkowiak seba.dos1 at gmail.com
Sat Aug 6 08:17:31 UTC 2011


The following commit has been merged in the debian branch:
commit 017926ff44f61b981e0568223913e2db0e51f2d5
Author: Sebastian Krzyszkowiak <seba.dos1 at gmail.com>
Date:   Sun Jul 19 18:27:18 2009 +0200

    opimd: SQLite-*: support multiple fields with the same name

diff --git a/framework/subsystems/opimd/pimb_sim_messages_fso.py b/framework/subsystems/opimd/pimb_sim_messages_fso.py
index 8d267ef..f217bfd 100644
--- a/framework/subsystems/opimd/pimb_sim_messages_fso.py
+++ b/framework/subsystems/opimd/pimb_sim_messages_fso.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 #
 #   Openmoko PIM Daemon
 #   SIM-Messages Backend Plugin for FSO
diff --git a/framework/subsystems/opimd/pimb_sqlite_calls.py b/framework/subsystems/opimd/pimb_sqlite_calls.py
index d108c41..c2ff113 100644
--- a/framework/subsystems/opimd/pimb_sqlite_calls.py
+++ b/framework/subsystems/opimd/pimb_sqlite_calls.py
@@ -30,6 +30,8 @@ import sqlite3
 import logging
 logger = logging.getLogger('opimd')
 
+from dbus import Array
+
 from domain_manager import DomainManager
 from backend_manager import BackendManager, Backend
 from backend_manager import PIMB_CAN_ADD_ENTRY, PIMB_CAN_DEL_ENTRY, PIMB_CAN_UPD_ENTRY, PIMB_CAN_UPD_ENTRY_WITH_NEW_FIELD
@@ -132,7 +134,13 @@ class SQLiteCallBackend(Backend):
             try:
                 cur.execute('SELECT Field, Value FROM call_values WHERE callId=?',(line[0],))
                 for pair in cur:
-                    entry[pair[0]]=pair[1]
+                    if entry.has_key(pair[0]):
+                        if type(entry[pair[0]]) == list:
+                            entry[pair[0]].append(pair[1])
+                        else:
+                            entry[pair[0]]=[entry[pair[0]], pair[1]]
+                    else:
+                        entry[pair[0]]=pair[1]
             except:
                 logger.error("%s: Could not read from database (table call_values)! Possible reason is old, uncompatible table structure. If you don't have important data, please remove %s file.", self.name, _SQLITE_FILE_NAME)
                 raise OperationalError
@@ -193,7 +201,11 @@ class SQLiteCallBackend(Backend):
         for field in call_data:
             if not field in reqfields:
                 if not field in reqIntfields:
-                    cur.execute('INSERT INTO call_values (callId, Field, Value) VALUES (?,?,?)',(cid, field, call_data[field]))
+                    if type(call_data[field]) == Array or type(call_data[field]) == list:
+                        for value in call_data[field]:
+                            cur.execute('INSERT INTO call_values (callId, Field, Value) VALUES (?,?,?)',(cid, field, value))
+                    else:
+                        cur.execute('INSERT INTO call_values (callId, Field, Value) VALUES (?,?,?)',(cid, field, call_data[field]))
         
         self.con.commit()
         cur.close()
diff --git a/framework/subsystems/opimd/pimb_sqlite_contacts.py b/framework/subsystems/opimd/pimb_sqlite_contacts.py
index 7d46310..73eb42a 100644
--- a/framework/subsystems/opimd/pimb_sqlite_contacts.py
+++ b/framework/subsystems/opimd/pimb_sqlite_contacts.py
@@ -30,6 +30,8 @@ import sqlite3
 import logging
 logger = logging.getLogger('opimd')
 
+from dbus import Array
+
 from domain_manager import DomainManager
 from backend_manager import BackendManager, Backend
 from backend_manager import PIMB_CAN_ADD_ENTRY, PIMB_CAN_DEL_ENTRY, PIMB_CAN_UPD_ENTRY, PIMB_CAN_UPD_ENTRY_WITH_NEW_FIELD
@@ -169,7 +171,13 @@ class SQLiteContactBackend(Backend):
             try:
                 cur.execute('SELECT Field, Value FROM contact_values WHERE contactId=?',(line[0],))
                 for pair in cur:
-                    entry[pair[0]]=pair[1]
+                    if entry.has_key(pair[0]):
+                        if type(entry[pair[0]]) == list:
+                            entry[pair[0]].append(pair[1])
+                        else:
+                            entry[pair[0]]=[entry[pair[0]], pair[1]]
+                    else:
+                        entry[pair[0]]=pair[1]
             except:
                 logger.error("%s: Could not read from database (table contact_values)! Possible reason is old, uncompatible table structure. If you don't have important data, please remove %s file.", self.name, _SQLITE_FILE_NAME)
                 raise OperationalError
@@ -227,7 +235,11 @@ class SQLiteContactBackend(Backend):
         cid = cur.lastrowid
         for field in contact_data:
             if not field in reqfields:
-                cur.execute('INSERT INTO contact_values (contactId, Field, Value) VALUES (?,?,?)',(cid, field, contact_data[field]))
+                if type(contact_data[field]) == Array or type(contact_data[field]) == list:
+                    for value in contact_data[field]:
+                        cur.execute('INSERT INTO contact_values (contactId, Field, Value) VALUES (?,?,?)',(cid, field, value))
+                else:
+                    cur.execute('INSERT INTO contact_values (contactId, Field, Value) VALUES (?,?,?)',(cid, field, contact_data[field]))
         
         self.con.commit()
         cur.close()
diff --git a/framework/subsystems/opimd/pimb_sqlite_messages.py b/framework/subsystems/opimd/pimb_sqlite_messages.py
index 8065c7e..c1cbf43 100644
--- a/framework/subsystems/opimd/pimb_sqlite_messages.py
+++ b/framework/subsystems/opimd/pimb_sqlite_messages.py
@@ -30,6 +30,8 @@ import sqlite3
 import logging
 logger = logging.getLogger('opimd')
 
+from dbus import Array
+
 from domain_manager import DomainManager
 from backend_manager import BackendManager, Backend
 from backend_manager import PIMB_CAN_ADD_ENTRY, PIMB_CAN_DEL_ENTRY, PIMB_CAN_UPD_ENTRY, PIMB_CAN_UPD_ENTRY_WITH_NEW_FIELD
@@ -158,7 +160,13 @@ class SQLiteMessagesBackend(Backend):
             try:
                 cur.execute('SELECT Field, Value FROM message_values WHERE messageId=?',(line[0],))
                 for pair in cur:
-                    entry[pair[0]]=pair[1]
+                    if entry.has_key(pair[0]):
+                        if type(entry[pair[0]]) == list:
+                            entry[pair[0]].append(pair[1])
+                        else:
+                            entry[pair[0]]=[entry[pair[0]], pair[1]]
+                    else:
+                        entry[pair[0]]=pair[1]
             except:
                 logger.error("%s: Could not read from database (table message_values)! Possible reason is old, uncompatible table structure. If you don't have important data, please remove %s file.", self.name, _SQLITE_FILE_NAME)
                 raise OperationalError
@@ -224,7 +232,11 @@ class SQLiteMessagesBackend(Backend):
         for field in message_data:
             if not field in reqfields:
                 if not field in reqIntFields:
-                    cur.execute('INSERT INTO message_values (messageId, Field, Value) VALUES (?,?,?)',(cid, field, message_data[field]))
+                    if type(message_data[field]) == Array or type(message_data[field]) == list:
+                        for value in message_data[field]:
+                            cur.execute('INSERT INTO message_values (messageId, Field, Value) VALUES (?,?,?)',(cid, field, value))
+                    else:
+                        cur.execute('INSERT INTO message_values (messageId, Field, Value) VALUES (?,?,?)',(cid, field, message_data[field]))
         
         self.con.commit()
         cur.close()
diff --git a/framework/subsystems/opimd/pimd_calls.py b/framework/subsystems/opimd/pimd_calls.py
index d3afa87..ae14acf 100644
--- a/framework/subsystems/opimd/pimd_calls.py
+++ b/framework/subsystems/opimd/pimd_calls.py
@@ -11,7 +11,7 @@ GPLv2 or later
 
 Calls Domain Plugin
 
-Establishes the 'call' PIM domain and handles all related requests
+Establishes the 'calls' PIM domain and handles all related requests
 
 NOTE: This domain could be good start for making some generic domain class
 """
diff --git a/framework/subsystems/opimd/pimd_contacts.py b/framework/subsystems/opimd/pimd_contacts.py
index cd5aa9c..a07de85 100644
--- a/framework/subsystems/opimd/pimd_contacts.py
+++ b/framework/subsystems/opimd/pimd_contacts.py
@@ -1,4 +1,5 @@
 #!/usr/bin/env python
+# -*- coding: utf-8 -*-
 """
 Open PIM Daemon
 
@@ -10,7 +11,7 @@ GPLv2 or later
 
 Contacts Domain Plugin
 
-Establishes the 'contact' PIM domain and handles all related requests
+Establishes the 'contacts' PIM domain and handles all related requests
 """
 
 from dbus.service import FallbackObject as DBusFBObject

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list