Thanks for the tip, I am using os.path.splitext() !

I think somehow the problem lies with psycopg and it's "auto-quoting"  
feature.

I'm not sure how it figures out what needs to be quoted and what  
doesn't.

Thanks for the help, RajeshD!

Corey

On Oct 12, 2006, at 4:07 PM, RajeshD wrote:

>
>>
>> UPDATE "addocs_document" SET
>> "doctype"=2,"ad_id"='123456',"height"=0,"width"=0,"image"=ad_document
>> s/2006/10/12/123456_2_8..pdf,"submitted"='2006-10-12
>> 12:43:24',"received"='2006-10-12 12:57:12.155 598' WHERE "id"=8
>>
>> As you can see in the UPDATE statement, it is relative to the
>> MEDIA_ROOT folder, and it is not quoted.
>
> Right...as you have surmised, the lack of quoting is indeed the cause
> of the error.
>
> Try this:
>
> doc.image = str(os.path.join(upload_to,'%s_%s_%s%s' %
>        (the_ad.ordernumber, doctype, doc.id, docext) ) )
>
>
> (I don't know why it has two
>> periods, but that's my bug)
>
> If you are using os.path.splitext() to derive docext by any chance,
> realize that the extension you get from that method already has the
> dot in it i.e. '.pdf'. So, when you compose your filename from it you
> just need '%s_%s_%s%s instead of '%s_%s_%s.%s'.
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to