2007/11/22, Oleg Broytmann <[EMAIL PROTECTED]>:
> On Thu, Nov 22, 2007 at 01:32:22PM -0300, ?eandro Sales wrote:
> > ... and to pass to twisted I do:
> >
> >     def getChildWithDefault(self, id, request):
> >         item = Facade.select_item_by_id(id)
> >         if item:
> >             local_path = item.local_path
> >             return StaticFile(local_path)
>
>    That is, unicode in both way. Now if anybody explains how Twisted
> handles unicode filename...
>    Well, to check if it's SQLObject bug or not you are to add some
> debugging output (print, logging using repr()) - what bytes come in and
> what go out.
>
> Oleg.
> --
>      Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
>            Programmers don't die, they just GOSUB without RETURN.
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>

Hello Oleg,

  I talked to one of the twisted developers and they explained me that
the fileopen receives a sequence of bytes in the local_path parameter,
not unicode object (retorned by twisted). I solve the problem doing
local_path.encode('utf-8').
  But know I got another problem.
  As I said, before send data to database, I encode de data to unicode
calling this function:

def _enc(string = '', encoding="utf-8"):
    if string is None:
        string = ''
    if not isinstance(string, unicode):
        return unicode(string, encoding, errors="ignore")
    else:
        return string.encode(encoding)

  But SQLObject is raising an exception:

...
  File 
"/usr/lib/python2.5/site-packages/SQLObject-0.10dev_r2852-py2.5.egg/sqlobject/sqlite/sqliteconnection.py",
line 183, in _executeRetry
    raise OperationalError(ErrorMessage(e))
OperationalError: unrecognized token: "'Heathen Chemistry"

Why is this happening?

Thanks,
Leandro.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to