[google-appengine] Re: How to append to BlobProperty

2009-02-01 Thread Will
Thanks, it finally worked. Following your suggestion, what I did is: 1. in class body, define: content = db.BlobProperty(required=False)# notice required is set to False 2. in __init__(arg1, arg2, ...): self.content = '' Then self.content += src doesn't complain

[google-appengine] Re: How to append to BlobProperty

2009-02-01 Thread Will
Hi TLH, I'm writing a FileUploadHandler that saves files into a Blob, hence I'm using BlobProperty. Will On Tue, Jan 27, 2009 at 8:56 PM, TLH tlhola...@gmail.com wrote: from google.appengine.ext import db class Foo(db.Model): b = db.BlobProperty() def butWhy(self, s): self.b =

[google-appengine] Re: How to append to BlobProperty

2009-02-01 Thread Alexander Kojevnikov
On Feb 2, 6:02 pm, Will vocalster@gmail.com wrote: Thanks, it finally worked. Following your suggestion, what I did is: 1. in class body, define:      content = db.BlobProperty(required=False)            # notice required is set to False 2. in __init__(arg1, arg2, ...):      

[google-appengine] Re: How to append to BlobProperty

2009-01-27 Thread Will
Here you go, -- class UploadStorage(db.Model): def __init__(self, field_name, file_name, content_type, content_length, charset): self.content = db.BlobProperty(required=True) self.last_change = db.DateTimeProperty(required=True, auto_now=True)

[google-appengine] Re: How to append to BlobProperty

2009-01-27 Thread Alexander Kojevnikov
Rewrite your UploadStorage class to declare the module properties in the class body, not in the __init__ method. App Engine forwards access to property definitions to the actual property values, creation of the properties in __init__ is probably not compatible with it. For example, when you

[google-appengine] Re: How to append to BlobProperty

2009-01-27 Thread Alexander Kojevnikov
When creating an UploadStorage entity, you should initialise the content property: my_entity = UploadStorage(content='') or: my_entity = UploadStorage() my_entity.content = '' # or whatever your initial value is I know, it a bit confusing. When you define the property in the class,

[google-appengine] Re: How to append to BlobProperty

2009-01-27 Thread TLH
from google.appengine.ext import db class Foo(db.Model): b = db.BlobProperty() def butWhy(self, s): self.b = self.b + s f = Foo( b = Append to a Blob? ) f.butWhy( You can, but why?) print f.b # Append to a Blob? You can, but why? I suspect you should be using a Text property.

[google-appengine] Re: How to append to BlobProperty

2009-01-26 Thread Alexander Kojevnikov
No, doesn't work. I got unsupported operand type(s) for +=: 'BlobProperty' and 'str' Same as before. Could you post here all related code, including the construction of a Storage entity? --~--~-~--~~~---~--~~ You received this message because you are

[google-appengine] Re: How to append to BlobProperty

2009-01-23 Thread Alexander Kojevnikov
db.Blob is a subclass of str. Try this code: class Storage(db.Model): blob = db.BlobProperty() def append(self, value): self.blob += value s = Storage() s.blob = 'abc' s.append('def') s.put() On Jan 24, 3:20 am, Will vocalster@gmail.com wrote: Hi all, I'd like to