Hi,

Thanks for the help. I had too much to work on, so I left the problem for 
the time.
Now I am back working on blobstore module.

I was looking at the code in web2py slices and in other threads in the 
group and got confused again.
I think the problem is too many versions/parts of the code here and there. 
Like on web2pyslices itself, there are 3 versions, the slice itself and the 
code in the comments. Now assuming the latest comment is the updated code, 
I find many things different from the code of the slice and very less 
documentation/changelog on it. 

I tried running the code in the latest comment but could not get it working.

I hope you understand my problem. I would really appreciate if somebody 
could compile the code (which would include the DB structure, the 
controller methods and the view) at one place, a new slice maybe.

Thanks.

On Thursday, March 8, 2012 1:07:41 PM UTC+5:30, howesc wrote:
>
> looking at my code that i shared in your other thread, it seems that you 
> are missing the redirect to signal to GAE that your handler did what it 
> needed to do and GAE should commit the blob to the blobstore.  i assume my 
> comment here was important to me when i set this up:
>
> #Raise the HTTP exception so that the response content stays empty.
>         #calling redirect puts content in the body which fails the blob 
> upload
>         raise HTTP(303,
>                    Location= URL(r=request,f='upload_image'​, 
> args=form.vars.id))
>
>
> while the example here 
> http://code.google.com/​appengine/docs/python/​blobstore/overview.html<http://code.google.com/appengine/docs/python/blobstore/overview.html>shows
>  the redirect, they neglect to state that it is required....though i 
> think it might be.
>
>
> On Wednesday, March 7, 2012 1:36:40 AM UTC-8, Sushant Taneja wrote:
>>
>> Hi,
>>
>> I am trying to use the Google Blobstore API for uploading images. I also 
>> checked the link: 
>> http://www.web2pyslices.​com/main/slices/take_slice/63<http://www.web2pyslices.com/main/slices/take_slice/63>
>>  ​for 
>> the help but couldn't understand much.
>>
>> In my application's (uploadPic) default controller I have the code as 
>> follows:
>>
>> from google.appengine.ext import blobstore
>>
>> def index():
>>     """
>>     This provides the upload_url to the upload form
>>     """
>>     
>> upload_url=blobstore.create_​upload_url(URL('uploadPic','​default','pic'))
>>     return dict(upload_url=upload_url)
>>
>> def pic():
>>     """
>>     This method stores the bolb key in a table and is used for serving 
>> the BLOB images
>>     """
>>     response.write(request)
>>
>> In the view index.html, I have a simple form
>>
>> <html>
>>     <body>
>>         <form method='post' action='{{=upload_url}}' 
>> enctype='multipart/form-data'>
>>             <input type='file' name='file'>
>>             <input type='submit' name='submit' value='Upload'>
>>         </form>
>>     </body>
>> </html>
>>
>> As per my understanding, when the upload is successful, GAE automatically 
>> redirects to the URL provided in the create_upload_url function with the 
>> request containing the blob_key.
>>
>> But when I execute the above, all I get in the page is None. The log is 
>> showing the following:
>>
>> INFO     2012-03-07 09:30:31,188 dev_appserver.py:2865] "GET 
>> /uploadPic/default/index HTTP/1.1" 200 -
>> INFO     2012-03-07 09:30:37,558 dev_appserver.py:687] Internal 
>> redirection to /uploadPic/default/pic
>> INFO     2012-03-07 09:30:37,681 gaehandler.py:69] **** Request: 
>> 104.29ms/100.00ms (real time/cpu time)
>> INFO     2012-03-07 09:30:37,686 recording.py:372] Saved; key: 
>> __appstats__:037500, part: 20 bytes, full: 1234 bytes, overhead: 0.000 + 
>> 0.004; link: 
>> http://localhost:8080/_ah/​stats/details?time=​1331112637576<http://localhost:8080/_ah/stats/details?time=1331112637576>
>> INFO     2012-03-07 09:30:37,695 dev_appserver_blobstore.py:​447] Upload 
>> handler returned 200
>> INFO     2012-03-07 09:30:37,723 dev_appserver.py:2865] "POST 
>> /_ah/upload/ag9kZXZ-​aW1hZ2V1cGxvYWRyGwsSFV9fQmxvYl​VwbG9hZFNlc3Npb25fXxggDA 
>> HTTP/1.1" 200 -
>>
>> Can someone please help me understand it ? 
>>
>> Thanks,
>> Sushant
>>
>>
>>

Reply via email to