[Erp5-report] r25347 - /erp5/trunk/products/ERP5SyncML/Subscription.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jan 28 18:03:55 CET 2009
Author: nicolas
Date: Wed Jan 28 18:03:55 2009
New Revision: 25347
URL: http://svn.erp5.org?rev=25347&view=rev
Log:
small syntax optimisations
Modified:
erp5/trunk/products/ERP5SyncML/Subscription.py
Modified: erp5/trunk/products/ERP5SyncML/Subscription.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5SyncML/Subscription.py?rev=25347&r1=25346&r2=25347&view=diff
==============================================================================
--- erp5/trunk/products/ERP5SyncML/Subscription.py [utf8] (original)
+++ erp5/trunk/products/ERP5SyncML/Subscription.py [utf8] Wed Jan 28 18:03:55 2009
@@ -367,7 +367,7 @@
set the XML corresponding to the object
"""
self.xml = xml
- if self.xml != None:
+ if self.xml is not None:
self.setTempXML(None) # We make sure that the xml will not be erased
self.setMD5(xml)
@@ -375,10 +375,8 @@
"""
get the XML corresponding to the object
"""
- xml = getattr(self, 'xml', None)
- if xml == '':
- xml = None
- return xml
+ #Never return empty string
+ return getattr(self, 'xml', None) or None
def setTempXML(self, xml):
"""
@@ -443,7 +441,7 @@
"""
set the rid
"""
- if rid is type(u'a'):
+ if isinstance(rid, unicode):
rid = rid.encode('utf-8')
self.rid = rid
@@ -457,7 +455,7 @@
"""
set the id
"""
- if id is type(u'a'):
+ if isinstance(id, unicode):
id = id.encode('utf-8')
self.id = id
@@ -477,7 +475,7 @@
"""
set the id of the object associated to this signature
"""
- if id is type(u'a'):
+ if isinstance(id, unicode):
id = id.encode('utf-8')
self.object_id = id
More information about the Erp5-report
mailing list