[web2py] Re: How to not show the delete file checkbox
Excellent! Thank you both! Before I had [file | (cbox) delete ] requires=IS_IMAGE() got rid of the delete and checkbox, but now I am still left with [file] (a link to download the file) Might have to do server-side DOM parsing to get rid of that ... Thanks!!! Luis.
[web2py] Re: New Features in Book
On Jun 9, 1:06 am, contatogilson...@gmail.com contatogilson...@gmail.com wrote: I suggest that has more people to contribute to the documentation of web2py. The documentation uses the principle of wiki with that we can help make it updatedalways. Currently, the web2py book is a wiki, and there are several contributors from the community. Normally if one wants to help edit the book, they should contact Massimo by email to ask to become authorized as a book editor. If the book is frequently out of date, it is only because progress on the web2py project is rapid.
[web2py] Re: New Features in Book
On Jun 9, 3:02 am, Stifan Kristi steve.van.chris...@gmail.com wrote: is the book has already been updated right now? thank you I made some small fixes last night, if that is the kind of thing you mean. If you mean to ask whether the book is completely up to date with the capabilities and features of the current stable web2py, the answer is probably no, or more optimistically, not yet.
[web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote: Users who have an opinion please share it now. This is important. Could you direct us to more details about the issue?My current understanding is shallow, but I agree with Pierre that platform-specific environment settings are very likely not the way to go here. I much prefer all cross-platform issues to be handled with the os and sub modules. Why can't we do that here?What are the relevant issue numbers on the web2py google code site? I had a quick look, but nothing jumps out at me.
[web2py] Re: How to implement flags?
IMHO it depends on a number of things. Using groups and memberships is good if the flags are meant to indicate an ability to do something on the system because there are decorators and functions to test for having the attribute. You can then decorate a function or use a has_ test to determine ability in the code. If all you want to do is test something in code and there are a fixed and small number of these flags then an extension to the user table might be the easiest using a binary column per flag type. One problem is a new flag causes a schema change. It would be the most efficient, reading the user table could pull these in at the same time but that would be premature optimization. The relations in the auth_* tables look like this in ascii auth_user - auth_membership -- auth_group auth_permission where indicates a one to many relation. Therefore auth_membership is an intermediate or join table that realizes the many to many between auth_user and auth_group. The auth_permission table can be used to hold capabilities and not be associated with tables at all by means of a settings tweak. Then a permission can be assigned to only one group but a group can have several permissions. Then users can be assigned to multiple groups to collect the capabilities assigned by the admin. By using the group you can lump several flags that belong together. This works for me to define a hierarchy of users for the application I am working on. I am able to customize the permission items to whatever group type the installation needs to allow or disallow a group to have a certain capability without having to change what groups the users belong to, something like a policy editor as in this group can do these things. If all the flags are single purpose and are not grouped then I would think you could collapse this to a flag = group item. I am not certain of lists in columns. It is used with GAE to get around the lack of functionality in their DB but many db admins call it an anti-pattern called jay walking. The main difficulty is searching for a particular attribute in the list from a SQL perspective.
[web2py] Offtopic: Who's at Pycon APAC?
Event starts today http://apac.pycon.org/ (built with web2py goodness too!)
[web2py] orderby first, then limitby
I have a query that includes both orderby and limitby. What seems to happen is that the db returns some set of records as dictated by the limit and then orders the records in that set. So I pretty much get the same set every time even though I know the field being ordered has changed for various records. Is this how SQL works? Is there any way to order the whole set first and then return the sub-set?
[web2py] Re: How to implement flags?
Thanks, ron_m, good info.
[web2py] vars vs. kwargs
hi, it is cosmetic, but can be a pain for someone no so familiar with python. In examples for restful api: def index(): def GET(*args,**vars): patterns = [ /persons[person], /{person.name.startswith}, /{person.name}/:field, /{person.name}/pets[pet.person], /{person.name}/pet[pet.person]/{pet.name}, /{person.name}/pet[pet.person]/{pet.name}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() after copy paste everything is ok, but the problem is waiting to happen ... vars hides built-in vars function. cheers, pawel
[web2py] Re: orderby first, then limitby
In sql, you can apply first order by and then limitby for example in Oracle: select * from (select * from table order by field) where rownum11//row 1 to 10 after order On 9 jun, 09:52, pbreit pbreitenb...@gmail.com wrote: I have a query that includes both orderby and limitby. What seems to happen is that the db returns some set of records as dictated by the limit and then orders the records in that set. So I pretty much get the same set every time even though I know the field being ordered has changed for various records. Is this how SQL works? Is there any way to order the whole set first and then return the sub-set?
[web2py] Re: orderby first, then limitby
In DAL, I don´t know If this can be done. On 9 jun, 10:40, luifran lbernalhernan...@yahoo.es wrote: In sql, you can apply first order by and then limitby for example in Oracle: select * from (select * from table order by field) where rownum11//row 1 to 10 after order On 9 jun, 09:52, pbreit pbreitenb...@gmail.com wrote: I have a query that includes both orderby and limitby. What seems to happen is that the db returns some set of records as dictated by the limit and then orders the records in that set. So I pretty much get the same set every time even though I know the field being ordered has changed for various records. Is this how SQL works? Is there any way to order the whole set first and then return the sub-set?
[web2py] Re: Cubrid?
Hello Massimo, How is it going? As I promised we have uploaded the new CUBRID Python API Doc. You can download it from http://www.cubrid.org/python_programming#manual or view it online at ftp://ftp.cubrid.org/CUBRID_Docs/Drivers/Python/8.4.0/index.html. The documentation is prepared by Epydoc. I also wonder if anyone has some preferences regarding the documentation generator. I would be glad to know.
Re: [web2py] Offtopic: Who's at Pycon APAC?
Very Nice!. 2011/6/9 Luther Goh Lu Feng elf...@yahoo.com Event starts today http://apac.pycon.org/ (built with web2py goodness too!) -- http://martin.tecnodoc.com.ar
Re: [web2py] Re: amfrpc problem
I followed the instruction in the slice, but I keep getting the same error message AttributeError: 'Envelope' object has no attribute 'clientType'. I'm on Windows, running web2py 1.95.1, Active Python 2.7 and Flash Builder 4.5 On Thu, Dec 2, 2010 at 2:54 AM, mdipierro mdipie...@cs.depaul.edu wrote: The domain must be specified in the flash app. http://www.web2pyslices.com/main/slices/take_slice/72 I am not a flash expert myself anyway. Perhaps other people here can help more. Massimo On Dec 1, 5:25 pm, dustin.b dustin.bens...@googlemail.com wrote: thx for the quick answer! on the clintside i have the same error message. i forgot to mention the w2p ticket with amfrpc: Traceback (most recent call last): File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \restricted.py, line 188, in restricted exec ccode in environment File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 63, in module File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 61, in call return service() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3647, in __call__ return self.serve_amfrpc() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3520, in serve_amfrpc context = pyamf.get_context(pyamf.AMF0) AttributeError: 'module' object has no attribute 'get_context' amfrpc3: Traceback (most recent call last): File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \restricted.py, line 188, in restricted exec ccode in environment File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 63, in module File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 61, in call return service() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3649, in __call__ return self.serve_amfrpc(3) File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3523, in serve_amfrpc pyamf_request.clientType) AttributeError: 'Envelope' object has no attribute 'clientType' last but not least, what is the meaning of 'domain' in @service.amfrpc3('domain') in contrast to the one with amfrpc, i thought its some kind of renaming the function. On 2 Dez., 00:15, mdipierro mdipie...@cs.depaul.edu wrote: Try use amf3 @service.amfrpc3('domain') def service1(): return test and gateway.connect( http://127.0.0.1:8000/FlashSoldat_Server/default/call/ amfrpc3/); gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/ call/amfrpc/); On Dec 1, 4:55 pm, dustin.b dustin.bens...@googlemail.com wrote: hi, im stuck in getting flash to work with (web2py) amfrpc. i must confess that i am very limited in my flash knowledge so far. i tryed the sample from the book and getting into import problems. i think this is related to the flash version. im using flash cs5 and flashdevelop .. with as3. i installed pyamf so there is no missing lib warning if i invoke the call/amfrpc (3) ; and running w2p from source. im a little confused with the libs an the flash/flex side ... the only version i found which is not causing import errors is the following public class Main extends MovieClip { public function Main() { var gateway:NetConnection = new NetConnection(); gateway.addEventListener(NetStatusEvent.NET_STATUS , gateway_status); gateway.connect( http://127.0.0.1:8000/FlashSoldat_Server/default/ call/amfrpc/); var resp:Responder = new Responder(show_results, on_fault); gateway.call(service1, resp); trace(main started); stage.stageWidth = 100; stage.stageHeight = 100; var textlabel:TextField = new TextField(); textlabel.x = (stage.stageWidth - textlabel.width) / 2; textlabel.y = (stage.stageHeight - textlabel.height) / 2; textlabel.text = flex hello wold!; addChild(textlabel); } private function gateway_status(event:NetStatusEvent):void { trace(Level 0: +event.info.level+ Code: +event.info.code);
Re: [web2py] Re: amfrpc problem
And here is the traceback: Traceback (most recent call last): File C:\Users\Alexei\Dev\web2py\web2py\gluon\restricted.py, line 181, in restricted exec ccode in environment File C:\Users\Alexei\Dev\web2py\web2py\applications\amfrpctest\controllers/default.py, line 59, in module File C:\Users\Alexei\Dev\web2py\web2py\gluon\globals.py, line 133, in lambda self._caller = lambda f: f() File C:\Users\Alexei\Dev\web2py\web2py\applications\amfrpctest\controllers/default.py, line 52, in call return service() File C:\Users\Alexei\Dev\web2py\web2py\gluon\tools.py, line 3734, in __call__ return self.serve_amfrpc(3) File C:\Users\Alexei\Dev\web2py\web2py\gluon\tools.py, line 3608, in serve_amfrpc pyamf_request.clientType) AttributeError: 'Envelope' object has no attribute 'clientType' On Thu, Jun 9, 2011 at 2:22 PM, Alexei Vinidiktov alexei.vinidik...@gmail.com wrote: I followed the instruction in the slice, but I keep getting the same error message AttributeError: 'Envelope' object has no attribute 'clientType'. I'm on Windows, running web2py 1.95.1, Active Python 2.7 and Flash Builder 4.5 On Thu, Dec 2, 2010 at 2:54 AM, mdipierro mdipie...@cs.depaul.edu wrote: The domain must be specified in the flash app. http://www.web2pyslices.com/main/slices/take_slice/72 I am not a flash expert myself anyway. Perhaps other people here can help more. Massimo On Dec 1, 5:25 pm, dustin.b dustin.bens...@googlemail.com wrote: thx for the quick answer! on the clintside i have the same error message. i forgot to mention the w2p ticket with amfrpc: Traceback (most recent call last): File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \restricted.py, line 188, in restricted exec ccode in environment File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 63, in module File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 61, in call return service() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3647, in __call__ return self.serve_amfrpc() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3520, in serve_amfrpc context = pyamf.get_context(pyamf.AMF0) AttributeError: 'module' object has no attribute 'get_context' amfrpc3: Traceback (most recent call last): File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \restricted.py, line 188, in restricted exec ccode in environment File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 63, in module File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon \globals.py, line 96, in lambda self._caller = lambda f: f() File D:/DEV/python/web2py/1_89_5/web2py_src/web2py/applications/ FlashSoldat_Server/controllers/default.py, line 61, in call return service() File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3649, in __call__ return self.serve_amfrpc(3) File D:\DEV\python\web2py\1_89_5\web2py_src\web2py\gluon\tools.py, line 3523, in serve_amfrpc pyamf_request.clientType) AttributeError: 'Envelope' object has no attribute 'clientType' last but not least, what is the meaning of 'domain' in @service.amfrpc3('domain') in contrast to the one with amfrpc, i thought its some kind of renaming the function. On 2 Dez., 00:15, mdipierro mdipie...@cs.depaul.edu wrote: Try use amf3 @service.amfrpc3('domain') def service1(): return test and gateway.connect( http://127.0.0.1:8000/FlashSoldat_Server/default/call/ amfrpc3/); gateway.connect(http://127.0.0.1:8000/FlashSoldat_Server/default/ call/amfrpc/); On Dec 1, 4:55 pm, dustin.b dustin.bens...@googlemail.com wrote: hi, im stuck in getting flash to work with (web2py) amfrpc. i must confess that i am very limited in my flash knowledge so far. i tryed the sample from the book and getting into import problems. i think this is related to the flash version. im using flash cs5 and flashdevelop .. with as3. i installed pyamf so there is no missing lib warning if i invoke the call/amfrpc (3) ; and running w2p from source. im a little confused with the libs an the flash/flex side ... the only version i found which is not causing import errors is the following public class Main extends MovieClip { public function Main() { var gateway:NetConnection = new NetConnection(); gateway.addEventListener(NetStatusEvent.NET_STATUS , gateway_status); gateway.connect(
[web2py] BUG causes all error tickets to be unknown
I check out the latest web2py version from the hg I created a New simple application I modified the first menu item in models/menu.py response.menu = [ (TAG['']('Index'), False, URL(request.application,'default','index'), []) ] this does not make sense, and is just for testing, actualy I want to do something like (TAG[''](IMG( _src = URL(request.application, 'static/ico','bug.png'), _alt='bug'),'Issues'), False, issueurl , []), now i created a bug by adding random characters in a controller ... any bug will do def index(): asdf return dict() this will cause all error tickets to appear like Internal error Ticket issued: unknown the error will be displayed in the shell though What is wrong? This used to work. How do i get the images back into the menu?
Re: [web2py] BUG causes all error tickets to be unknown
Im not working with the latest version, but sometimesn it happens to me, and is because there's not write permissions on the /errors folder, or because the /errors folder does not exists. I hope this help to you. El jue, 09-06-2011 a las 03:28 -0700, selecta escribió: I check out the latest web2py version from the hg I created a New simple application I modified the first menu item in models/menu.py response.menu = [ (TAG['']('Index'), False, URL(request.application,'default','index'), []) ] this does not make sense, and is just for testing, actualy I want to do something like (TAG[''](IMG( _src = URL(request.application, 'static/ico','bug.png'), _alt='bug'),'Issues'), False, issueurl , []), now i created a bug by adding random characters in a controller ... any bug will do def index(): asdf return dict() this will cause all error tickets to appear like Internal error Ticket issued: unknown the error will be displayed in the shell though What is wrong? This used to work. How do i get the images back into the menu?
[web2py] help on a query
defining a table like that db.define_table('power_curve', Field('site', db.site, notnull=True, requires = IS_IN_DB(db, 'site.id', '%(name)s')), Field('file_name', 'upload', uploadfield=True, notnull=True, required=True), Field('validity', 'date', default=datetime.date(1970, 1, 1), requires=IS_EMPTY_OR(IS_DATE(format='%d/%m/%Y')) ) how can I select for each site id the last file name inserted? I tryied this two query but they give the same result and they returns the first file name in each case: db(db.power_curve).select(db.power_curve.site db.power_curve.file_name, db.power_curve.validity, groupby=db.power_curve.site, orderby=db.power_curve.site|~db.power_curve.start) db(db.power_curve).select(db.power_curve.site db.power_curve.file_name, db.power_curve.validity, groupby=db.power_curve.site, orderby=db.power_curve.site|db.power_curve.start) thank you Manuele
Re: [web2py] help on a query
db(db.power_curve).select(orderby=~db.power.id, group_by=db.power_curve.site)
Re: [web2py] help on a query
groupby instead of group_by
Re: [web2py] Re: orderby first, then limitby
I have a query that includes both orderby and limitby. What seems to happen is that the db returns some set of records as dictated by the limit and then orders the records in that set. So I pretty much get the same set every time even though I know the field being ordered has changed for various records. Is this how SQL works? Is there any way to order the whole set first and then return the sub-set? what is you DAL Query ?
[web2py] Re: BUG causes all error tickets to be unknown
On Jun 9, 12:37 pm, Daniel Gonzalez dgzabal...@gmail.com wrote: Im not working with the latest version, but sometimesn it happens to me, and is because there's not write permissions on the /errors folder, or because the /errors folder does not exists. no this is not the case for me, you can help by following my instructions and reproducing this error I hope this help to you. nop
[web2py] Re: Small toolbar bug in 1.96.3
No proxy, just default Ubuntu Server 10.04.2 with web2py trunk, plus pyodbc. No web server is installed on the machine and I am running it using python web2py.py -i 0.0.0.0 -a password -c cert.crt -k key.key, so I wonder if it has something to do with SSL? And the generic views have not been modified by me.
Re: [web2py] Re: New Features in Book
I proposed to massimo some ideas and improvements, regarding to this. 2011/6/9 cjrh caleb.hatti...@gmail.com On Jun 9, 3:02 am, Stifan Kristi steve.van.chris...@gmail.com wrote: is the book has already been updated right now? thank you I made some small fixes last night, if that is the kind of thing you mean. If you mean to ask whether the book is completely up to date with the capabilities and features of the current stable web2py, the answer is probably no, or more optimistically, not yet. -- http://martin.tecnodoc.com.ar
[web2py] Re: PyCharm is going to support web2py
Not to start a holy war or anything, but I hear people talking all the time about how emacs or vim is the best code editor ever. Why is that? Does it do code completion or have some other really helpful feature that I just missed? I've used vim to edit text files, but editing code in a tiny console window just doesn't seem very friendly. Is there something I'm missing here?
Re: [web2py] Re: PyCharm is going to support web2py
intelliyole http://twitter.com/#!/intelliyole Dmitry Jemerov @ @rochacbruno http://twitter.com/rochacbruno actually *web2py* support is not on the PyCharm roadmap. the number of votes is not the only thing driving our development plans 2011/6/9 Ross Peoples ross.peop...@gmail.com Not to start a holy war or anything, but I hear people talking all the time about how emacs or vim is the best code editor ever. Why is that? Does it do code completion or have some other really helpful feature that I just missed? I've used vim to edit text files, but editing code in a tiny console window just doesn't seem very friendly. Is there something I'm missing here? -- http://martin.tecnodoc.com.ar
[web2py] Re: BUG causes all error tickets to be unknown
replacing TAG[''] with DIV solved the problem, but still it would be nice to find out why this causes web2py to act this way
Re: [web2py] Re: PyCharm is going to support web2py
2011/6/9 Ross Peoples ross.peop...@gmail.com Not to start a holy war or anything, but I hear people talking all the time about how emacs or vim is the best code editor ever. Why is that? Does it do code completion or have some other really helpful feature that I just missed? I've used vim to edit text files, but editing code in a tiny console window just doesn't seem very friendly. Is there something I'm missing here? I think they are very powerful editors but they are also difficult to learn. Emacs is too hard for me I believe. I prefer Eclipse with Pydev because it is very integrated: editor, debugger, static code analyzer, Mercurial commands in the contextual menu, access to tickets from the editor, code coverage reports and more. I documented the integration I did with Eclipse: http://pierrethibault.posterous.com/?tag=web2pypage=2 These questions lead to very personal response. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/9 cjrh caleb.hatti...@gmail.com On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users who have an opinion please share it now. This is important. Could you direct us to more details about the issue? My current understanding is shallow, but I agree with Pierre that platform-specific environment settings are very likely not the way to go here. I much prefer all cross-platform issues to be handled with the os and sub modules. Why can't we do that here? It seems we have no developer with Windows where is the problem. I am on Windows, still XP even. Is there a small zipped app that I could test quickly to see the problem?
[web2py] Re: Skype Group and/or IRC
Thank you for the suggestion!!! Request to join group sent. :)
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/9 caleb.hatti...@gmail.com On , Pierre Thibault pierre.thibau...@gmail.com wrote: 2011/6/9 cjrh caleb.hatti...@gmail.com On Thursday, 9 June 2011 03:03:51 UTC+2, Massimo Di Pierro wrote:Users who have an opinion please share it now. This is important. Could you direct us to more details about the issue?My current understanding is shallow, but I agree with Pierre that platform-specific environment settings are very likely not the way to go here. I much prefer all cross-platform issues to be handled with the os and sub modules. Why can't we do that here? It seems we have no developer with Windows where is the problem. I am on Windows, still XP even. Is there a small zipped app that I could test quickly to see the problem? Sure, if you can debug code. Get code from the Mercurial repository. Debug and submit the patch to Massimo. Look for the problem described by Alessandro. You'll find the information you need on the problem on the threads named web2py 1.96.*x* is OUT. It is probably a bug with the code I wrote but I don't have a Windows machine to debug a problem specific to this platform. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] database access
i created a database with tablename,fieldname and i created a form-textbox in html language in views how to compare these two things
[web2py] database
created in html login: password: when i entered the submit button it compare with the values in database. if correct go to another page send the web2py code 2 my email
[web2py] Re: vars vs. kwargs
I do not understand. :-( On Jun 9, 3:21 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, it is cosmetic, but can be a pain for someone no so familiar with python. In examples for restful api: def index(): def GET(*args,**vars): patterns = [ /persons[person], /{person.name.startswith}, /{person.name}/:field, /{person.name}/pets[pet.person], /{person.name}/pet[pet.person]/{pet.name}, /{person.name}/pet[pet.person]/{pet.name}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() after copy paste everything is ok, but the problem is waiting to happen ... vars hides built-in vars function. cheers, pawel
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
For anyone else following, the thread is herehttps://groups.google.com/d/topic/web2py/_zhjxWa4tAU/discussion. I am going to have a look at this.
Re: [web2py] Re: PyCharm is going to support web2py
2011/6/9 Ross Peoples ross.peop...@gmail.com Not to start a holy war or anything, but I hear people talking all the time about how emacs or vim is the best code editor ever. Why is that? Does it do code completion or have some other really helpful feature that I just missed? I've used vim to edit text files, but editing code in a tiny console window just doesn't seem very friendly. Is there something I'm missing here? Here is a thread on the subject: http://groups.google.com/group/montrealpython/browse_thread/thread/87a05b7188e28168/2dc66732948da2ba?lnk=gstq=eclipse#2dc66732948da2ba -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Re: orderby first, then limitby
Limitby should be executed after olderby. Are you sure that is not the case? What DB? On Jun 9, 2:52 am, pbreit pbreitenb...@gmail.com wrote: I have a query that includes both orderby and limitby. What seems to happen is that the db returns some set of records as dictated by the limit and then orders the records in that set. So I pretty much get the same set every time even though I know the field being ordered has changed for various records. Is this how SQL works? Is there any way to order the whole set first and then return the sub-set?
[web2py] Web2Py RoR performances
Hi, I learned Web2Py and I'm learning Ruby on Rails. Is Ruby on Rails faster than Web2py ? It seems web2py open/read/close each files (db.py, controller...) to render a page (including all partials, layout...). Ruby Rails seems to cache all this files into memory, so it's faster. Any note about that ? Thanks
[web2py] Re: database
Not sure if you have a question for us. Good to have you on board :-) On Jun 9, 7:54 am, anil manikyam anilmanikya...@gmail.com wrote: created in html login: password: when i entered the submit button it compare with the values in database. if correct go to another page send the web2py code 2 my email
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
So you suggest removing the case insensitive flag that was added in 1.96.4?
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
But in a web2py app, you would have something like /applications/Cast/modules/cast.py, and in your code you would just do 'import cast'. My understanding of the problem is that in that case, the new web2py importer tries to import applications.cast.modules.cast instead of applications.Cast.modules.cast, which results in an import error. In fact, I cannot actually reproduce that problem (Windows 7, Python 2.7, web2py 1.96.3) -- if I capitalize the name of the application folder, the web2py importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Anthony On Thursday, June 9, 2011 10:03:01 AM UTC-4, cjrh wrote: Ok, so here is the thing: it appears that on Windows, everything works if the capitalization of the import statement matches the capitalization of the folder structure. Consider this folder structure (and there is an __init__.py in each folder hierarchy): /app/Cast/inner/cast.py In my file /test_imp.py, these contents WORK: try: import app.Cast.inner.cast print 'Pass' except: print 'Fail' pass These contents FAIL: try: import app.cast.inner.cast print 'Pass' except: print 'Fail' pass If, however, I change the folder structure to this: /app/cast/inner/cast.py Then I get *exactly opposite results*. In other words, the capitalization of the import path in the python file and on the file system must exactly match. This is on Windows XP x64 SP2. I have attached my test. In my opinion, we should just document that the cast must match. Note that this issue has *nothing to do with web2py*, and as a Windows user, I am not too surprised by this behaviour anyway.
[web2py] Re: Web2Py RoR performances
web2py is 3x - 10x faster because the python interpreter is faster then ruby. The bottle neck is always the database anyway. On Jun 9, 9:07 am, Bruno Rocha rochacbr...@gmail.com wrote: In web2py you can cache anything in RAM or use memcache. Em 09/06/2011 10:40, Alexandre Strzelewicz strzelewicz.alexan...@gmail.com escreveu: Hi, I learned Web2Py and I'm learning Ruby on Rails. Is Ruby on Rails faster than Web2py ? It seems web2py open/read/close each files (db.py, controller...) to render a page (including all partials, layout...). Ruby Rails seems to cache all this files into memory, so it's faster. Any note about that ? Thanks
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:03:01 UTC+2, cjrh wrote: In my opinion, we should just document that the cast must match. Note that this issue has *nothing to do with web2py*, and as a Windows user, I am not too surprised by this behaviour anyway. ...should just document that the *case *must match. (Sorry for any confusion)
Re: [web2py] Re: vars vs. kwargs
hi, sorry for being to cryptic. In [1]: def foo(*args,**kwargs): ...: print vars ...: ...: In [2]: foo() built-in function vars In [3]: def bar(*args,**vars): ...: print vars ...: ...: In [4]: bar() {} ref: http://docs.python.org/library/functions.html#vars as I said, it is cosmetic. I believe it is a bad idea to give variable a name which matches name of the build-in function cheers, pawel On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I do not understand. :-( On Jun 9, 3:21 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, it is cosmetic, but can be a pain for someone no so familiar with python. In examples for restful api: def index(): def GET(*args,**vars): patterns = [ /persons[person], /{person.name.startswith}, /{person.name}/:field, /{person.name}/pets[pet.person], /{person.name}/pet[pet.person]/{pet.name}, /{person.name}/pet[pet.person]/{pet.name}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() after copy paste everything is ok, but the problem is waiting to happen ... vars hides built-in vars function. cheers, pawel
[web2py] web2py 1.96.4 - Blocks in View not working
I use the blocks to couple eating several portions of the layout pages for quite a while.Only in this last version is not working. layout.html {{ block test }}{{ end }} test.html {{ extend 'layout.html' }} {{ block test }} h2It is working/h2 {{ end }} When I run the application, it displays nothing. _ *Gilson Filho* *Web Developer http://gilsondev.com*
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: On , Massimo Di Pierro massim...@gmail.com wrote: So you suggest removing the case insensitive flag that was added in 1.96.4? Yes. In Alessandro's specific case, he should use: import app.Castalia.blah.blah.castialia But shouldn't he be able to just do 'import castalia' and have it work (again, for me it actually does work on Windows, but assuming it doesn't work on some systems, shouldn't it be fixed)? Anthony
Re: Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Anthony abasta...@gmail.com wrote: On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: On , Massimo Di Pierro massim...@gmail.com wrote: So you suggest removing the case insensitive flag that was added in 1.96.4? Yes. In Alessandro's specific case, he should use: import app.Castalia.blah.blah.castialia But shouldn't he be able to just do 'import castalia' and have it work (again, for me it actually does work on Windows, but assuming it doesn't work on some systems, shouldn't it be fixed)? The issue seems to appear only when there is a repeated name in the chain. Could you test that too? My attachment has such a test-case ready to run. It seems that when a name is not repeated, the case-insensitive name matching works. This smells like a bug in Python, and probably needs to be fixed there.
[web2py] Re: vars vs. kwargs
Now I understand. It is a problem witg the example. Will fix it. On Jun 9, 9:24 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, sorry for being to cryptic. In [1]: def foo(*args,**kwargs): ...: print vars ...: ...: In [2]: foo() built-in function vars In [3]: def bar(*args,**vars): ...: print vars ...: ...: In [4]: bar() {} ref:http://docs.python.org/library/functions.html#vars as I said, it is cosmetic. I believe it is a bad idea to give variable a name which matches name of the build-in function cheers, pawel On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I do not understand. :-( On Jun 9, 3:21 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, it is cosmetic, but can be a pain for someone no so familiar with python. In examples for restful api: def index(): def GET(*args,**vars): patterns = [ /persons[person], /{person.name.startswith}, /{person.name}/:field, /{person.name}/pets[pet.person], /{person.name}/pet[pet.person]/{pet.name}, /{person.name}/pet[pet.person]/{pet.name}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() after copy paste everything is ok, but the problem is waiting to happen ... vars hides built-in vars function. cheers, pawel
[web2py] Re: web2py 1.96.4 - Blocks in View not working
Can you tell me which is the last version that worked? I do no think we changed anything there recently. On Jun 9, 9:02 am, contatogilson...@gmail.com contatogilson...@gmail.com wrote: I use the blocks to couple eating several portions of the layout pages for quite a while.Only in this last version is not working. layout.html {{ block test }}{{ end }} test.html {{ extend 'layout.html' }} {{ block test }} h2It is working/h2 {{ end }} When I run the application, it displays nothing. _ *Gilson Filho* *Web Developerhttp://gilsondev.com*
[web2py] Re: web2py 1.96.4 is OUT
It works for you because of the temporary fix (ignore capitalization). What Pierre and Caleb are saying is that it should NOT work if you get capitalization wrong. On Jun 9, 9:25 am, Anthony abasta...@gmail.com wrote: On Thursday, June 9, 2011 10:18:41 AM UTC-4, cjrh wrote: On , Massimo Di Pierro massim...@gmail.com wrote: So you suggest removing the case insensitive flag that was added in 1.96.4? Yes. In Alessandro's specific case, he should use: import app.Castalia.blah.blah.castialia But shouldn't he be able to just do 'import castalia' and have it work (again, for me it actually does work on Windows, but assuming it doesn't work on some systems, shouldn't it be fixed)? Anthony
[web2py] Re: database
On Thursday, June 9, 2011 8:54:07 AM UTC-4, anil manikyam wrote: created in html login: password: when i entered the submit button it compare with the values in database. if correct go to another page send the web2py code 2 my email Are you asking how to do this? If so, look at http://web2py.com/book/default/chapter/08#Authentication (note, the relevant code is already set up for you in the 'welcome' app -- auth is defined in /models/db.py, the auth actions are handled by the user() function in /controllers/default.py, and the view is in /views/default/user.html). By default, after login, it redirects to /default/index, but you can change that by setting auth.settings.login_next (see http://web2py.com/book/default/chapter/08#Settings-and-Messages). Anthony
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Yes, it is confusing. The case-insensitivity works only until a name is repeated in the import chain. When that occurs, it fails.
Re: [web2py] Re: web2py 1.96.4 - Blocks in View not working
I think it was in version 1.94.1 to 1.95.1 _ *Gilson Filho* *Web Developer http://gilsondev.com* 2011/6/9 Massimo Di Pierro massimo.dipie...@gmail.com Can you tell me which is the last version that worked? I do no think we changed anything there recently. On Jun 9, 9:02 am, contatogilson...@gmail.com contatogilson...@gmail.com wrote: I use the blocks to couple eating several portions of the layout pages for quite a while.Only in this last version is not working. layout.html {{ block test }}{{ end }} test.html {{ extend 'layout.html' }} {{ block test }} h2It is working/h2 {{ end }} When I run the application, it displays nothing. _ *Gilson Filho* *Web Developerhttp://gilsondev.com*
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: But in a web2py app, you would have something like /applications/Cast/modules/cast.py, and in your code you would just do 'import cast'. My understanding of the problem is that in that case, the new web2py importer tries to import applications.cast.modules.cast instead of applications.Cast.modules.cast, which results in an import error. Yes, this is a good point. I shall take a gander at Pierre's custom_import.py if I get some time later. I didn't realise the import path chain was being generated by web2py. That makes it our responsibility to fix.
[web2py] Re: web2py 1.96.4 is OUT
On Thursday, June 9, 2011 10:29:40 AM UTC-4, Massimo Di Pierro wrote: It works for you because of the temporary fix (ignore capitalization). What Pierre and Caleb are saying is that it should NOT work if you get capitalization wrong. No, I'm testing with 1.96.3, which is before the fix. And for me it does fail if I get the capitalization wrong. However, it does not fail for me if I simply capitalize the name of the application folder (I do not explicitly include the application folder in the import statement -- the web2py importer handles that, and appears to get it right, at least for me). Anthony
Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On Thursday, June 9, 2011 10:40:19 AM UTC-4, cjrh wrote: On Thursday, 9 June 2011 16:22:10 UTC+2, Anthony wrote: importer still appears to work. So, as far as I can tell, the importer works, even without the fix in trunk, though maybe I have misunderstood the problem. Yes, it is confusing. The case-insensitivity works only until a name is repeated in the import chain. When that occurs, it fails. Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. Anthony
[web2py] import error debian package
Has anyone who has used latest debian package been able to import modules while keeping the application self contained? I have the traceback from another user's application. First line of default.py question_maker = local_import('question_maker') then when you run it... Traceback (most recent call last): File /usr/lib/pymodules/python2.6/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/jelkner/web2py/applications/mathquiz/controllers/ default.py, line 1, in module question_maker = local_import('question_maker') File /usr/lib/pymodules/python2.6/gluon/compileapp.py, line 246, in lambda local_import_aux(name,reload,app) File /usr/lib/pymodules/python2.6/gluon/compileapp.py, line 177, in local_import_aux module = __import__(name) File /usr/lib/pymodules/python2.6/gluon/custom_import.py, line 280, in __call__ fromlist, level) File /usr/lib/pymodules/python2.6/gluon/custom_import.py, line 75, in __call__ level) ImportError: No module named mathquiz.modules.question_maker
[web2py] Re: vars vs. kwargs
fixed in trunk. Thanks On Jun 9, 9:24 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, sorry for being to cryptic. In [1]: def foo(*args,**kwargs): ...: print vars ...: ...: In [2]: foo() built-in function vars In [3]: def bar(*args,**vars): ...: print vars ...: ...: In [4]: bar() {} ref:http://docs.python.org/library/functions.html#vars as I said, it is cosmetic. I believe it is a bad idea to give variable a name which matches name of the build-in function cheers, pawel On Thu, Jun 9, 2011 at 3:26 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: I do not understand. :-( On Jun 9, 3:21 am, Pawel Jasinski pawel.jasin...@gmail.com wrote: hi, it is cosmetic, but can be a pain for someone no so familiar with python. In examples for restful api: def index(): def GET(*args,**vars): patterns = [ /persons[person], /{person.name.startswith}, /{person.name}/:field, /{person.name}/pets[pet.person], /{person.name}/pet[pet.person]/{pet.name}, /{person.name}/pet[pet.person]/{pet.name}/:field ] parser = db.parse_as_rest(patterns,args,vars) if parser.status == 200: return dict(content=parser.response) else: raise HTTP(parser.status,parser.error) def POST(table_name,**vars): if table_name == 'person': return db.person.validate_and_insert(**vars) elif table_name == 'pet': return db.pet.validate_and_insert(**vars) else: raise HTTP(400) return locals() after copy paste everything is ok, but the problem is waiting to happen ... vars hides built-in vars function. cheers, pawel
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing.
[web2py] Re: import error debian package
can you check the file is there and __init__.py is in every parent folder? On Jun 9, 10:01 am, Stavros stavros32...@gmail.com wrote: Has anyone who has used latest debian package been able to import modules while keeping the application self contained? I have the traceback from another user's application. First line of default.py question_maker = local_import('question_maker') then when you run it... Traceback (most recent call last): File /usr/lib/pymodules/python2.6/gluon/restricted.py, line 192, in restricted exec ccode in environment File /home/jelkner/web2py/applications/mathquiz/controllers/ default.py, line 1, in module question_maker = local_import('question_maker') File /usr/lib/pymodules/python2.6/gluon/compileapp.py, line 246, in lambda local_import_aux(name,reload,app) File /usr/lib/pymodules/python2.6/gluon/compileapp.py, line 177, in local_import_aux module = __import__(name) File /usr/lib/pymodules/python2.6/gluon/custom_import.py, line 280, in __call__ fromlist, level) File /usr/lib/pymodules/python2.6/gluon/custom_import.py, line 75, in __call__ level) ImportError: No module named mathquiz.modules.question_maker
[web2py] custom form dspval question
Apologies didn't see this anywhere that showed a clear example of what I'm asking about. Have custom form - using inpval, dspval, etc. and would like to know if there is specific formatting that allows me to set form field properties? this part I get: {{=dspval.my_field_name}} My question is using the custom.form, is there a notation that allows me to do something like: 1. set the width e.g., style=width:200px; 2. set a form text field to be hidden instead of visible 3. assign a field validator e.g., IS_EMAIL Thanks in advance.
[web2py] Re: import error debian package
We copy the math_quiz directory and all its contents from a source install of web2py, where it works, to the application directory of a user created by the debian package, where it gives the error above. Three of us have confirmed this on three separate installations. We are pretty confident it is an error with the way the package works.
[web2py] Question about superfish menu and roles
Hello, I would like to use the superfish menu that is on the welcome application but showing only some links depending the role the user has. Is that possible?? Thanks in advance
[web2py] Re: orderby first, then limitby
Yes, I believe that's what's happening but I was hoping to order the set first and then return the sub-set. For example, if I have: 7, 5, 2, 9, 6, 3, 4, 8 And I want the 3 lowest values: 2, 3, 4. Instead I get 2, 5, 7 (7, 5, 2 sorted)(I think).
Re: [web2py] Re: import error debian package
2011/6/9 Jeff Elkner jeff.elk...@gmail.com: We copy the math_quiz directory and all its contents from a source install of web2py, where it works, to the application directory of a user created by the debian package, where it gives the error above. Three of us have confirmed this on three separate installations. We are pretty confident it is an error with the way the package works. Could you give me a part of the code to test it in the package. I guess it's a permission problem. Regards.
[web2py] Re: orderby first, then limitby
items should be sorted when groups, unless you want to sort by a condition different than the groups. You can do that as well but you need to give a concrete model example and data example. On Jun 9, 11:21 am, pbreit pbreitenb...@gmail.com wrote: Yes, I believe that's what's happening but I was hoping to order the set first and then return the sub-set. For example, if I have: 7, 5, 2, 9, 6, 3, 4, 8 And I want the 3 lowest values: 2, 3, 4. Instead I get 2, 5, 7 (7, 5, 2 sorted)(I think).
[web2py] Re: Web2Py RoR performances
This was a while ago, and I cannot find my source at the moment, but I recall reading a benchmark done that put RoR faster than PHP, but slower than Python by a large margin (without server-side caching and other performance tweaks). If I find the original article or maybe a more recent one on the subject of performance, I'll be sure to share it.
[web2py] Re: How to implement flags?
also keep in mind your datastore. more fields on a SQL table can get unwieldy for the SQL engine. GAE prefers many fields to joins as you can't do joins there. lists for flags just seems unwieldy in either environment. bitwise operations seem super-slick and cool, but do they make the code harder to maintain? cfh
[web2py] Re: Offtopic: Who's at Pycon APAC?
As pointed out by Massimo, the site is built with conf2py http://code.google.com/p/conf2py/ On Jun 9, 6:06 pm, Martín Mulone mulone.mar...@gmail.com wrote: Very Nice!. 2011/6/9 Luther Goh Lu Feng elf...@yahoo.com Event starts today http://apac.pycon.org/ (built with web2py goodness too!) -- http://martin.tecnodoc.com.ar
[web2py] Re: Web2Py RoR performances
how is Python 3-10x faster than Ruby?
[web2py] Re: Question about superfish menu and roles
Yes, you can create whatever menus you want. The welcome app provides menus that are described in a models file but you can describe a a different menu or describe a menu in a controller or module. Just follow the patterns you see in the welcome code: response.my_menu=[(T('Resources'), False, None, [ (T('Documentation'), False, 'http://www.web2py.com/book', [ (T('Preface'), False, 'http://www.web2py.com/book/default/chapter/00'), (T('Introduction'), False, 'http://www.web2py.com/book/default/chapter/01'), ]), ] )] And then in your view: {{=MENU(response.my_menu, _class='sf-menu')}}
[web2py] Re: Web2Py RoR performances
This is probably not a discussion we want to start. While Python may have a small performance edge, it's nothing to get excited about. Likewise, the OP makes performance assumptions that may not be realistic. As I thought everyone knew, there are quite a few variables that go in to overall system performance. Database, caching and coding optimizations are as important or more than how the framework works. That said, Massimo and the group have demonstrated a commitment to performance so if you have any specific recommendations or, better, code, I'm sure they'd be happy to consider.
[web2py] Re: database access
We might more detail about what you are trying to do including some code samples.
[web2py] db.define_tables
Hi ! Below given is a table --- code db.define_table('ac', Field('acnm','string', IS_LENGTH(100), length=100, required=True), Field('acgrpid', db.acgrp, notnull=True, required=True), Field('active', 'string', IS_LENGTH(1), length=1, requires=IS_LENGHT(1), default='Y', required=True, notnull=True), Field('homeunit', db.unit, notnull=True, required=True), Field('showall', 'string',IS_LENGTH(1), length=1, requires=IS_LENGHT(1), default='Y', required=True, notnull=True), migrate=False ) /code --- In the Field 'active', I have written --- required=True, notnull=True. From the documentation, the purpose of required is understood. 1) But where does notnull come in action? (whether in AJAX validation or while DAL inserts or somewhere else). 2) For the Field 'active', I want to have a set of 2 values ('Y' 'N'). In FORM, the user would be able to select a value from these 2 values ONLY. (default is 'Y'). How do I do it? Thanks, Vineet
[web2py] Re: db.define_tables
On Thursday, June 9, 2011 1:01:02 PM UTC-4, Vineet wrote: Hi ! Below given is a table --- code db.define_table('ac', Field('acnm','string', IS_LENGTH(100), length=100, required=True), Field('acgrpid', db.acgrp, notnull=True, required=True), Field('active', 'string', IS_LENGTH(1), length=1, requires=IS_LENGHT(1), default='Y', required=True, notnull=True), Field('homeunit', db.unit, notnull=True, required=True), Field('showall', 'string',IS_LENGTH(1), length=1, requires=IS_LENGHT(1), default='Y', required=True, notnull=True), migrate=False ) /code --- In the Field 'active', I have written --- required=True, notnull=True. From the documentation, the purpose of required is understood. 1) But where does notnull come in action? (whether in AJAX validation or while DAL inserts or somewhere else). 'required' is enforced by the DAL, and notnull is enforced by the database itself (it is equivalent to the NOT NULL SQL statement). Note, because notnull affects the actual database table, I think changing it requires migrations to be on. 2) For the Field 'active', I want to have a set of 2 values ('Y' 'N'). In FORM, the user would be able to select a value from these 2 values ONLY. (default is 'Y'). Use requires=IS_IN_SET(['Y','N']). In that case, you won't have to bother with IS_LENGTH. Anthony
Re: [web2py] Re: vars vs. kwargs
pardon me, what is the meaning of *args and **vars? thank you.
[web2py] Re: Project: pydev extension for web2py in Eclipse
After some talking to the Pydev author, we've managed to make a patch to a file in Pydev that calls the build_environment() and run_models_in() functions from web2py, and adds the resulting environment into the __builtins__. The result is you automagically get a fully working web2py environment in eclipse, with autocompletion, etc. You can follow the development on this feature request on Pydev issue tracker: https://sourceforge.net/tracker/?func=detailatid=577332aid=3294887group_id=85796 The procedure is quite manual yet, I hope it can be improved so it is customizable per project. Comments and help are welcome! Greets. On 29 abr, 10:51, Álvaro J. Iradier alvaro.irad...@polartech.es wrote: Hi, I am trying to develop an extension (a Jython script[1]) for Pydev[2] to improve web2py integration into Eclipse (I'm not sattisfied with the existing recipes). I've just started, and you can follow what's going on on the following thread in the Pydev-code mailing list: https://sourceforge.net/mailarchive/forum.php?thread_name=BANLkTik-Sj... If someone is interested on helping, please let me know, I don't have much time available to work on it. Greets. [1]http://pydev.org/manual_articles_scripting.html [2]http://pydev.org/ -- Álvaro J. Iradier Muro Departamento de Desarrollo alvaro.irad...@polartech.es Polar Technologies T +34 976 527 952 F +34 976 466 125www.polartech.es Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente necesario. El medioambiente es cosa de todos. AVISO LEGAL Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración.
Re: [web2py] Re: New Features in Book
a, i c, pardon me, if i'm not wrong massimo said he will get the book update on this august. so that i confirm it, hehe...
Re: [web2py] Re: Cubrid?
glad to know that, thank you so much.
[web2py] Re: Web2Py RoR performances
Good point. The last thing we want is another Python vs RoR vs whatever war. I know that I helped test performance and ran my own benchmarks when Massimo was working performance improvements with regards to session files back in March, since sessions can slow down response times. My own testing found that my app, which is becoming quite large now, had an average response time of 30 ms (without database interaction, of course). I don't care what language or framework you use. If you can get a complex application (with db turned off and no performance tweaks) to give average response times of less than 50 ms, then it doesn't matter how the framework is rendering the files behind the scenes. I've never used RoR so I don't know if it truly is faster or slower, but even if it manages to shave a couple of milliseconds off the average response time compared to web2py by caching everything in memory, does it really matter? Your average response time is still well below 50 ms which is FAST! You will never see a difference between 30 ms and 28 ms. I doubt even Google or Facebook would care about a 2 ms difference. At that point, just use whatever you are most comfortable with.
Re: [web2py] Re: vars vs. kwargs
web2py makes extensive use of these. Take the A, DIV, or TABLE as examples, you can pass HTML attributes (e.g. _class, _id, _style) to these, but if you look at the code, you will notice that these things are not in the signature of these methods. They allow you to provide an unknown number of parameters to a method. For example: def my_method(text, _class='', _style='', _id='', _onclick='') Could easily be rewritten to: def my_method(text, **kwargs) Then kwargs is a dictionary with any extra parameters passed: if '_class' in kwargs: output += 'class = %s' % kwargs['_class'] Using *args on the other hand would be if you didn't expect named parameters to be used, just an unknown number of unnamed paramters. Hope that helps to clarify.
[web2py] Re: Project: pydev extension for web2py in Eclipse
That would be awesome. I tried using Eclipse + PyDev once, but it just felt too big and complicated, especially since it didn't know anything about web2py and couldn't do autocomplete. If this works, I may have to reevaluate Eclipse + PyDev again.
[web2py] FYI Data Brewery - anyone used it?
http://databrewery.org/ Brewery is a Python http://python.org/ framework and collection of tools for analysing and mining data. Goal is to provide functions and tools for: - streaming and processing structured data from various sources, such as CSV, XLS files, Google spreadsheets, relational (SQL) databases, MongoDB (no-sql database),... - data quality auditing - data mining Complementary framework to brewery is *Cubes*: framework for online analytical processing (OLAP)
[web2py] Re: Web2Py RoR performances
for fairness jruby is faster than cpython and jython. jython is slower then all of them. On Jun 9, 11:53 am, pbreit pbreitenb...@gmail.com wrote: This is probably not a discussion we want to start. While Python may have a small performance edge, it's nothing to get excited about. Likewise, the OP makes performance assumptions that may not be realistic. As I thought everyone knew, there are quite a few variables that go in to overall system performance. Database, caching and coding optimizations are as important or more than how the framework works. That said, Massimo and the group have demonstrated a commitment to performance so if you have any specific recommendations or, better, code, I'm sure they'd be happy to consider.
[web2py] Re: Project: pydev extension for web2py in Eclipse
Does this require any modification to web2py? On Jun 9, 12:27 pm, Álvaro J. Iradier airad...@gmail.com wrote: After some talking to the Pydev author, we've managed to make a patch to a file in Pydev that calls the build_environment() and run_models_in() functions from web2py, and adds the resulting environment into the __builtins__. The result is you automagically get a fully working web2py environment in eclipse, with autocompletion, etc. You can follow the development on this feature request on Pydev issue tracker: https://sourceforge.net/tracker/?func=detailatid=577332aid=3294887;... The procedure is quite manual yet, I hope it can be improved so it is customizable per project. Comments and help are welcome! Greets. On 29 abr, 10:51, Álvaro J. Iradier alvaro.irad...@polartech.es wrote: Hi, I am trying to develop an extension (a Jython script[1]) for Pydev[2] to improve web2py integration into Eclipse (I'm not sattisfied with the existing recipes). I've just started, and you can follow what's going on on the following thread in the Pydev-code mailing list: https://sourceforge.net/mailarchive/forum.php?thread_name=BANLkTik-Sj... If someone is interested on helping, please let me know, I don't have much time available to work on it. Greets. [1]http://pydev.org/manual_articles_scripting.html [2]http://pydev.org/ -- Álvaro J. Iradier Muro Departamento de Desarrollo alvaro.irad...@polartech.es Polar Technologies T +34 976 527 952 F +34 976 466 125www.polartech.es Antes de imprimir este mensaje, por favor, compruebe que es verdaderamente necesario. El medioambiente es cosa de todos. AVISO LEGAL Este mensaje, y en su caso, cualquier fichero anexo al mismo, puede contener información confidencial, siendo para uso exclusivo del destinatario, quedando prohibida su divulgación, copia o distribución a terceros sin la autorización expresa del remitente. Si Vd. ha recibido este mensaje erróneamente, se ruega lo notifique al remitente y proceda a su borrado. Gracias por su colaboración.
Re: [web2py] Re: Project: pydev extension for web2py in Eclipse
You can use this project: http://code.google.com/p/neo-insert-imports/ to add automatically the necessary imports for the static analyzer. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
Re: Re: Re: [web2py] Re: web2py 1.96.4 is OUT
2011/6/9 caleb.hatti...@gmail.com On , Anthony abasta...@gmail.com wrote: Do you have an app to reproduce the problem? I created an app named Castalia (note the capitalization) with a module /modules/selfgroup/castalia/config.py, which I think is the same structure and naming as Alessandro's app. In a controller action, I then did: from selfgroup.castalia import config and it seems to work fine, though I believe Alessandro was getting an import error at that point. But maybe I'm missing something. I think we should ask him to make a small test app for us that demonstrates the problem. Else we're guessing. Alessandro, can you send us the code having the unexpected behavior so the Windows guys can take a look? As I understand, you have to remove the capitalization to make it work because otherwise even if the capitalization match, it does not import properly. Right? -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Auth_user ondelete
Hi, I'm new to web2py, but familiar to similar frameworks. I have a system that uses web2py builtin auth_user table. The problem is that I wanna use ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know how to put it in the model file. Anyone can help? Att. Thiago
[web2py] nginx and web2py
I am trying to get web2py going with nginx on a remote server. When I try running it via uswgi and nginx, using wsgihandler.py, it works with the welcome application. However when I try another application it gives me an error that it cannot find .../cache/ cache.shelve. This other application works okay with 'python web2py.py' on the same server. If I create a dummy file called .../cache/cache.shelve, it deletes this file, and then complains it cannot find it! I have given full permissions to both the directory and the file. The VPS uses Centos 5.5, and I am running things on python2.6.1, web2py version 1.96.3 any ideas? Thanks Peter
[web2py] Re: Auth_user ondelete
this should do it Field('name','reference othertable',ondelete='NO ACTION') On Jun 9, 1:14 pm, Thiago Carvalho D' Ávila thiagocav...@gmail.com wrote: Hi, I'm new to web2py, but familiar to similar frameworks. I have a system that uses web2py builtin auth_user table. The problem is that I wanna use ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know how to put it in the model file. Anyone can help? Att. Thiago
[web2py] Re: Auth_user ondelete
On Thursday, June 9, 2011 2:14:59 PM UTC-4, Thiago wrote: I'm new to web2py, but familiar to similar frameworks. I have a system that uses web2py builtin auth_user table. The problem is that I wanna use ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know how to put it in the model file. Anyone can help? Are you saying you want to specify ondelete='NO ACTION' for one of the fields in the builtin auth_user table? It's only relevant for upload and reference fields, and I don't think the auth_user table includes any such fields. Anthony
[web2py] Re: Project: pydev extension for web2py in Eclipse
Yes, I checked that project, but these way would require not adding anything at the headers, and it also parses the models file. It requires no modification in web2py, just in Pydev. Talking to the pydev author in the pydev mailing list, he might consider including support for web2py if we manage to get it working fine, and we are quite there. Greets. On 9 jun, 20:43, Pierre Thibault pierre.thibau...@gmail.com wrote: You can use this project:http://code.google.com/p/neo-insert-imports/to add automatically the necessary imports for the static analyzer. -- A+ - Pierre My blog and profile (http://pierrethibault.posterous.com)http://pierrethibault.posterous.com YouTube page (http://www.youtube.com/user/tubetib)http://www.youtube.com/user/tubetib Twitter (http://twitter.com/pierreth2) http://twitter.com/pierreth2
[web2py] Validator: one of several fields must be non-empty
This validator handles a case where at least one of several fields must be non-blank. class IS_NOT_ALL_EMPTY(object): Class representing a validator requiring at least one non-empty field in a set. def __init__(self, others, error_message='Enter a value in at least one field'): self.others = others self.error_message = error_message def __call__(self, value): okay = (value, None) error = (value, self.error_message) # Return okay either the 'value', or one of self.others is not empty. values = [] values.append(value) values.extend(self.others) empties = [] for v in values: unused_v, empty = is_empty(v) empties.append(empty) # Example empties == [True, True, False] # If one False exists, it's valid if reduce(lambda x, y: x and y, empties): return error return okay Usage: db.define_table('contact', Field('name', 'string' requires=IS_NOT_ALL_EMPTY([request.vars.organization], error_message='Enter a name or an organization'), ), Field('organization', 'string', requires=IS_NOT_ALL_EMPTY([request.vars.name], error_message='Enter a name or an organization'), )) Cheers, Jim Karsten
[web2py] Re: Validator: one of several fields must be non-empty
Cool. Maybe add a slice for this: http://www.web2pyslices.com/main/default/index On Thursday, June 9, 2011 5:13:43 PM UTC-4, Jim Karsten wrote: This validator handles a case where at least one of several fields must be non-blank. class IS_NOT_ALL_EMPTY(object): Class representing a validator requiring at least one non-empty field in a set. def __init__(self, others, error_message='Enter a value in at least one field'): self.others = others self.error_message = error_message def __call__(self, value): okay = (value, None) error = (value, self.error_message) # Return okay either the 'value', or one of self.others is not empty. values = [] values.append(value) values.extend(self.others) empties = [] for v in values: unused_v, empty = is_empty(v) empties.append(empty) # Example empties == [True, True, False] # If one False exists, it's valid if reduce(lambda x, y: x and y, empties): return error return okay Usage: db.define_table('contact', Field('name', 'string' requires=IS_NOT_ALL_EMPTY([request.vars.organization], error_message='Enter a name or an organization'), ), Field('organization', 'string', requires=IS_NOT_ALL_EMPTY([request.vars.name], error_message='Enter a name or an organization'), )) Cheers, Jim Karsten
Re: [web2py] FYI Data Brewery - anyone used it?
nice info, will try and take a look, thank you.
Re: [web2py] Re: ajax form submission
it works on me too, pbreit, thank you so much. when i use the simple it works fine, but when i try to expand it (i mean using components, ajax and jquery it's not work). On Thu, Jun 9, 2011 at 5:11 AM, pbreit pbreitenb...@gmail.com wrote: It worked for me with a normal query: db(db.post.id0).select(orderby = ~db.post.id)
Re: [web2py] Re: Auth_user ondelete
I have this auth_user table, and another table called activities. This activities have 2 fields that are foreing keys to user (created by and modified by). If I delete any user that created or modified one activity, the activity is deleted. Do I have to put NO ACTION in all fields that is foreign key to user? I don't see how NO ACTION in the ondelete of activity solves my problem... Sorry I'm very confused. I just got one system made by some other people (with no documentation =( ) and I am trying to understand to maintain it... 2011/6/9 Anthony abasta...@gmail.com On Thursday, June 9, 2011 2:14:59 PM UTC-4, Thiago wrote: I'm new to web2py, but familiar to similar frameworks. I have a system that uses web2py builtin auth_user table. The problem is that I wanna use ondelete='NO ACTION' in my app (it is CASCADE by default), and I don't know how to put it in the model file. Anyone can help? Are you saying you want to specify ondelete='NO ACTION' for one of the fields in the builtin auth_user table? It's only relevant for upload and reference fields, and I don't think the auth_user table includes any such fields. Anthony
Re: [web2py] Re: ajax form submission
The Ajax worked OK for me. I used your exact same code except I switched/fixed this one line: results = db().select(orderby = ~db.post.id) to results = db(db.post.id0).select(orderby = ~db.post.id)
[web2py] Re: Validator: one of several fields must be non-empty
Is there an ETA on Slices2?
Re: [web2py] Re: Auth_user ondelete
On Thursday, June 9, 2011 6:59:34 PM UTC-4, Thiago wrote: I have this auth_user table, and another table called activities. This activities have 2 fields that are foreing keys to user (created by and modified by). If I delete any user that created or modified one activity, the activity is deleted. Do I have to put NO ACTION in all fields that is foreign key to user? I don't see how NO ACTION in the ondelete of activity solves my problem... Sorry I'm very confused. I just got one system made by some other people (with no documentation =( ) and I am trying to understand to maintain it... I think you would specify ondelete='NO ACTION' in the reference fields in the 'activities' table.