Hello,

this doesn't really look well: Dabo application using SQLite database. Main 
program:

if __name__ == "__main__":
        app = dabo.dApp()
        app.MainFormClass = FrmTest
        app.setup()
        app.DatabaseActivityLog = sys.stdout
        app.start()

Editing an existing record by entering text with non-ASCII characters into a 
varchar field and trying to save it results in this traceback:

Dabo Error Log: Thu Oct  2 17:45:08 2008: Error in scanChangedRows: 'ascii' 
codec can't encode character u'\xfc' in position 117: ordinal not in 
range(128)
Traceback (most recent call last):
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/ui/uiwx/dControlMixin.py",
 
line 27, in _onWxHit
    self.raiseEvent(dEvents.Hit, evt, *args, **kwargs)
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/ui/uiwx/dPemMixin.py",
 
line 928, in raiseEvent
    super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, 
**kwargs)
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/lib/eventMixin.py", 
line 92, in raiseEvent
    bindingFunction(event)
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/ui/uiwx/dForm.py", 
line 682, in onSave
    def onSave(self, evt): self.save()
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/ui/uiwx/dForm.py", 
line 355, in save
    bizobj.saveAll()
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/biz/dBizobj.py", 
line 337, in saveAll
    startTransaction=False)
File 
"/usr/lib/python2.5/site-packages/Dabo-0.8.4-py2.5.egg/dabo/biz/dBizobj.py", 
line 722, in scanChangedRows
    raise e
UnicodeEncodeError: 'ascii' codec can't encode character u'\xfc' in position 
117: ordinal not in range(128)

Without the line "app.DatabaseActivityLog = sys.stdout" the application works 
as expected, field content with non-ASCII characters is saved normally.

On the one hand I should have thought of this, 
because "sys.stdout.write(u'äöü')" raises the same UnicodeEncodeError. On the 
other hand the traceback for this case definitely doesn't help. And why is 
saving the record impossible, just because the _logging_ raises an exception?

I've tried to wrap sys.stdout using codecs.EncodedFile, but without success. I 
don't know which input and output encoding would be right. My system charset 
is UTF-8.

Would it be possible to have DatabaseActivityLog write something 
like "repr(theUnicodeObject)"? Not very pretty, but for diagnostic purposes 
perhaps acceptable? 

Greetings
Sibylle

-- 
Dr. Sibylle Koczian


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]

Reply via email to