[web2py] web2py hosting in India
Hi, Do anyone know if any hosting solution in India supports web2py deployments? -- Thanks Narendran
[web2py] Re: web2py hosting in India
You can use service like linode / slicehost /webfaction to deploy. If you need managed deployment optimized for web2py with service in India, contact me Regards Vihang On Jun 24, 11:14 am, Narendran gunanar...@gmail.com wrote: Hi, Do anyone know if any hosting solution in India supports web2py deployments? -- Thanks Narendran
[web2py] onvalidation with form.request_vars instead of form.vars?
Hi! I'm validating a self referencing field via onvalidation parameter of crud.update(). My function checks if this field is the same as the id and emits an error in this case (setting form.errors.ref_field). (form is the parameter for the function given to onvalidation) I read the example to onvalidation on http://web2py.com/book/default/section/7/1 (7.1. FORM) and it is using form.vars to access the fields of the form. But form.vars is empty. I found my values in form.request_vars and was able to successfully check form.request_vars.ref_field == form.request_vars.id. Could be an error in the book, or maybe CRUD is different from FORM. Haven't looked any further into this matter. BTW: The section on CRUD http://web2py.com/book/default/section/7/6 refers to SQLFORM for an explanation for onvalidation, but onvalidation isn't mentioned on http://web2py.com/book/default/section/7/2 7.2. SQLFORM Regards, Stefan
[web2py] Re: calling secured function from cron
@auth.requires(request.client==None or auth.has_membership('managers')) don't work. What do u mean about fake authentication? how to do it? On Jun 22, 3:31 am, Álvaro Justen alv...@justen.eng.br wrote: On Mon, Jun 21, 2010 at 13:30, mdipierro mdipie...@cs.depaul.edu wrote: try @auth.requires(request.client==None or auth.has_membership('managers')) I think the best way to do it is to fake an authentication in thecron script, isn't it? -- Álvaro Justen - Turicas http://blog.justen.eng.br/ 21 9898-0141
[web2py] Re: upload bug in filename
Something s wrong in building the upload paths. You get C:\\...\\web2py\\applications\\Library/databases\\..\\uploads\\... notice \\ everywhere (correct) but / between Library and databases and \\..\\ should not be there. This is a bug somewhere. a Missing os.path.join probably. Will work on it later today and let you know. massimo On Jun 23, 3:15 am, Swell swel...@googlemail.com wrote: Ok I will post some code here to show as much as possible here is the db definition: db.define_table('papers', Field('title','string'), Field('author','string'), Field('file','upload'), ) then if i try to use the database administration tool available in Models section and try to insert a file like The Pricing of Options and Corporate Liabilities_Journal of Political Economy.pdf i then get a ticket complaining about IOError: [Errno 2] No such file or directory: C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/ databases\\..\\uploads\ \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf' i also checked the file actually has never been properly uploaded ( it is not present in the upload directory). Nothing special about size of the file ( if i just change manually the filename it works ). So it seems that the bug is when we receiving the file . hope we can sort this out Thx all M
[web2py] Re: Web2py and mobile browsing
This may be useful http://web2py.com/examples/static/mobile_device_detect.py On Jun 23, 8:38 am, Doug Warren doug.war...@gmail.com wrote: Does anyone have some hints for showing mobile browsers a different set of views than desktop browsers? IE: Detection, redirection, etc... Since the view is determined by the extension of the page how do people handle it?
[web2py] Re: Anvanced applications in gae
thinking about how to handle this... On Jun 22, 12:56 pm, Carles Gonzalez carle...@gmail.com wrote: My english is horrible, an maybe it wasn't clear, but that was exactly my problem :). Currently i'm looking at the code massimo told me about but i think that the problem isn't here. I explain: the parent is assigned when the child entity is created (at the constructor level), to ensure all entities on the same group are stored together (or close), that way transactions are feasible. I don't think i'm capable of doing that right now, but my proposed soultion (just an idea) is to extend the field definition syntax for reference fields, adding an atribute to indicate this tipe of relationship. Example (blatantly stolen from the book): db.define_table('person', Field('name')) db.define_table('dog', Field('name'), Field('owner', db.person, relationship=parent)) On SQL databases that attribute would be ignored, but in GAE web2py would enforce the parent relationship at creation and dog[id].parent would return the result of dog_instance.parent() I don't know if this is feasible or if i'm total crazy (an option to consider). Opinions? On Tue, Jun 22, 2010 at 1:42 AM, Matt mjwat...@gmail.com wrote: Any chance this could be considered as well? Currently the DAL doesn't allow you to set the parent which is required for GAE entity groups. http://groups.google.com/group/web2py/browse_thread/thread/3c11deb2bf... On Jun 22, 7:35 am, Carles carle...@gmail.com wrote: Ok, I'll try. Carles El 21/06/2010, a las 19:03, mdipierro mdipie...@cs.depaul.edu escribió: The only file you need to look into is gluon/contrib/gql.py specifically the select() function which calls filter returns the Rows object On Jun 21, 11:55 am, Carles Gonzalez carle...@gmail.com wrote: Ok, thanks! I would like to make the patch myself, but the innards of web2py are somewhat complex... Thanks again, Carles. On Mon, Jun 21, 2010 at 6:43 PM, mdipierro mdipie...@cs.depaul.edu wrote: Probably it would not be hard to implement. I will look into this next week but if somebody sends me a patch before that I will take it. Massimo On Jun 21, 9:25 am, Carles Gonzalez carle...@gmail.com wrote: Hi, I have developed some applications in web2py, and 2 are running currently in gae, but now i have serious problem. My current project is a social application, and when i design (example) the tables to make an user follow the actions other user (twitter like) I find that many-to-many relationships in app-engine are not easily supported. From my understanding using the tools present in web2py right i would need to do a lot of processing in memory, an that would hurt performance greatly. The pattern proposed by app store developers uses lists and parent relationship: class Message(db.Model): sender = db.StringProperty() body = db.TextProperty() class MessageIndex(db.Model): receivers = db.StringListProperty() indexes = MessageIndex.all(keys_only = True).filter('receivers = ', user_id) keys = [k.parent() for k in indexes) messages = db.get(keys) For using that pattern in web2py I would need a method for specifying the parent of a model instance. Can I specify that relationship using any method I don't know? If not, would it be hard to implement? Thanks in advance!
[web2py] Re: OWASP Top Ten
yes. It should be amended. I will add to the queue of summer tasks. ;-) On Jun 23, 4:10 pm, Joschua joschu...@yahoo.de wrote: I think it should be appended not updated, because that are just the top security flaws, but all are important. The new one are: * A6: Security Misconfiguration (crucial) * A9: Insufficient Transport Layer Protection * A10: Unvalidated Redirects and Forwards On Jun 23, 6:37 pm, Julius Minka j...@minka.sk wrote: There is a new version here:http://www.owasp.org/index.php/Category:OWASP_Top_Ten_Project I wonder if it doesn't need to be reflected in the current version of the Book or in web2py itself. Julius
[web2py] Re: Downloading from private folder
My convention is: static: files that are public uploads: files that are uploaded into the system and may be subject to access control private: files that the app needs but are not sent over the network If you use the built-in upload mechanism it is not a good idea to move the file. On Jun 23, 12:13 pm, weheh richard_gor...@verizon.net wrote: Massimo, thanks for the app. I'm studying it. From the doc, I'm not sure I get a crystal clear understanding of what the web2py convention is. Let's say my app lets you upload a music mp3 file, a file with a description (liner notes), and a jpeg (album cover). These get uploaded to uploads. Should I allow them to be downloaded from uploads or do I need to move them both to static first? What if I mix the uploaded mp3 with some more music to make another mp3 file, which isn't uploaded. Should it be moved to the static folder? Finally, the doc says, private files are accessed by the controllers but not directly by the developer. I've been trying to parse that statement but it makes no sense to me. I'm the developer. I write the controller. My controller tries to access private directly. Does that make me not the developer? So what exactly is the purpose of the private folder? On Jun 23, 3:15 am, mdipierro mdipie...@cs.depaul.edu wrote: Two issues: - you are donwloading from private not uploads folder. Thenically this is ok but not a web2py convention. You should not expose the content for the private folder. That is why it is called private. ;-) - you used embed to embed a file, but it should be used to embed a plugin. I have used a flash plugin for this purpose. Here is an app to manage music files that you can use as example: http://web2py.com/examples/static/web2py.app.music.w2p Massimo On Jun 22, 10:50 pm, weheh richard_gor...@verizon.net wrote: Continuing this old thread:http://groups.google.com/group/web2py/browse_thread/thread/59b66b3a24... I'm having trouble getting an embedded mp3 from showing up in my web page. I'm trying to implement this almost exactly as Massimo suggested in the above thread. Anybody know why my code below isn't functioning? #controller audio.py def download_audio(): f=os.path.join(request.folder,'private',request.args(0)) return response.stream(open(f,'rb')) #model show_audio.py def show_audio(): filename='audio/aab/hello_world.mp3' # this is a hardcoded value for this test case url=URL(r=request,c='audio',f='download_audio',args=filename) return EMBED(_src=url,_autoplay='true') #view index.html {{=show_audio()}}
[web2py] how to use global variable in controller?
Hi, I try to use global variable in a controller. global a a=5 def index(): return dict() def func1(): global a a=request.vars.id1 def func2(): global a print a The html page call func1 first and change the value of the global variable a to 8. But when html page call func2 afterwards, the value of the global variable a printed out is still 5. Can anyone tell me why this happens and how to make variable in a controller global? Thanks alot.
Re: [web2py] Re: Anvanced applications in gae
Thanks! On Thu, Jun 24, 2010 at 2:27 PM, mdipierro mdipie...@cs.depaul.edu wrote: thinking about how to handle this... On Jun 22, 12:56 pm, Carles Gonzalez carle...@gmail.com wrote: My english is horrible, an maybe it wasn't clear, but that was exactly my problem :). Currently i'm looking at the code massimo told me about but i think that the problem isn't here. I explain: the parent is assigned when the child entity is created (at the constructor level), to ensure all entities on the same group are stored together (or close), that way transactions are feasible. I don't think i'm capable of doing that right now, but my proposed soultion (just an idea) is to extend the field definition syntax for reference fields, adding an atribute to indicate this tipe of relationship. Example (blatantly stolen from the book): db.define_table('person', Field('name')) db.define_table('dog', Field('name'), Field('owner', db.person, relationship=parent)) On SQL databases that attribute would be ignored, but in GAE web2py would enforce the parent relationship at creation and dog[id].parent would return the result of dog_instance.parent() I don't know if this is feasible or if i'm total crazy (an option to consider). Opinions? On Tue, Jun 22, 2010 at 1:42 AM, Matt mjwat...@gmail.com wrote: Any chance this could be considered as well? Currently the DAL doesn't allow you to set the parent which is required for GAE entity groups. http://groups.google.com/group/web2py/browse_thread/thread/3c11deb2bf... On Jun 22, 7:35 am, Carles carle...@gmail.com wrote: Ok, I'll try. Carles El 21/06/2010, a las 19:03, mdipierro mdipie...@cs.depaul.edu escribió: The only file you need to look into is gluon/contrib/gql.py specifically the select() function which calls filter returns the Rows object On Jun 21, 11:55 am, Carles Gonzalez carle...@gmail.com wrote: Ok, thanks! I would like to make the patch myself, but the innards of web2py are somewhat complex... Thanks again, Carles. On Mon, Jun 21, 2010 at 6:43 PM, mdipierro mdipie...@cs.depaul.edu wrote: Probably it would not be hard to implement. I will look into this next week but if somebody sends me a patch before that I will take it. Massimo On Jun 21, 9:25 am, Carles Gonzalez carle...@gmail.com wrote: Hi, I have developed some applications in web2py, and 2 are running currently in gae, but now i have serious problem. My current project is a social application, and when i design (example) the tables to make an user follow the actions other user (twitter like) I find that many-to-many relationships in app-engine are not easily supported. From my understanding using the tools present in web2py right i would need to do a lot of processing in memory, an that would hurt performance greatly. The pattern proposed by app store developers uses lists and parent relationship: class Message(db.Model): sender = db.StringProperty() body = db.TextProperty() class MessageIndex(db.Model): receivers = db.StringListProperty() indexes = MessageIndex.all(keys_only = True).filter('receivers = ', user_id) keys = [k.parent() for k in indexes) messages = db.get(keys) For using that pattern in web2py I would need a method for specifying the parent of a model instance. Can I specify that relationship using any method I don't know? If not, would it be hard to implement? Thanks in advance!
[web2py] ajax function target id null
Hi, I use the ajax function as follows: ajax('func1', ['id1'], '') because I don't need to send some value to the html page, so I set the third parameter null. But IE raises error 'document.getElementById(...)' is null or not an object. How can I use the ajax function when I don't want to send values to html page?
[web2py] Re: Downloading from private folder
So where would I put text and mp3 files that are created by my system (not uploaded) and available to end users subject to access control: static or uploads? That doesn't seem to fall into any of your conventional categories. On Jun 24, 8:30 am, mdipierro mdipie...@cs.depaul.edu wrote: My convention is: static: files that are public uploads: files that are uploaded into the system and may be subject to access control private: files that the app needs but are not sent over the network If you use the built-in upload mechanism it is not a good idea to move the file. On Jun 23, 12:13 pm, weheh richard_gor...@verizon.net wrote: Massimo, thanks for the app. I'm studying it. From the doc, I'm not sure I get a crystal clear understanding of what the web2py convention is. Let's say my app lets you upload a music mp3 file, a file with a description (liner notes), and a jpeg (album cover). These get uploaded to uploads. Should I allow them to be downloaded from uploads or do I need to move them both to static first? What if I mix the uploaded mp3 with some more music to make another mp3 file, which isn't uploaded. Should it be moved to the static folder? Finally, the doc says, private files are accessed by the controllers but not directly by the developer. I've been trying to parse that statement but it makes no sense to me. I'm the developer. I write the controller. My controller tries to access private directly. Does that make me not the developer? So what exactly is the purpose of the private folder? On Jun 23, 3:15 am, mdipierro mdipie...@cs.depaul.edu wrote: Two issues: - you are donwloading from private not uploads folder. Thenically this is ok but not a web2py convention. You should not expose the content for the private folder. That is why it is called private. ;-) - you used embed to embed a file, but it should be used to embed a plugin. I have used a flash plugin for this purpose. Here is an app to manage music files that you can use as example: http://web2py.com/examples/static/web2py.app.music.w2p Massimo On Jun 22, 10:50 pm, weheh richard_gor...@verizon.net wrote: Continuing this old thread:http://groups.google.com/group/web2py/browse_thread/thread/59b66b3a24... I'm having trouble getting an embedded mp3 from showing up in my web page. I'm trying to implement this almost exactly as Massimo suggested in the above thread. Anybody know why my code below isn't functioning? #controller audio.py def download_audio(): f=os.path.join(request.folder,'private',request.args(0)) return response.stream(open(f,'rb')) #model show_audio.py def show_audio(): filename='audio/aab/hello_world.mp3' # this is a hardcoded value for this test case url=URL(r=request,c='audio',f='download_audio',args=filename) return EMBED(_src=url,_autoplay='true') #view index.html {{=show_audio()}}- Hide quoted text - - Show quoted text -
[web2py] change the encoding
Hi, How can I change the encoding of the files edited with the editor's own web2py? Rgards, Jose
Re: [web2py] elFinder-web2py , Filemanager for Web2py!
Yeah!!! Great, this is super-useful! I was not able to make it work yet it will not install as an appliances and extracting the application folder in the web2py didnt work either. Its because some parts are not ready yet? I cant wait to see this in my application list in web2py! gls
[web2py] Re: ajax function target id null
You cannot but if you do ajax('func1', ['id1'], ':eval') it will interpret the returned page as json and evaluate it. id If you return 'null' or '', it should work as expected and not raise any error. On Jun 24, 9:47 am, ilovesss2004 yyiillu...@gmail.com wrote: Hi, I use the ajax function as follows: ajax('func1', ['id1'], '') because I don't need to send some value to the html page, so I set the third parameter null. But IE raises error 'document.getElementById(...)' is null or not an object. How can I use the ajax function when I don't want to send values to html page?
[web2py] Re: Downloading from private folder
If you apply access control to your files, than they are referenced by the database. In this case you should use the db.table.field.store(stream,filename) method to store the stream into uploads. If there is no access control put it in static. On Jun 24, 10:14 am, weheh richard_gor...@verizon.net wrote: So where would I put text and mp3 files that are created by my system (not uploaded) and available to end users subject to access control: static or uploads? That doesn't seem to fall into any of your conventional categories. On Jun 24, 8:30 am, mdipierro mdipie...@cs.depaul.edu wrote: My convention is: static: files that are public uploads: files that are uploaded into the system and may be subject to access control private: files that the app needs but are not sent over the network If you use the built-in upload mechanism it is not a good idea to move the file. On Jun 23, 12:13 pm, weheh richard_gor...@verizon.net wrote: Massimo, thanks for the app. I'm studying it. From the doc, I'm not sure I get a crystal clear understanding of what the web2py convention is. Let's say my app lets you upload a music mp3 file, a file with a description (liner notes), and a jpeg (album cover). These get uploaded to uploads. Should I allow them to be downloaded from uploads or do I need to move them both to static first? What if I mix the uploaded mp3 with some more music to make another mp3 file, which isn't uploaded. Should it be moved to the static folder? Finally, the doc says, private files are accessed by the controllers but not directly by the developer. I've been trying to parse that statement but it makes no sense to me. I'm the developer. I write the controller. My controller tries to access private directly. Does that make me not the developer? So what exactly is the purpose of the private folder? On Jun 23, 3:15 am, mdipierro mdipie...@cs.depaul.edu wrote: Two issues: - you are donwloading from private not uploads folder. Thenically this is ok but not a web2py convention. You should not expose the content for the private folder. That is why it is called private. ;-) - you used embed to embed a file, but it should be used to embed a plugin. I have used a flash plugin for this purpose. Here is an app to manage music files that you can use as example: http://web2py.com/examples/static/web2py.app.music.w2p Massimo On Jun 22, 10:50 pm, weheh richard_gor...@verizon.net wrote: Continuing this old thread:http://groups.google.com/group/web2py/browse_thread/thread/59b66b3a24... I'm having trouble getting an embedded mp3 from showing up in my web page. I'm trying to implement this almost exactly as Massimo suggested in the above thread. Anybody know why my code below isn't functioning? #controller audio.py def download_audio(): f=os.path.join(request.folder,'private',request.args(0)) return response.stream(open(f,'rb')) #model show_audio.py def show_audio(): filename='audio/aab/hello_world.mp3' # this is a hardcoded value for this test case url=URL(r=request,c='audio',f='download_audio',args=filename) return EMBED(_src=url,_autoplay='true') #view index.html {{=show_audio()}}- Hide quoted text - - Show quoted text -
[web2py] Re: change the encoding
I do not know if that is possible On Jun 24, 10:22 am, Jose jjac...@gmail.com wrote: Hi, How can I change the encoding of the files edited with the editor's own web2py? Rgards, Jose
[web2py] Re: login_bare() blows up on GAE
yes that's what I'm saying... there must be some code in Web2py where if the field is 'upload' and you're running on GAE, then it triggers creation of the blob field... but probably shouldn't create the blob in the same table, since on GAE there is no way to NOT load the blob (it always loads the entire object) maybe this isn't a big deal to GAE... it can handle alot... but it requires my touching every object that has an upload field before passing it back through JSON (have to set blob fields to null first) On Jun 23, 2:50 am, mdipierro mdipie...@cs.depaul.edu wrote: but as for automating the schema maintenance... if I create auth_user.Field('photo','upload') instead of creating a 'photo' (string) and 'photo_blob' (blob) on the same table, it should maybe create just 'photo' (string) and another table called 'auth_user_photo' with one field and a reference? Field('photo','upload') is always a string. On GAE it also triggers the creation of a the blob field in the same table.
[web2py] ajax background function crashes web2py fcgi handler
Dear List, the ajax based background search crashes my web2py installation. It's version 1.77.3 and I'm using the fcgihandler to access the application. OS: OpenBSD 4.6, Python version is Python 2.5.4 (r254:67916, Oct 19 2009, 01:52:14). As You can see below the search makes three database queries. The first search attempt works and the second crashes web2py. Would You be so kind to look into it? The error is the following: Unhandled exception in thread started by bound method Connection.run of gluon.contrib.gateways.fcgi.Connection object at 0x8b5af36c Traceback (most recent call last): File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 664, in run self.process_input() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 700, in process_input self._do_params(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 799, in _do_params self._start_request(req) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 783, in _start_request req.run() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 592, in run self._flush() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 599, in _flush self.stdout.close() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 358, in close self._conn.writeRecord(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 715, in writeRecord rec.write(self._sock) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 552, in write self._sendall(sock, header) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 529, in _sendall sent = sock.send(data) socket.error: (32, 'Broken pipe') The jquery snippet that calls the background functions: function dvd() { ajax('bg_quick_dvd', ['keyword', 'option'], 'target_dvd'); } function music_cd() { ajax('bg_quick_music_cd', ['keyword', 'option'], 'target_music_cd'); } function book() { ajax('bg_quick_book', ['keyword', 'option'], 'target_book'); function start() { if(jQuery('#title').attr('checked')) jQuery('#option').val('1'); if(jQuery('#store').attr('checked')) jQuery('#option').val('0'); dvd(); setTimeout('music_cd()', 150); setTimeout('book()', 300); } And the backround functions: def bg_quick_dvd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' dvds = db((db.dvds.user==user_id) (db.dvds.title.like(pattern))).select(orderby=db.dvds.title) else: dvds = db((db.dvds.user==user_id) (db.dvds.store==request.vars.keyword)).select(orderby=db.dvds.title) items = [A(row.title, _href=URL(c='dvd', r=request, f='show', args=row.id)) for row in dvds] return UL(*items).xml() @auth.requires_login() def bg_quick_music_cd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' music_cds = db((db.music_cds.user==user_id) (db.music_cds.title.like(pattern))).select(orderby=db.music_cds.title) else: music_cds = db((db.music_cds.user==user_id) (db.music_cds.store==request.vars.keyword)).select(orderby=db.music_cds.title) items = [A(row.title, _href=URL(c='music_cd', r=request, f='show', args=row.id)) for row in music_cds] return UL(*items).xml() @auth.requires_login() def bg_quick_book(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' books = db((db.books.user==user_id) (db.books.title.like(pattern))).select(orderby=db.books.title) else: books = db((db.books.user==user_id) (db.books.store==request.vars.keyword)).select(orderby=db.books.title) items = [A(row.title, _href=URL(c='book', r=request, f='show', args=row.id)) for row in books] return UL(*items).xml() Best regards, Mate
[web2py] Error in db.py
Hi, I am having an error in web2py app. I am not able to figure out what is causing the error. It would be of great help if any can figure out the error and let me know. Error is as follows: Traceback (most recent call last): File /cube/apps/web2py/gluon/restricted.py, line 178, in restricted exec ccode in environment File /cube/apps/web2py/applications/rnai/models/db.py, line 34, in module auth_table = db.define_table(Field('university', length=128, default=''),) File /cube/apps/web2py/gluon/sql.py, line 1262, in define_table tablename = cleanup(tablename) File /cube/apps/web2py/gluon/sql.py, line 571, in cleanup if re.compile('[^0-9a-zA-Z_]').findall(text): TypeError: expected string or buffer Thanks
[web2py] Re: login_bare() blows up on GAE
Got it. I will look into creating such option. The issue is to make it general enough On Jun 24, 12:06 pm, NickFranceschina nickfrancesch...@gmail.com wrote: yes that's what I'm saying... there must be some code in Web2py where if the field is 'upload' and you're running on GAE, then it triggers creation of the blob field... but probably shouldn't create the blob in the same table, since on GAE there is no way to NOT load the blob (it always loads the entire object) maybe this isn't a big deal to GAE... it can handle alot... but it requires my touching every object that has an upload field before passing it back through JSON (have to set blob fields to null first) On Jun 23, 2:50 am, mdipierro mdipie...@cs.depaul.edu wrote: but as for automating the schema maintenance... if I create auth_user.Field('photo','upload') instead of creating a 'photo' (string) and 'photo_blob' (blob) on the same table, it should maybe create just 'photo' (string) and another table called 'auth_user_photo' with one field and a reference? Field('photo','upload') is always a string. On GAE it also triggers the creation of a the blob field in the same table.
[web2py] Re: Error in db.py
db.define_table(Field('university', length=128,default=''),) is missing tablename db.define_table('tablename',Field('university', length=128,default=''),) so it thinks the Field(..) is a tablename. On Jun 24, 12:11 pm, Deepan nicky3...@gmail.com wrote: Hi, I am having an error in web2py app. I am not able to figure out what is causing the error. It would be of great help if any can figure out the error and let me know. Error is as follows: Traceback (most recent call last): File /cube/apps/web2py/gluon/restricted.py, line 178, in restricted exec ccode in environment File /cube/apps/web2py/applications/rnai/models/db.py, line 34, in module auth_table = db.define_table(Field('university', length=128, default=''),) File /cube/apps/web2py/gluon/sql.py, line 1262, in define_table tablename = cleanup(tablename) File /cube/apps/web2py/gluon/sql.py, line 571, in cleanup if re.compile('[^0-9a-zA-Z_]').findall(text): TypeError: expected string or buffer Thanks
[web2py] Re: ajax background function crashes web2py fcgi handler
This needs to be investigated. I think it may be a problem with fcgi.py, not with web2py itself. Anywya, let's rule out problems with session locking. Try add session.unlock() to those actions called via ajax that do not write session variables. Do you still get the problem? Do you use sqlite? Can you add some print/logging statements to see which actions are called, in which order and if they return? On Jun 24, 12:14 pm, ScOut3R mailingl...@modernbiztonsag.org wrote: Dear List, the ajax based background search crashes my web2py installation. It's version 1.77.3 and I'm using the fcgihandler to access the application. OS: OpenBSD 4.6, Python version is Python 2.5.4 (r254:67916, Oct 19 2009, 01:52:14). As You can see below the search makes three database queries. The first search attempt works and the second crashes web2py. Would You be so kind to look into it? The error is the following: Unhandled exception in thread started by bound method Connection.run of gluon.contrib.gateways.fcgi.Connection object at 0x8b5af36c Traceback (most recent call last): File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 664, in run self.process_input() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 700, in process_input self._do_params(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 799, in _do_params self._start_request(req) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 783, in _start_request req.run() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 592, in run self._flush() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 599, in _flush self.stdout.close() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 358, in close self._conn.writeRecord(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 715, in writeRecord rec.write(self._sock) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 552, in write self._sendall(sock, header) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 529, in _sendall sent = sock.send(data) socket.error: (32, 'Broken pipe') The jquery snippet that calls the background functions: function dvd() { ajax('bg_quick_dvd', ['keyword', 'option'], 'target_dvd'); } function music_cd() { ajax('bg_quick_music_cd', ['keyword', 'option'], 'target_music_cd'); } function book() { ajax('bg_quick_book', ['keyword', 'option'], 'target_book'); function start() { if(jQuery('#title').attr('checked')) jQuery('#option').val('1'); if(jQuery('#store').attr('checked')) jQuery('#option').val('0'); dvd(); setTimeout('music_cd()', 150); setTimeout('book()', 300); } And the backround functions: def bg_quick_dvd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' dvds = db((db.dvds.user==user_id) (db.dvds.title.like(pattern))).select(orderby=db.dvds.title) else: dvds = db((db.dvds.user==user_id) (db.dvds.store==request.vars.keyword)).select(orderby=db.dvds.title) items = [A(row.title, _href=URL(c='dvd', r=request, f='show', args=row.id)) for row in dvds] return UL(*items).xml() @auth.requires_login() def bg_quick_music_cd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' music_cds = db((db.music_cds.user==user_id) (db.music_cds.title.like(pattern))).select(orderby=db.music_cds.title) else: music_cds = db((db.music_cds.user==user_id) (db.music_cds.store==request.vars.keyword)).select(orderby=db.music_cds.title) items = [A(row.title, _href=URL(c='music_cd', r=request, f='show', args=row.id)) for row in music_cds] return UL(*items).xml() @auth.requires_login() def bg_quick_book(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' books = db((db.books.user==user_id) (db.books.title.like(pattern))).select(orderby=db.books.title) else: books = db((db.books.user==user_id) (db.books.store==request.vars.keyword)).select(orderby=db.books.title) items = [A(row.title, _href=URL(c='book', r=request, f='show', args=row.id)) for row in books] return UL(*items).xml() Best regards, Mate
[web2py] Re: ajax background function crashes web2py fcgi handler
I've added session.unlock to each of the functions and it seems stable except under one condition and that is if I'm accidentally double click the submit button. I'm using MySQL as the backend. The first function (bg_quick_dvd()) got executed and it returns the value but the following just times out. I'll try to figure out at which part. On Jun 24, 8:24 pm, mdipierro mdipie...@cs.depaul.edu wrote: This needs to be investigated. I think it may be a problem with fcgi.py, not with web2py itself. Anywya, let's rule out problems with session locking. Try add session.unlock() to those actions called via ajax that do not write session variables. Do you still get the problem? Do you use sqlite? Can you add some print/logging statements to see which actions are called, in which order and if they return? On Jun 24, 12:14 pm, ScOut3R mailingl...@modernbiztonsag.org wrote: Dear List, the ajax based background search crashes my web2py installation. It's version 1.77.3 and I'm using the fcgihandler to access the application. OS: OpenBSD 4.6, Python version is Python 2.5.4 (r254:67916, Oct 19 2009, 01:52:14). As You can see below the search makes three database queries. The first search attempt works and the second crashes web2py. Would You be so kind to look into it? The error is the following: Unhandled exception in thread started by bound method Connection.run of gluon.contrib.gateways.fcgi.Connection object at 0x8b5af36c Traceback (most recent call last): File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 664, in run self.process_input() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 700, in process_input self._do_params(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 799, in _do_params self._start_request(req) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 783, in _start_request req.run() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 592, in run self._flush() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 599, in _flush self.stdout.close() File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 358, in close self._conn.writeRecord(rec) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 715, in writeRecord rec.write(self._sock) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 552, in write self._sendall(sock, header) File /var/www/web2py/prod/gluon/contrib/gateways/fcgi.py, line 529, in _sendall sent = sock.send(data) socket.error: (32, 'Broken pipe') The jquery snippet that calls the background functions: function dvd() { ajax('bg_quick_dvd', ['keyword', 'option'], 'target_dvd'); } function music_cd() { ajax('bg_quick_music_cd', ['keyword', 'option'], 'target_music_cd'); } function book() { ajax('bg_quick_book', ['keyword', 'option'], 'target_book'); function start() { if(jQuery('#title').attr('checked')) jQuery('#option').val('1'); if(jQuery('#store').attr('checked')) jQuery('#option').val('0'); dvd(); setTimeout('music_cd()', 150); setTimeout('book()', 300); } And the backround functions: def bg_quick_dvd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' dvds = db((db.dvds.user==user_id) (db.dvds.title.like(pattern))).select(orderby=db.dvds.title) else: dvds = db((db.dvds.user==user_id) (db.dvds.store==request.vars.keyword)).select(orderby=db.dvds.title) items = [A(row.title, _href=URL(c='dvd', r=request, f='show', args=row.id)) for row in dvds] return UL(*items).xml() @auth.requires_login() def bg_quick_music_cd(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' music_cds = db((db.music_cds.user==user_id) (db.music_cds.title.like(pattern))).select(orderby=db.music_cds.title) else: music_cds = db((db.music_cds.user==user_id) (db.music_cds.store==request.vars.keyword)).select(orderby=db.music_cds.title) items = [A(row.title, _href=URL(c='music_cd', r=request, f='show', args=row.id)) for row in music_cds] return UL(*items).xml() @auth.requires_login() def bg_quick_book(): if (request.vars.option == '1'): pattern = '%' + request.vars.keyword + '%' books = db((db.books.user==user_id) (db.books.title.like(pattern))).select(orderby=db.books.title) else: books = db((db.books.user==user_id) (db.books.store==request.vars.keyword)).select(orderby=db.books.title) items = [A(row.title, _href=URL(c='book', r=request, f='show', args=row.id)) for row in books]
Re: [web2py] elFinder-web2py , Filemanager for Web2py!
It is not an appliance , and not made web2pyapp yet , after you unzip it into application folder modify view/index.html and controller/default/web2py_elcon in Controller: def web2py_elcon(): cont=connector({ 'root': '/home/v3ss/Downloads', # MODIFY to file folder path of your upload/downloads #'URL': 'http://localhost:8080'+URL (c='default',r=Request,f='call',args=['json','json_connector']), 'URL':'http://localhost:8080/filemanager/default/web2py_elcon', #MODIFY TO your URL. 'debug': False, # send debug information 'dirSize': True, # calculate directory sizes 'dotFiles': True,# show files beginning with dot 'defaults':{'read':True, 'write':True, 'rm':True} } ) In view : Check at Line 53: script type=text/javascript charset=utf-8 $().ready(function() { var f = $('#finder').elfinder({ url : ' http://localhost:8080/filemanager/default/web2py_elcon.json', #HERE! lang : 'en', editorCallback : function(url) { if (window.console window.console.log) { window.console.log(url); } else { alert(url); } }, On Thu, Jun 24, 2010 at 3:23 PM, Giuseppe Luca Scrofani glsdes...@gmail.com wrote: Yeah!!! Great, this is super-useful! I was not able to make it work yet it will not install as an appliances and extracting the application folder in the web2py didnt work either. Its because some parts are not ready yet? I cant wait to see this in my application list in web2py! gls
Re: [web2py] elFinder-web2py , Filemanager for Web2py!
I re-tried, managed to install extracting files in the correct folder, but now Im stuck Note URL (Both in View and web2py_elcon) need to be change to your host:port (i did with port 8080) Can you please explain a little more, what I've to change and where? From what I understand seems to edit default/index.html and change the url in the javascript in (in my case): url : 'http://192.168.0.101:8000/filemanager/default/web2py_elcon.json', and to edit under modules folder the files elw2py.py to _options = { 'root': '/path/to/a/folder?', 'URL': 'http://192.168.0.101:8000', but this not work so...
Re: [web2py] elFinder-web2py , Filemanager for Web2py!
Please ignore my previous message (written before you replied), now I will try to make your suggested changes
[web2py] Re: Downloading from private folder
Thanks! Makes sense. What method would you use to stream an mp3, ogg, wav ... or other audio file? Also, could you clarify what the filename argument represents -- is it the name you want the file to be or the name of the file being input (I believe it's the latter)? On Jun 24, 11:33 am, mdipierro mdipie...@cs.depaul.edu wrote: If you apply access control to your files, than they are referenced by the database. In this case you should use the db.table.field.store(stream,filename) method to store the stream into uploads. If there is no access control put it in static. On Jun 24, 10:14 am, weheh richard_gor...@verizon.net wrote: So where would I put text and mp3 files that are created by my system (not uploaded) and available to end users subject to access control: static or uploads? That doesn't seem to fall into any of your conventional categories. On Jun 24, 8:30 am, mdipierro mdipie...@cs.depaul.edu wrote: My convention is: static: files that are public uploads: files that are uploaded into the system and may be subject to access control private: files that the app needs but are not sent over the network If you use the built-in upload mechanism it is not a good idea to move the file. On Jun 23, 12:13 pm, weheh richard_gor...@verizon.net wrote: Massimo, thanks for the app. I'm studying it. From the doc, I'm not sure I get a crystal clear understanding of what the web2py convention is. Let's say my app lets you upload a music mp3 file, a file with a description (liner notes), and a jpeg (album cover). These get uploaded to uploads. Should I allow them to be downloaded from uploads or do I need to move them both to static first? What if I mix the uploaded mp3 with some more music to make another mp3 file, which isn't uploaded. Should it be moved to the static folder? Finally, the doc says, private files are accessed by the controllers but not directly by the developer. I've been trying to parse that statement but it makes no sense to me. I'm the developer. I write the controller. My controller tries to access private directly. Does that make me not the developer? So what exactly is the purpose of the private folder? On Jun 23, 3:15 am, mdipierro mdipie...@cs.depaul.edu wrote: Two issues: - you are donwloading from private not uploads folder. Thenically this is ok but not a web2py convention. You should not expose the content for the private folder. That is why it is called private. ;-) - you used embed to embed a file, but it should be used to embed a plugin. I have used a flash plugin for this purpose. Here is an app to manage music files that you can use as example: http://web2py.com/examples/static/web2py.app.music.w2p Massimo On Jun 22, 10:50 pm, weheh richard_gor...@verizon.net wrote: Continuing this old thread:http://groups.google.com/group/web2py/browse_thread/thread/59b66b3a24... I'm having trouble getting an embedded mp3 from showing up in my web page. I'm trying to implement this almost exactly as Massimo suggested in the above thread. Anybody know why my code below isn't functioning? #controller audio.py def download_audio(): f=os.path.join(request.folder,'private',request.args(0)) return response.stream(open(f,'rb')) #model show_audio.py def show_audio(): filename='audio/aab/hello_world.mp3' # this is a hardcoded value for this test case url=URL(r=request,c='audio',f='download_audio',args=filename) return EMBED(_src=url,_autoplay='true') #view index.html {{=show_audio()}}- Hide quoted text - - Show quoted text -- Hide quoted text - - Show quoted text -
[web2py] Re: elFinder-web2py , Filemanager for Web2py!
OK feel free to ask , and if you stuck give me error message. On Jun 24, 8:35 pm, Giuseppe Luca Scrofani glsdes...@gmail.com wrote: Please ignore my previous message (written before you replied), now I will try to make your suggested changes
[web2py] Re: Nice libraries for UI design inspiration (or web2py integration)
Well I use it without any modification, but using php version, as an independient application Now i want integrate it as web2py component, I will show my results here, ok? On 19 jun, 23:36, Phyo Arkar phyo.arkarl...@gmail.com wrote: Has anyone Successfully integrated elFinder into web2py? I am trying it out. On Thu, Jun 10, 2010 at 9:01 AM, Nicol van der Merwe aspersie...@gmail.comwrote: Very cool, but remember that the ButtonMaker won't work for internet explorer as IE doesn't support the 'border-radius' attribute. Not a biggie - just *another* irritation I have with IE :( . Thanks for the links though. On Wed, Jun 9, 2010 at 11:49 PM, GoldenTiger goldenboy...@gmail.comwrote: I would share some pretty libraries. I like them a lot and maybe you'll like them elRTE :Open source WYSIWYG editor for website Demo:http://elrte.ru/en/elrte/demo Web:http://elrte.ru/en elFinder: File manager for website (Finder osx style) Demo:http://elrte.ru/en/elfinder/demo Web:http://elrte.ru/en/elfinder Online ButtonMaker: http://css-tricks.com/examples/ButtonMaker/ I hope you like them -- Old Gregg: Ever drink baileys from a shoe? Wanna go to a club where people wee on each other? I'm gonna hurt you. I like you. What do ya think of me? Howard:I think your a nice..modern gentleman
[web2py] Re: upload bug in filename
Hi M - So I've used you example (a little simplified): On Jun 23, 3:15 am, Swell swel...@googlemail.com wrote: Ok I will post some code here to show as much as possible here is the db definition: db.define_table('papers', Field('title','string'), Field('author','string'), Field('file','upload'), ) I used this table for test model (note: string is default): db.define_table( 'test', Field( 'name' ), Field( 'author'), Field( 'note' ), Field( 'file', 'upload'), ) I used this for the controller: def test(): form=SQLFORM(db.test) if form.accepts( request.vars, session ): session.flash = 'this works' redirect(URL(r=request, f='index')) elif form.errors: response.flash = 'form has errors' return dict(form=form) I copied your filename (well - actually, I changed the extension to jpg - since I made a copy of a file I could see), And uploaded it thru the form; I set a breakpoint after form.accepts to confirm that the long name and path were properly formed (they were); I then went in through database admin, looked (again) at the long file name, copied to link to it to make sure it was what I expected to see (it got awfully long) - it was there, and I was able to download and view it from the db admin link. I then also added another record with the same file --- and (appropriately) there are two files in the app upload directory, and I can download each. I tested this on mac; I expect this would also work on linux; Someone will have to see if there is an issue w/ PC's, but for now - I am not able to reproduce your issue. Regards, - Yarko then if i try to use the database administration tool available in Models section and try to insert a file like The Pricing of Options and Corporate Liabilities_Journal of Political Economy.pdf i then get a ticket complaining about IOError: [Errno 2] No such file or directory: C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/ databases\\..\\uploads\ \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf' i also checked the file actually has never been properly uploaded ( it is not present in the upload directory). Nothing special about size of the file ( if i just change manually the filename it works ). So it seems that the bug is when we receiving the file . hope we can sort this out Thx all M
[web2py] Re: upload bug in filename
By the way - The filename in the upload directory was 194 characters --- it's entirely possible that windows was having trouble with this. Here is the listing of my test uploads directory (the first was just a 'normal' length file): -rw-r--r-- 1 yarko staff 2642 Jun 24 17:33 test.file. 880c7c46ee30a1ad.696e6465782e68746d6c.html -rw-r--r-- 1 yarko staff 16624 Jun 24 17:40 test.file. 96aded454eba1b88.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg -rw-r--r-- 1 yarko staff 16624 Jun 24 17:45 test.file.a500ba489526de41.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg Here's the paths to the links from web2py db admin (as you can see - all the paths are correctly formed): http://localhost:8000/test/appadmin/download/db/test.file.880c7c46ee30a1ad.696e6465782e68746d6c.html http://localhost:8000/test/appadmin/download/db/test.file.96aded454eba1b88.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg http://localhost:8000/test/appadmin/download/db/test.file.a500ba489526de41.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg Regards, - Yarko On Jun 23, 3:15 am, Swell swel...@googlemail.com wrote: Ok I will post some code here to show as much as possible here is the db definition: db.define_table('papers', Field('title','string'), Field('author','string'), Field('file','upload'), ) then if i try to use the database administration tool available in Models section and try to insert a file like The Pricing of Options and Corporate Liabilities_Journal of Political Economy.pdf i then get a ticket complaining about IOError: [Errno 2] No such file or directory: C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/ databases\\..\\uploads\ \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf' i also checked the file actually has never been properly uploaded ( it is not present in the upload directory). Nothing special about size of the file ( if i just change manually the filename it works ). So it seems that the bug is when we receiving the file . hope we can sort this out Thx all M
[web2py] Re: Anvanced applications in gae
I've done a parent - to - many child GAE / web2py implementation using SelfReference fields (or you can use Reference as well) using the technique for adding native GAE fields into a web2py table definition. It gives fantastic retrieval performance because GAE automatically adds the link from the child back into the parent's reference list at the time you create each child. When you later query for the parent, voila GAE retrieves all the child entities along with it in one backend call! Hopefully this technique is relevant to your application. I also develop some other tricks for inheriting native GAE classes into your web2py model, though this is less attractive perhaps now that GAE native properties can be directly declared in web2py tables. - Dave Lypka. On Jun 21, 10:25 am, Carles Gonzalez carle...@gmail.com wrote: Hi, I have developed some applications in web2py, and 2 are running currently in gae, but now i have serious problem. My current project is a social application, and when i design (example) the tables to make an user follow the actions other user (twitter like) I find that many-to-many relationships in app-engine are not easily supported. From my understanding using the tools present in web2py right i would need to do a lot of processing in memory, an that would hurt performance greatly. The pattern proposed by app store developers uses lists and parent relationship: class Message(db.Model): sender = db.StringProperty() body = db.TextProperty() class MessageIndex(db.Model): receivers = db.StringListProperty() indexes = MessageIndex.all(keys_only = True).filter('receivers = ', user_id) keys = [k.parent() for k in indexes) messages = db.get(keys) For using that pattern in web2py I would need a method for specifying the parent of a model instance. Can I specify that relationship using any method I don't know? If not, would it be hard to implement? Thanks in advance!
[web2py] Re: upload bug in filename
As an aside, the mixing of \\ and / is unsightly but does not seem to cause a problem on widows. If you want to tidy it up, it's around line 786 of main.py: request.folder = os.path.join(request.env.web2py_path, 'applications', request.application) + '/' On Jun 25, 11:15 am, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: By the way - The filename in the upload directory was 194 characters --- it's entirely possible that windows was having trouble with this. Here is the listing of my test uploads directory (the first was just a 'normal' length file): -rw-r--r-- 1 yarko staff 2642 Jun 24 17:33 test.file. 880c7c46ee30a1ad.696e6465782e68746d6c.html -rw-r--r-- 1 yarko staff 16624 Jun 24 17:40 test.file. 96aded454eba1b88.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg -rw-r--r-- 1 yarko staff 16624 Jun 24 17:45 test.file.a500ba489526de41.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg Here's the paths to the links from web2py db admin (as you can see - all the paths are correctly formed): http://localhost:8000/test/appadmin/download/db/test.file.880c7c46ee3...http://localhost:8000/test/appadmin/download/db/test.file.96aded454eb...http://localhost:8000/test/appadmin/download/db/test.file.a500ba48952... Regards, - Yarko On Jun 23, 3:15 am, Swell swel...@googlemail.com wrote: Ok I will post some code here to show as much as possible here is the db definition: db.define_table('papers', Field('title','string'), Field('author','string'), Field('file','upload'), ) then if i try to use the database administration tool available in Models section and try to insert a file like The Pricing of Options and Corporate Liabilities_Journal of Political Economy.pdf i then get a ticket complaining about IOError: [Errno 2] No such file or directory: C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/ databases\\..\\uploads\ \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf' i also checked the file actually has never been properly uploaded ( it is not present in the upload directory). Nothing special about size of the file ( if i just change manually the filename it works ). So it seems that the bug is when we receiving the file . hope we can sort this out Thx all M
Re: [web2py] Re: Anvanced applications in gae
Very interesting! I'll try tomorrow. Thanks a lot, Dave. On Fri, Jun 25, 2010 at 1:21 AM, dlypka dly...@gmail.com wrote: I've done a parent - to - many child GAE / web2py implementation using SelfReference fields (or you can use Reference as well) using the technique for adding native GAE fields into a web2py table definition. It gives fantastic retrieval performance because GAE automatically adds the link from the child back into the parent's reference list at the time you create each child. When you later query for the parent, voila GAE retrieves all the child entities along with it in one backend call! Hopefully this technique is relevant to your application. I also develop some other tricks for inheriting native GAE classes into your web2py model, though this is less attractive perhaps now that GAE native properties can be directly declared in web2py tables. - Dave Lypka. On Jun 21, 10:25 am, Carles Gonzalez carle...@gmail.com wrote: Hi, I have developed some applications in web2py, and 2 are running currently in gae, but now i have serious problem. My current project is a social application, and when i design (example) the tables to make an user follow the actions other user (twitter like) I find that many-to-many relationships in app-engine are not easily supported. From my understanding using the tools present in web2py right i would need to do a lot of processing in memory, an that would hurt performance greatly. The pattern proposed by app store developers uses lists and parent relationship: class Message(db.Model): sender = db.StringProperty() body = db.TextProperty() class MessageIndex(db.Model): receivers = db.StringListProperty() indexes = MessageIndex.all(keys_only = True).filter('receivers = ', user_id) keys = [k.parent() for k in indexes) messages = db.get(keys) For using that pattern in web2py I would need a method for specifying the parent of a model instance. Can I specify that relationship using any method I don't know? If not, would it be hard to implement? Thanks in advance!
Re: [web2py] Re: Anvanced applications in gae
Not to be annoying, but can you post an example? Just to organize the things in my head... Thanks again. On Fri, Jun 25, 2010 at 2:41 AM, Carles Gonzalez carle...@gmail.com wrote: Very interesting! I'll try tomorrow. Thanks a lot, Dave. On Fri, Jun 25, 2010 at 1:21 AM, dlypka dly...@gmail.com wrote: I've done a parent - to - many child GAE / web2py implementation using SelfReference fields (or you can use Reference as well) using the technique for adding native GAE fields into a web2py table definition. It gives fantastic retrieval performance because GAE automatically adds the link from the child back into the parent's reference list at the time you create each child. When you later query for the parent, voila GAE retrieves all the child entities along with it in one backend call! Hopefully this technique is relevant to your application. I also develop some other tricks for inheriting native GAE classes into your web2py model, though this is less attractive perhaps now that GAE native properties can be directly declared in web2py tables. - Dave Lypka. On Jun 21, 10:25 am, Carles Gonzalez carle...@gmail.com wrote: Hi, I have developed some applications in web2py, and 2 are running currently in gae, but now i have serious problem. My current project is a social application, and when i design (example) the tables to make an user follow the actions other user (twitter like) I find that many-to-many relationships in app-engine are not easily supported. From my understanding using the tools present in web2py right i would need to do a lot of processing in memory, an that would hurt performance greatly. The pattern proposed by app store developers uses lists and parent relationship: class Message(db.Model): sender = db.StringProperty() body = db.TextProperty() class MessageIndex(db.Model): receivers = db.StringListProperty() indexes = MessageIndex.all(keys_only = True).filter('receivers = ', user_id) keys = [k.parent() for k in indexes) messages = db.get(keys) For using that pattern in web2py I would need a method for specifying the parent of a model instance. Can I specify that relationship using any method I don't know? If not, would it be hard to implement? Thanks in advance!
[web2py] Loading DB Dynamically
So what i am doing is DB manager which support creating of DBs and also want to Define predefined set of Tables inside DB. But , as its going to be dynamic , it have to load DBs on the fly , inside controllers.. Lile this: In Controller: def __createCase(dbName): import MySQLdb newdb=MySQLdb.connect(user='root') cur =newdb.cursor() r=cur.execute('CREATE DATABASE '+dbName) if r0: return dbName else: return Fail def __loadDB(dbName): loadedDB = DAL(mysql:/r...@localhost/ + dbName) anyways to do it in the modesl?
[web2py] Re: upload bug in filename
actually, Russell, I don't think you want to do that... On Jun 24, 7:40 pm, Russell russell.mcmur...@gmail.com wrote: As an aside, the mixing of \\ and / is unsightly but does not seem to cause a problem on widows. If you want to tidy it up, it's around line 786 of main.py: request.folder = os.path.join(request.env.web2py_path, 'applications', request.application) + '/' On Jun 25, 11:15 am, Yarko Tymciurak resultsinsoftw...@gmail.com wrote: By the way - The filename in the upload directory was 194 characters --- it's entirely possible that windows was having trouble with this. Here is the listing of my test uploads directory (the first was just a 'normal' length file): -rw-r--r-- 1 yarko staff 2642 Jun 24 17:33 test.file. 880c7c46ee30a1ad.696e6465782e68746d6c.html -rw-r--r-- 1 yarko staff 16624 Jun 24 17:40 test.file. 96aded454eba1b88.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg -rw-r--r-- 1 yarko staff 16624 Jun 24 17:45 test.file.a500ba489526de41.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e6a7067.jpg Here's the paths to the links from web2py db admin (as you can see - all the paths are correctly formed): http://localhost:8000/test/appadmin/download/db/test.file.880c7c46ee3.. Regards, - Yarko On Jun 23, 3:15 am, Swell swel...@googlemail.com wrote: Ok I will post some code here to show as much as possible here is the db definition: db.define_table('papers', Field('title','string'), Field('author','string'), Field('file','upload'), ) then if i try to use the database administration tool available in Models section and try to insert a file like The Pricing of Options and Corporate Liabilities_Journal of Political Economy.pdf i then get a ticket complaining about IOError: [Errno 2] No such file or directory: C:\\Users\\M\\Desktop\\web2py_src\\web2py\\applications\\Library/ databases\\..\\uploads\ \papers.file.a33b16f5af29f6d8.5468652050726963696e67206f66204f7074696f6e7320616e6420436f72706f72617465204c696162696c69746965735f4a6f75726e616c206f6620506f6c69746963616c2045636f6e6f6d792e706466.pdf' i also checked the file actually has never been properly uploaded ( it is not present in the upload directory). Nothing special about size of the file ( if i just change manually the filename it works ). So it seems that the bug is when we receiving the file . hope we can sort this out Thx all M