|
From: <ni...@us...> - 2010-11-18 19:15:57
|
Revision: 138
http://openautomation.svn.sourceforge.net/openautomation/?rev=138&view=rev
Author: nilss1
Date: 2010-11-18 19:15:50 +0000 (Thu, 18 Nov 2010)
Log Message:
-----------
Fixed some encoding issues
Modified Paths:
--------------
PyWireGate/trunk/WireGate.py
PyWireGate/trunk/datastore.py
PyWireGate/trunk/lirc_connector/LIRC_Connector.py
Modified: PyWireGate/trunk/WireGate.py
===================================================================
--- PyWireGate/trunk/WireGate.py 2010-11-18 16:01:07 UTC (rev 137)
+++ PyWireGate/trunk/WireGate.py 2010-11-18 19:15:50 UTC (rev 138)
@@ -63,7 +63,7 @@
'logfile' : "%s/wiregated.log" % self.scriptpath,
'errorlog' : "%s/wiregated-error.log" % self.scriptpath,
'loglevel': 'info',
- 'defaultencoding': 'UTF-8'
+ 'defaultencoding': 'iso-8859-15'
}
self.checkconfig("WireGate",defaultconfig)
@@ -249,7 +249,7 @@
logger.setLevel(level)
if filename:
## python handle logrotating
- handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding=self.WG.config['WireGate']['defaultencoding'],backupCount=7)
+ handler = log.logging.handlers.TimedRotatingFileHandler(filename,'MIDNIGHT',encoding='UTF-8',backupCount=7)
## Handler if logrotate handles Logfiles
#handler = logging.handlers.WatchedFileHandle(filename)
Modified: PyWireGate/trunk/datastore.py
===================================================================
--- PyWireGate/trunk/datastore.py 2010-11-18 16:01:07 UTC (rev 137)
+++ PyWireGate/trunk/datastore.py 2010-11-18 19:15:50 UTC (rev 138)
@@ -103,7 +103,7 @@
def load(self):
self.debug("load DATASTORE")
try:
- db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding=self.WG.config['WireGate']['defaultencoding'])
+ db = codecs.open(self.WG.config['WireGate']['datastore'],"r",encoding='UTF-8')
loaddict = json.load(db)
db.close()
for name, obj in loaddict.items():
@@ -145,7 +145,7 @@
'config' : obj.config,
'connected' : obj.connected
}
- dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding=self.WG.config['WireGate']['defaultencoding'])
+ dbfile = codecs.open(self.WG.config['WireGate']['datastore'],"w",encoding='UTF-8')
utfdb = json.dumps(savedict,dbfile,ensure_ascii=False,sort_keys=True,indent=3)
dbfile.write(utfdb)
dbfile.close()
Modified: PyWireGate/trunk/lirc_connector/LIRC_Connector.py
===================================================================
--- PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 16:01:07 UTC (rev 137)
+++ PyWireGate/trunk/lirc_connector/LIRC_Connector.py 2010-11-18 19:15:50 UTC (rev 138)
@@ -74,13 +74,13 @@
try:
raw, counter, button, channel = rawmsg.split()
## default "LIRC:channel_button
- id = "%s:%s_%s" % (self.instanceName,channel,button)
- self.WG.DATASTORE.update(id,counter)
+ id = u"%s:%s_%s" % (self.instanceName,channel,button)
+ self.WG.DATASTORE.update(id,int(counter,16))
- id = "%s:%s" % (self.instanceName,button)
+ id = u"%s:%s" % (self.instanceName,button)
## dont't create it "LIRC:Button"
if id in self.WG.DATASTORE.dataobjects:
- self.WG.DATASTORE.update(id,channel)
+ self.WG.DATASTORE.update(id,channel.decode(self.WG.config['WireGate']['defaultencoding']))
except ValueError:
self.debug("invalid Data %r" % rawmsg)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|