2007/11/22, Oleg Broytmann <[EMAIL PROTECTED]>:
> On Thu, Nov 22, 2007 at 01:09:43PM -0300, Łeandro Sales wrote:
> >   I need to store local files paths on the database. I retrieve the
> > filepaths from the database and stores it in the database:
> >
> > I declared the database field as UnicodeCol
>
>    Do you put file paths to the DB as unicode or strings? Do you pass paths
> from the DB to Twisted as unicode or strings? If you pass paths to Twisted
> as unicode - does Twisted convert them to strings?
>
> 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
>

I pass as as unicode, using this function:

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

... 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)
        else:
            return static.Data("", "")
-------------------------------------------------------------------------
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