[pkg-fso-commits] [SCM] FSO frameworkd Debian packaging branch, master, updated. milestone4-368-g700ab82

Daniel Willmann daniel at totalueberwachung.de
Mon Feb 2 18:51:54 UTC 2009


The following commit has been merged in the master branch:
commit 4a8735490abffa1c15599bc999057f221cccb2e5
Author: Daniel Willmann <daniel at totalueberwachung.de>
Date:   Mon Jan 12 14:32:44 2009 +0100

    ogsmd: Fixed getting of alphabet property.
    
    The previous commit broke all SMS functionality, this fixes the issue. A
    test case is now included that will recognize this failure.

diff --git a/framework/subsystems/ogsmd/gsm/const.py b/framework/subsystems/ogsmd/gsm/const.py
index 9bed9fc..356b23d 100644
--- a/framework/subsystems/ogsmd/gsm/const.py
+++ b/framework/subsystems/ogsmd/gsm/const.py
@@ -724,11 +724,11 @@ SMS_PDU_STATUS_IN = { \
 }
 
 #=========================================================================#
-SMS_ALPHABET_TO_ENCODING = { \
+SMS_ALPHABET_TO_ENCODING = BiDict( { \
     "gsm_default": "gsm_default",
     "ucs2": "utf_16_be",
     "binary": None,
-}
+} )
 
 #=========================================================================#
 CB_PDU_DCS_LANGUAGE = [ "German", "English", "Italian", "French", "Spanish",
diff --git a/framework/subsystems/ogsmd/gsm/sms.py b/framework/subsystems/ogsmd/gsm/sms.py
index 5f3a225..91d8f6e 100644
--- a/framework/subsystems/ogsmd/gsm/sms.py
+++ b/framework/subsystems/ogsmd/gsm/sms.py
@@ -333,7 +333,7 @@ class SMS(object):
         map = {}
         map["type"] = self.type
         map["pid"] = self.pid
-        SMS_ALPHABET_TO_ENCODING.index(self.dcs_alphabet)
+        map["alphabet"] = SMS_ALPHABET_TO_ENCODING.revlookup(self.dcs_alphabet)
 
         if self.type == "sms-deliver" or self.type == "sms-submit-report":
             # FIXME Return correct time with timezoneinfo
diff --git a/tests/sms.py b/tests/sms.py
index 63f3223..796fb2d 100755
--- a/tests/sms.py
+++ b/tests/sms.py
@@ -119,6 +119,9 @@ class SMSTests(unittest.TestCase):
 
         self.assert_(sms.pdu() == "00410006919421430A000B0500030A0201A8E5391D",
                 "SMS encoding incorrect, PDU is %s" %sms.pdu())
+        self.assert_(sms.properties == { "pid": 10, "csm_id": 10, "csm_num": 2, "csm_seq" : 1,
+            "alphabet": "gsm_default", "type": "sms-submit"}, "SMS properties not as expected: %s" %
+            sms.properties)
 
         # Extended plane
         sms.ud = "{}[]\\"
@@ -129,8 +132,9 @@ class SMSTests(unittest.TestCase):
                 "SMS extended alphabet encoding failed, PDU:\n%s" % sms.pdu())
 
         # UCS-2
+        sms.properties = { "alphabet": "ucs2" }
         sms.ud = u'Unicode\u2320'
-        self.assert_(sms.dcs_alphabet == "ucs2",
+        self.assert_(sms.dcs_alphabet == "utf_16_be",
                 "SMS UCS2 alphabet encoding failed, alphabet used is: %s"
                 % sms.dcs_alphabet)
         self.assert_(sms.pdu() == "00410006919421430A08160500030A02010055006E00690063006F006400652320",

-- 
FSO frameworkd Debian packaging



More information about the pkg-fso-commits mailing list