Re: [web2py] Re: Scalability of web2py?
We, people used to free software, keep forgetting some goodies of things like web2py, since we give those for granted. - full version, no demo or limited in time bull - see how it is coded and know the *real* quality - code written to solve problems and not sell licences - support from the ones that designed the software mic 2010/11/30 mdipierro mdipie...@cs.depaul.edu: I second! On Nov 29, 10:31 pm, Jason Brower encomp...@gmail.com wrote: You may be suprised how good you are. Especially in such short time you can improve. I went from barely scraping up web-pages to some pretty impressive intra-net sites in just a few months. .Net will eventually teach you how not to code. It makes you truly appriciate web2py. It's tough to have persuade people that have a big bully behind them. I know the feeling, but if you can develop the prototype and you do it right, you win. Besides, I wonder if this consultant is coding at all. His skills to code is directly relative to the statements he makes, at least to me. BR, Jason On Mon, 2010-11-29 at 18:09 -0600, Lorin Rivers wrote: The number of people that can write code better than I can is close to the number of people who CAN write code… On Nov 29, 2010, at 17:08 , Branko Vukelic wrote: We know .NET will scale to thousands of nodes IF you write the .NET code right. If you write crappy code (and that's inevitable if you don't like .NET or you don't know .NET), it will not only NOT run on thousands of nodes, but will probably crash all of them. Having said that... if they can help you write better code on .NET than you currently write in web2py, the above argument turns on you. On Mon, Nov 29, 2010 at 7:49 PM, Lorin Rivers lriv...@mosasaur.com wrote: Unfortunately, the killing argument is we know .NET will scale to thousands of nodes, blah, blah, blah. This from (a guy who's smart and I respect, honestly) who uses his brand-new top-of-the-line 17 MBP to run Windows VMs in Parallels. On Nov 29, 2010, at 12:20 , Julio Schwarzbeck wrote: And this without considering vendor lock-in. web2py can run on a variety of platforms such as windows, macs. Linux and others, same goes for the selection of the back-end database. Much more flexibility under web2py in my opinion and prototyping is much faster in python. On Nov 29, 10:05 am, mdipierro mdipie...@cs.depaul.edu wrote: You achieve scalability by replicating the web server behind a load balancer. This is documented in the book, chapter 11, using HAProxy. All frameworks work the same way in this respect. web2py has no intrinsic limitations. The bottle neck is the database connection. All frameworks have the same problem. You can replicate the database too and web2py supports multiple database clients with Round-Robin. On a small VPS, web2py in average, should execute one page in 20ms. Depending on how many requests/second you need you can determine how many servers you need. web2py apps run on Google App Engine and that means arbitrary scalability as long as you can live with the constraints imposed by the Google datastore (these limitations will go away as soon as Google releases MySQL in the cloud, which they announced some time ago). Please ask the consultant: which .NET feature makes it scale any better than web2py or Rails? If he explains we can address it more specifically. Massimo On Nov 29, 11:56 am, Lorin Rivers lriv...@mosasaur.com wrote: The project I'm working on has hired a consultant who is now recommending .Net in place of web2py or even rails. What's the 'largest' scale web2py is known to perform well on? -- Lorin Rivers Mosasaur: Killer Technical Marketing http://www.mosasaur.com mailto:lriv...@mosasaur.com 512/203.3198 (m) -- Lorin Rivers Mosasaur: Killer Technical Marketing http://www.mosasaur.com mailto:lriv...@mosasaur.com 512/203.3198 (m) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Space makes the difference ? what's the preferred substitution, string or objects
hello, I'm trying to build some (not trivial) queries and encounter a number of problems my first problem is that a space makes a huge difference, is that to be expected ? this *works* as (I) expected Select = Name, Test_Count Rows = DB ( Query ).select ( Select ) print Rows[0] Row {'_extra': Row {'Test_Count': 1000, 'Name': u'breath_algvm'}} but removing the space from the string, gives me an *unexpected result* Select = Name,Test_Count ### -- space removed Rows = DB ( Query ).select ( Select ) print Rows[0] Row {'_extra': Row {'Name,Test_Count': u'breath_algvm'}} The second problem, has to do with what's the preferred substitution, string or objects ? this *works* : Select = DB.VraagList.Name Rows = DB ( Query ).select ( Select ) print Rows[0] This *doesn't work* Select = DB.VraagList.Name, DB.VraagList.id Rows = DB ( Query ).select ( Select ) print Rows[0] for the record, this is the Query in all the above PID = 1018 Query = ( DB.VraagList.id == DB.Opnamen.VLID ) \ ( DB.Opnamen.PID == PID ) thanks, Stef Mientki
[web2py] Re: documentation flow
It's exactly I mean...Thank you. On 27 nov, 02:13, DenesL denes1...@yahoo.ca wrote: The book navigation could be improved, and I mentioned this recently to Massimo; specially for the majority of us that still depend on it. For example, the general index entries do a search of the term instead of taking you directly to where it is defined, not very efficient. If I want to find something fast I have to use my PDF copy but alas, it does not include the latest features. Reading the group posts is a great way to learn and more so if you try to answer some of them; time consuming, yes, but learning requires some commitment. Denes. On Nov 26, 7:36 pm, Branko Vukelic bg.bra...@gmail.com wrote: On Fri, Nov 26, 2010 at 4:54 PM, oncle_bob julien.hautefeui...@gmail.com wrote: I like web2py product but I don't recommend it. The documentation and To each their own, eh? :) features flow is too spreaded and too speeded. Why don't you publish the book and documentation in html files, it's easier to check features and API point. The book reading is not fun to read and search You'll find both the book and the API docs in the documentation section. I would've sworn that's the first place anyone would look, but I guess I'd be wrong. :) Online book:http://web2py.com/book API:http://www.web2py.com/examples/static/epydoc/index.html API section in the book:http://web2py.com/book/default/chapter/04#API anything. If I don't read the group, I miss a lot of. Developper can't spend all time to read group ;) every day. Some of us are obviously happy with reading this list. :) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group
[web2py] Re: documentation flow
I follow the project from the starting ;) On 27 nov, 02:32, Phyo Arkar phyo.arkarl...@gmail.com wrote: i guess he dont even bother to read homepage well :D On 11/27/10, DenesL denes1...@yahoo.ca wrote: The book navigation could be improved, and I mentioned this recently to Massimo; specially for the majority of us that still depend on it. For example, the general index entries do a search of the term instead of taking you directly to where it is defined, not very efficient. If I want to find something fast I have to use my PDF copy but alas, it does not include the latest features. Reading the group posts is a great way to learn and more so if you try to answer some of them; time consuming, yes, but learning requires some commitment. Denes. On Nov 26, 7:36 pm, Branko Vukelic bg.bra...@gmail.com wrote: On Fri, Nov 26, 2010 at 4:54 PM, oncle_bob julien.hautefeui...@gmail.com wrote: I like web2py product but I don't recommend it. The documentation and To each their own, eh? :) features flow is too spreaded and too speeded. Why don't you publish the book and documentation in html files, it's easier to check features and API point. The book reading is not fun to read and search You'll find both the book and the API docs in the documentation section. I would've sworn that's the first place anyone would look, but I guess I'd be wrong. :) Online book:http://web2py.com/book API:http://www.web2py.com/examples/static/epydoc/index.html API section in the book:http://web2py.com/book/default/chapter/04#API anything. If I don't read the group, I miss a lot of. Developper can't spend all time to read group ;) every day. Some of us are obviously happy with reading this list. :) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group
Re: [web2py] Re: Scalability of web2py?
On Tue, Nov 30, 2010 at 1:09 AM, Lorin Rivers lriv...@mosasaur.com wrote: The number of people that can write code better than I can is close to the number of people who CAN write code… Let me share an anecdote from where I work. One of the IT staff here fiddles with VB from time to time. He does consider himself an intermediate programmer. So he comes to me from time to time to ask for advice on how to do this or that. And each time, my first response is: Try to google out a library that does that. It almost always turns out that there is (a) no such library shared on the net, or (b) you have to pay for it. That's the kind of eco system he's in. We all know how beautifully different that is with open-source software. So, it's not just writing code. It's about I'm not the brightest kid on the block, and there might be others, who are smarter, and have maybe shared their smarts with the rest of us. And you download that lib, and you learn the API, read the source, and learn a thing or two. So you don't always have to write better code than others. Having said all of above... I've tried Ruby, Erlang, VB, Python, a little bit of C. You always learn a few things by just trying to get something working in any environment, and you can use that knowledge to advance your understanding of the tool you chose. In other words, a little experimenting with .NET won't hurt you a bit. If I'm not mistaken, there's express version of whatever tool Microsoft offers, and you can use that to educate yourself. See how it works and define your arguments against it with something to back it up. And MSDN is a fine piece of knowledge base, too, just to be fair. I've learned a lot from it alone back when I didn't know how to google for stuff. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Re: accessible_query implement in GAE.
And what do you recommend if I have the need to obtain from the database only records for which the user performing the query has read permission? 2010/11/30 mdipierro mdipie...@cs.depaul.edu Not yet. On Nov 29, 9:38 pm, appydev appy...@gmail.com wrote: Greetings Is there any way to do something like this in GAE? rows = db (auth.accessible_query ('read', db.mytable)). select (db.mytable.ALL) Thanks
[web2py] Re: Space makes the difference ? what's the preferred substitution, string or objects
On Nov 30, 7:57 am, Stef Mientki stef.mien...@gmail.com wrote: hello, I'm trying to build some (not trivial) queries and encounter a number of problems my first problem is that a space makes a huge difference, is that to be expected ? this *works* as (I) expected Select = Name, Test_Count Rows = DB ( Query ).select ( Select ) it is select(*fields, **attributes) where fields is a alist and attributes is a dictionary (according to python not web2py) print Rows[0] Row {'_extra': Row {'Test_Count': 1000, 'Name': u'breath_algvm'}} here you are just lucky that the internal processing builds something similar to what is required for the real DB query, you can see it using: DB(Query)._select(Select) # note the underscore but removing the space from the string, gives me an *unexpected result* Select = Name,Test_Count ### -- space removed Rows = DB ( Query ).select ( Select ) print Rows[0] Row {'_extra': Row {'Name,Test_Count': u'breath_algvm'}} The second problem, has to do with what's the preferred substitution, string or objects ? this *works* : Select = DB.VraagList.Name Rows = DB ( Query ).select ( Select ) print Rows[0] This *doesn't work* Select = DB.VraagList.Name, DB.VraagList.id python (not web2py) creates a tuple with both fields which is usable as explained below Rows = DB ( Query ).select ( Select ) the correct call (python's rules) would be: Rows = DB ( Query ).select( *Select ) print Rows[0] for the record, this is the Query in all the above PID = 1018 Query = ( DB.VraagList.id == DB.Opnamen.VLID ) \ ( DB.Opnamen.PID == PID ) thanks, Stef Mientki
[web2py] Re: Any web2py/python web developers in Salt Lake City?
You can find people from all over the world in experts4solutions.com, or post an offer here and choose from the replies. On Nov 30, 12:39 am, cadrentes cadren...@gmail.com wrote: I've been learning but too slowly to put together the application I envision, not my main job...looking for someone who can help.
[web2py] Re: Is there a way within the web2py DAL to create an alternate/secondary surrogate key on the fly?
Thanks for the help. For some reason, though, the compute function doesn't like when 'id' is referred to in this way and throws the exception KeyError: 'id'. I also looked into creating a custom validator, which I think would be handy if I wanted to do something more complex. But then I thought that all I'm really trying to do here is show users a friendly version of the primary key that already exists, so I chose to use the represent function: Field('id','id', represent=lambda id:SPAN('Q',str(id+10),' ',A('view',_href=URL('firm_read',args=id It's not a very sophisticated solution, but it seems to work without creating the overhead of maintaining an additional key field. If anyone sees a huge flaw in this approach, please let me know. Regards. Jeff On Nov 30, 1:58 am, cjrh caleb.hatti...@gmail.com wrote: On Nov 30, 1:37 am, SaltyCow jeff.bienkow...@gmail.com wrote: For example, I have a table quote and I would like to be able to refer to a given quote as something like Q13. The actual primary key (id) of the row for that quote may be just plain 3, but it's not convenient to refer to a quote that way in emails, etc. I had to do something similar recently: auto-create a password-like key in a record (created as a sub-component of uuid.uuid4()), but only on record creation. The problem with compute() is that it runs every time a record is updated, and the dict passed to the compute() function does not contain the current value of the field being computed, so you can't monitor that for deciding whether or not to create a new one. OTOH, if you're always going to base your number on the PK, then the PK will never change and therefore compute() should be fine, because your compute function will always calculate the same output for a given record. Perhaps something like this: Field('myfield', compute=lambda d: 'Q' + str(d['id'] + 1)) (Post your code for your compute() function implementation) In the end, for my scenario, we just wrote a custom validator. I don't have the code handy right now, but the book description of validators is reasonable, so that should be enough to get you started if compute() is insufficient for your needs.
[web2py] SQLTABLE columns parameters doesn't work as expected
Hi all, I tried to filter the columns shown by SQLTABLE by adding an explicit columns parameter: {{=SQLTABLE(rows,headers=headers,columns=['id', 'my_field_name'])}} It turns out that this doesn't work, and results in an Internal Error, with the ticket pointing to an vague KeyError: '_extra' in gluon/ sql.py Reading the sql.py code, I discovered that SQLTABLE expects the columns parameter to be a list of column names prefixed with the table name. Changing the code to use the prefixed column names solved the problem: {{=SQLTABLE(rows,headers=headers,columns=['my_table.id', 'my_table.my_field_name'])}} However, this forces you to manually insert the table name, which is ugly. A better example would extract the table name from the rows object (BTW, isn't there a more direct way to get the table name?): {{tablename = rows.records[0].keys()[0]}} {{prefixed_columns = [%s.%s % (tablename, col) for col in columns]}} {{=SQLTABLE(rows,headers=headers,columns=prefixed_columns)}} This behaviour of the columns parameter struck me as unintuitive, and the web2py book doesn't mention this important detail. It would be better to either change the behaviour of the columns parameter or explicitly document this in the web2py docs and book.
[web2py] Re: Is there a way within the web2py DAL to create an alternate/secondary surrogate key on the fly?
On Nov 30, 10:59 am, SaltyCow jeff.bienkow...@gmail.com wrote: Thanks for the help. For some reason, though, the compute function doesn't like when 'id' is referred to in this way and throws the exception KeyError: 'id'. I also looked into creating a custom validator, which I think would be handy if I wanted to do something more complex. But then I thought that all I'm really trying to do here is show users a friendly version of the primary key that already exists, so I chose to use the represent function: Field('id','id', represent=lambda id:SPAN('Q',str(id+10),' ',A('view',_href=URL('firm_read',args=id Nothing wrong with it. A bit speedier: SPAN('Q%s' %(id+10)) or if you don't want the '1' after the Q SPAN('Q%06d' %id) It's not a very sophisticated solution, but it seems to work without creating the overhead of maintaining an additional key field. If anyone sees a huge flaw in this approach, please let me know. Regards. Jeff
[web2py] Re: SQLTABLE columns parameters doesn't work as expected
The problem is that the book does not mention it clearly. This is the correct behavior because remember rows may be result of a join and contain columns form multiple tables. On Nov 30, 10:06 am, olifante tiago.henriq...@gmail.com wrote: Hi all, I tried to filter the columns shown by SQLTABLE by adding an explicit columns parameter: {{=SQLTABLE(rows,headers=headers,columns=['id', 'my_field_name'])}} It turns out that this doesn't work, and results in an Internal Error, with the ticket pointing to an vague KeyError: '_extra' in gluon/ sql.py Reading the sql.py code, I discovered that SQLTABLE expects the columns parameter to be a list of column names prefixed with the table name. Changing the code to use the prefixed column names solved the problem: {{=SQLTABLE(rows,headers=headers,columns=['my_table.id', 'my_table.my_field_name'])}} However, this forces you to manually insert the table name, which is ugly. A better example would extract the table name from the rows object (BTW, isn't there a more direct way to get the table name?): {{tablename = rows.records[0].keys()[0]}} {{prefixed_columns = [%s.%s % (tablename, col) for col in columns]}} {{=SQLTABLE(rows,headers=headers,columns=prefixed_columns)}} This behaviour of the columns parameter struck me as unintuitive, and the web2py book doesn't mention this important detail. It would be better to either change the behaviour of the columns parameter or explicitly document this in the web2py docs and book.
[web2py] Re: SQLTABLE columns parameters doesn't work as expected
Book fixed. On Nov 30, 11:17 am, mdipierro mdipie...@cs.depaul.edu wrote: The problem is that the book does not mention it clearly. This is the correct behavior because remember rows may be result of a join and contain columns form multiple tables.
[web2py] Re: Scalability of web2py?
Even though I get your point, I ffeel that putting your eggs in the MS basket is a really bad idea. Yes, one can learn from these frameworks, C# has come a long way to be a relatively cool language (which incidentally is because it has been pythonized during his later incarnations, if anyone does not believe me just check C#' Dynamic object and attribute declaration, heck, they even talk about duck typing as a valid paradigm.. Here is the problem with the MS environment: it's *not* googling string methods, but real questions such as instantiating a COM component gives error 0x0a0b0d0e0f (after you followed the same procedure on a previous PC without problems), you will get the wirdiest set of answers (including some classic ones such reboot the pc, or make sure you have the latest service patch - translation: useless answers) but *rarely* you will get a right answer. With python, and possibly other open source technologies, it is morelikely you find you answer pretty quickly OR you just write your own solution as opposed to having to end up calling golden or platinum or whatever precious metal MS uses now as an excuse to get your money.. Stick with python (and web2py for that matter), you will do youself a great favor on the long run. Julio On Nov 30, 5:31 am, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 30, 2010 at 1:09 AM, Lorin Rivers lriv...@mosasaur.com wrote: The number of people that can write code better than I can is close to the number of people who CAN write code… Let me share an anecdote from where I work. One of the IT staff here fiddles with VB from time to time. He does consider himself an intermediate programmer. So he comes to me from time to time to ask for advice on how to do this or that. And each time, my first response is: Try to google out a library that does that. It almost always turns out that there is (a) no such library shared on the net, or (b) you have to pay for it. That's the kind of eco system he's in. We all know how beautifully different that is with open-source software. So, it's not just writing code. It's about I'm not the brightest kid on the block, and there might be others, who are smarter, and have maybe shared their smarts with the rest of us. And you download that lib, and you learn the API, read the source, and learn a thing or two. So you don't always have to write better code than others. Having said all of above... I've tried Ruby, Erlang, VB, Python, a little bit of C. You always learn a few things by just trying to get something working in any environment, and you can use that knowledge to advance your understanding of the tool you chose. In other words, a little experimenting with .NET won't hurt you a bit. If I'm not mistaken, there's express version of whatever tool Microsoft offers, and you can use that to educate yourself. See how it works and define your arguments against it with something to back it up. And MSDN is a fine piece of knowledge base, too, just to be fair. I've learned a lot from it alone back when I didn't know how to google for stuff. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group
[web2py] Best way to edit SQLFORM input before passing to accepts?
I'm developing an application with web2py that asks a user to submit text in a textarea, and after the user hits submit I want to parse the input and assign a 'type' to the submission depending on the frequency of a word used from the submitted text. Following is the associated code that I'm using. This is at the top of my controller/default.py: try: db.moment.user_id.default = auth.user.id except: pass response.moment_form = SQLFORM(db.moment) if response.moment_form.accepts(request.vars, formname='moment_submit_form'): response.flash = 'form accepted' elif response.moment_form.errors: response.flash = 'form has errors %s' % response.moment_form.vars.type and the associated views/layout.html: {{if auth.is_logged_in():}} form method=post textarea class=text cols=40 id=moment_content name=content rows=10/textarea input type=submit value=Submit input type=hidden name=type value=worst / input type=hidden name=_formname value=moment_submit_form / /form {{else:}} Sign in to play! {{pass}} I've tried adding, just for debugging purposes: db.moment.type.default = 'worst' To assign a static type after the form is submitted however that only returns errors. I'm thinking using a component as described in chapter 13 of the book would be the way to go but I was worried it wouldn't solve this issue, so I posted this here.
[web2py] Re: Best way to edit SQLFORM input before passing to accepts?
Forgot to mention: I realize I can fully do this with jQuery client-side however I'm unsure if this is the fastest and safest method to use. If you think jQuery would be the best bet then I'll get on putting that in pronto.
[web2py] Wizard + Plugin Wiki
Searching the group didn't turn up anything about this, so I suspect I'm doing something wrong (or need to do something more). Scenario 1: I've created an application using the wizard, nothing fancy, just the basic auth tables and associated controllers, etc. All point and click. When I add the plugin wiki to this app, the menu doesn't change to add in Pages, and if I go into the plugin via the admin interface and try to go to its index page, I get an Access Denied message. Scenario 2: I create a new simple application, and add the plugin wiki to that. The Pages link shows up when I'm logged in just like you'd expect. So, is there an incompatibility between the wizard and the plugin wiki? What extra do I need to do to get them to work together? I love the speed of the wizard for generating a lot of the boilerplate, but also want to use the wiki for generating mostly static pages.
[web2py] Re: Scalability of web2py?
I think .NET and web2py are not competitors. They are different ball games. When things scale large, everything is important. A small design issue might be magnified. I don't think web2py is proven yet, in terms of scalability. What web2py needs is at least one real example to show that it is scalable and what are the limits at the extreme.
[web2py] Re: Best way to edit SQLFORM input before passing to accepts?
Try this. Let's say the textarea field is the_text. if 'the_text' in request.vars: your_form.vars.type = process(...) if your_form.accepts(requrest.vars, session): # do your things On Nov 30, 10:59 am, hswolff hswo...@gmail.com wrote: I'm developing an application with web2py that asks a user to submit text in a textarea, and after the user hits submit I want to parse the input and assign a 'type' to the submission depending on the frequency of a word used from the submitted text.
[web2py] how do get me to imporsonate a generic user?
Hi, I would like to make use of the following snippet (something I have here often enough) * in controller db.someTable.user==me)).select() * in db.py if auth.is_logged_in(): me=auth.user.id else: me=None How do I turn this into something like if auth.is_logged_in(): genericUser=auth.user.id while the user is visiting on THIS page, they can as an option, assume a generic user's ID to view his stuff (file system resources) but with stricter permission (like view and download, but not change or delete? Thanks, Mart :)
Re: [web2py] Any web2py/python web developers in Salt Lake City?
I'm a Mormon. (Yes I am...) does that count. :) I would be happy to help ya. On Mon, 2010-11-29 at 21:39 -0800, cadrentes wrote: I've been learning but too slowly to put together the application I envision, not my main job...looking for someone who can help. attachment: face-smile.png
[web2py] Re: AppEngine turning off the routes logging
I've tried setting logging.basicConfig(level=logging.WARNING) in main.py but this didn't work. All the debug messages were still in the logs. However, the logging.conf worked. I've just used the example one which sets everything to warning, and the debug messages were gone. So I think the logging policy described in the Sanderson's book is no longer in place and it's possible to control the level now :)
[web2py] Re: Wizard + Plugin Wiki
Okay, so I see the note from about a month ago, on the wizard video, about it not being compatible with the plugin wiki. Assuming that hasn't been fixed in the past month, does anyone have a good handle on what's needed to get the two to play well together?
[web2py] Design advice for many to many
I'm hoping those of you more experienced with web2py can give me advice on the best way of using the framework to achieve the effect I'd like. I have a many to many relationship between two models, such as a student enrolled in many courses, and a course having many students enrolled in it. I also have links and controller methods that will need secured based on those relationships. A student in a course, for example, would be able to see the My Grades link but a student who wasn't in the course would not see that link. I see a couple of ways to do that. Traditional: the traditional way would be to create a model to represent the relationship between students and courses. That gives me a place to put extra information about the relationship, which is good. But to secure this, I'm not using web2py's role based auth model, but instead writing my own permission methods that check the new model. Role based: I could instead assign users roles based on the relationships. For example, if a student enrolls in a course that has an id of 25, I could assign the student the role enrolled_25. The advantage here is that I get to use web2py's auth model for securing links and methods. But users will accumulate roles over time. To list out the courses a student is in would require searching though all their roles. This feels to me like using a hammer to pound in a screw. What techniques have you used with web2py for this sort of situation? Is there a way to tie web2py's auth mechanism to a model representing the relationship?
Re: [web2py] Re: Using Jython with web2py
When I need to have fun I go reading this on springpython home: Spring Python is an offshoot of the Java-based Spring Framework and Spring Security, targeted for Python. Spring provides many useful features, and I wanted those same features available when working with Python. I always thought the other way, I need Spring in Java for doing the most basic things that can be done in Python :-D mic 2010/11/29 mdipierro mdipie...@cs.depaul.edu: For me Enterprise means: - easy to use (low startup costs) - always backward compatible (worth the investment) - enterprise = business + non-profit; enterprise != large bloated bussiness I do not disagree with your definition: pragmatic, agile and extensible web framework for fast development. On Nov 29, 2:58 am, pierreth pierre.thibau...@gmail.com wrote: On Nov 29, 1:39 am, mdipierro mdipie...@cs.depaul.edu wrote: please let us know if things work or do not work. We have not tested web2py with jython much, Massimo Well, I won't dig that much in Jython with web2py for the moment. In a longer term interest, I would like to be able to use web2py in a Java infrastructure with Hibernate. I think it might be a really nice tool for prototyping in the enterprise world. Also I would like to use web2py with sqlalchemy with Python Spring. I see the mix of the three as a potential solution for the enterprise world too. In fact, I don't understand that you labeled web2py as an Enterprise Web Framework. Without wanting to offend you, I see web2py as a pragmatic, agile and extensible web framework for fast development. I think web2py as a too tight coupling for enterprise development. DAL in not a real ORM and it does not make it easy to apply domain driven design. Add the fact that the web2py book is mixing presentation with the control, I think web2py is favoring pragmatism over abstraction. It is not bad by itself but it conflicts with my vision of the enterprise way. I would appreciate your comments. Pierre
Re: [web2py] Re: AppEngine turning off the routes logging
On Nov 30, 2010, at 1:25 PM, Wikus van de Merwe wrote: I've tried setting logging.basicConfig(level=logging.WARNING) in main.py but this didn't work. All the debug messages were still in the logs. However, the logging.conf worked. I've just used the example one which sets everything to warning, and the debug messages were gone. So I think the logging policy described in the Sanderson's book is no longer in place and it's possible to control the level now :) Thanks for the update.
[web2py] OFFTOPIC: FUNNY: SEO specialists
How many SEO specialists are needed to change lightbulb bulb bulbs light cheap affordable? :) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Table names: plural or singular?
Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural.
[web2py] Re: Table names: plural or singular?
+1 for singular, it does look better in the code. On Nov 30, 4:48 pm, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural.
[web2py] Re: Best way to edit SQLFORM input before passing to accepts?
Your model should have type as readable=False, writable=False and in the accepts part or via an onvalidation function you can set it to what you want. You code seems strange though: - you are using the whole controller, not an action and view for it - returning the form inside response Any reason to do that?. On Nov 30, 11:59 am, hswolff hswo...@gmail.com wrote: I'm developing an application with web2py that asks a user to submit text in a textarea, and after the user hits submit I want to parse the input and assign a 'type' to the submission depending on the frequency of a word used from the submitted text. Following is the associated code that I'm using. This is at the top of my controller/default.py: try: db.moment.user_id.default = auth.user.id except: pass response.moment_form = SQLFORM(db.moment) if response.moment_form.accepts(request.vars, formname='moment_submit_form'): response.flash = 'form accepted' elif response.moment_form.errors: response.flash = 'form has errors %s' % response.moment_form.vars.type and the associated views/layout.html: {{if auth.is_logged_in():}} form method=post textarea class=text cols=40 id=moment_content name=content rows=10/textarea input type=submit value=Submit input type=hidden name=type value=worst / input type=hidden name=_formname value=moment_submit_form / /form {{else:}} Sign in to play! {{pass}} I've tried adding, just for debugging purposes: db.moment.type.default = 'worst' To assign a static type after the form is submitted however that only returns errors. I'm thinking using a component as described in chapter 13 of the book would be the way to go but I was worried it wouldn't solve this issue, so I posted this here.
Re: [web2py] Table names: plural or singular?
On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural. +1 for plural, just to make the discussion more interesting. :) Anyway, the reason for plurals is: it's a table, so it contains many records for something. Reason for singular is: ... it looks better in the API. singular in an API example: get.people.last() vs Get last person get.person.last() vs Get last person (more similar?) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
Re: [web2py] Table names: plural or singular?
I prefer singular for the Object models and plural for the tablenames. class Person: __tablename__ = 'people' Since the table contains many of the records, but an object instance will only contain one of those rows. -- Thadeus On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural. +1 for plural, just to make the discussion more interesting. :) Anyway, the reason for plurals is: it's a table, so it contains many records for something. Reason for singular is: ... it looks better in the API. singular in an API example: get.people.last() vs Get last person get.person.last() vs Get last person (more similar?) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] plugin_wiki problems
hi 1. with the table new like this: db.define_table('new', SQLField('photo_id', 'string'), SQLField('name', 'string', notnull=True, length=16, requires=IS_NOT_EMPTY()), SQLField('created', 'datetime', notnull=True,default=datetime.datetime.now(),requires=IS_DATETIME()), SQLField('created_by', 'string'), SQLField('tag', 'string'), SQLField('link', 'string', length=80, default=None, requires=IS_URL()), SQLField('type', 'string', notnull=True, length=16, default=types[0], requires=IS_IN_SET(types)), SQLField('slug', 'string', length=32, default=''), SQLField('description', 'text', notnull=True,length=64, requires=IS_NOT_EMPTY()) ) Using plugin_wiki, I can't use the read widget. Other widgets like jqgrid work fine. 2. How can I access my app model from the plugin_wiki? 3. how should I map a controller to a plugin_wiki page? Thank you Best regards
Re: [web2py] Re: Space makes the difference ? what's the preferred substitution, string or objects
thanks Denes, I think I understand it now. I often make this mistake, I start as A.select ( 'Name', 'Module' ) now if the selct list becomes too large, I put it in an internediate variable, just by cutting and pasting Select = 'Name', 'Module' A.select ( Select ) and yes it's Python, now Select is packed :-( Or I start with a single Field name Select = 'Name' A.select ( Select ) And in my ignorance I add an extra fieldname to Select Select = 'Name', 'Module' same story :-( As web2py is so tolerant, I wonder why web2py doesn't it support the last remaining possibilities: Set.select ( x ), works if x = + nothing + DB.Table.ALL + fieldname as a string + FieldObject as DB.Table.Field + FieldObject as DB.Table [ 'Field' ] + unpacked iterable of fieldnames (each as a string) + unpacked iterable of FieldObjects Set.select ( x), doesn't work if x = - empty string - None - string, where fields are comma separated - packed iterable of fieldnames (each as a string) - packed iterable of FieldObjects as an excercise, I wrote a litlle wrapper, that takes anything, very handy for people like me ;-) def Test_Select ( Select, Text ) : from General_Globals import Iterable if not ( Select ) : print Text, A.select ()[:2] return if isinstance ( Select, basestring ) and ( ',' in Select ) : Select = Select.split(',') if Iterable ( Select ) : print Text, A.select ( *Select )[:2] else : print Text, A.select ( Select )[:2] Test_Select ( '', 'Empty string:') Test_Select ( None, 'None:') Test_Select ( 'Name,Module', 'Comma separated string:') Test_Select ( ['Name', 'Module'], 'Packed string iterable:') Test_Select ( [DB.VraagList.Name, DB.VraagList.Module], 'Packed iterable of FieldObjects') Test_Select ( [DB.VraagList['Name'], DB.VraagList['Module']], 'Packed iterable of FieldObjects') On 30-11-2010 15:10, DenesL wrote: On Nov 30, 7:57 am, Stef Mientki stef.mien...@gmail.com wrote: hello, I'm trying to build some (not trivial) queries and encounter a number of problems my first problem is that a space makes a huge difference, is that to be expected ? this *works* as (I) expected Select = Name, Test_Count Rows = DB ( Query ).select ( Select ) it is select(*fields, **attributes) where fields is a alist and attributes is a dictionary (according to python not web2py) print Rows[0] Row {'_extra': Row {'Test_Count': 1000, 'Name': u'breath_algvm'}} here you are just lucky that the internal processing builds something similar to what is required for the real DB query, you can see it using: DB(Query)._select(Select) # note the underscore but removing the space from the string, gives me an *unexpected result* Select = Name,Test_Count ### -- space removed Rows = DB ( Query ).select ( Select ) print Rows[0] Row {'_extra': Row {'Name,Test_Count': u'breath_algvm'}} The second problem, has to do with what's the preferred substitution, string or objects ? this *works* : Select = DB.VraagList.Name Rows = DB ( Query ).select ( Select ) print Rows[0] This *doesn't work* Select = DB.VraagList.Name, DB.VraagList.id python (not web2py) creates a tuple with both fields which is usable as explained below Rows = DB ( Query ).select ( Select ) the correct call (python's rules) would be: Rows = DB ( Query ).select( *Select ) print Rows[0] for the record, this is the Query in all the above PID = 1018 Query = ( DB.VraagList.id == DB.Opnamen.VLID ) \ ( DB.Opnamen.PID == PID ) thanks, Stef Mientki
Re: [web2py] Re: Scalability of web2py?
On 30-11-2010 21:08, VP wrote: I think .NET and web2py are not competitors. They are different ball games. When things scale large, everything is important. A small design issue might be magnified. I don't think web2py is proven yet, in terms of scalability. What web2py needs is at least one real example to show that it is scalable and what are the limits at the extreme. I'm not sure were session files are used for, but isn't file access much slower than database access ? Can session files be turned of ? cheers, Stef
Re: [web2py] Table names: plural or singular?
Yeah, this is the pattern I usually use, too. On Wed, Dec 1, 2010 at 12:41 AM, Thadeus Burgess thade...@thadeusb.com wrote: I prefer singular for the Object models and plural for the tablenames. class Person: __tablename__ = 'people' Since the table contains many of the records, but an object instance will only contain one of those rows. -- Thadeus On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural. +1 for plural, just to make the discussion more interesting. :) Anyway, the reason for plurals is: it's a table, so it contains many records for something. Reason for singular is: ... it looks better in the API. singular in an API example: get.people.last() vs Get last person get.person.last() vs Get last person (more similar?) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Re: how do get me to imporsonate a generic user?
http://.../app/default/user/impersonate/{id} will do this for you but you need to have permission to impersonate. Look at the docstring. Massimo On Nov 30, 2:43 pm, mart msenecal...@gmail.com wrote: Hi, I would like to make use of the following snippet (something I have here often enough) * in controller db.someTable.user==me)).select() * in db.py if auth.is_logged_in(): me=auth.user.id else: me=None How do I turn this into something like if auth.is_logged_in(): genericUser=auth.user.id while the user is visiting on THIS page, they can as an option, assume a generic user's ID to view his stuff (file system resources) but with stricter permission (like view and download, but not change or delete? Thanks, Mart :)
[web2py] Re: Wizard + Plugin Wiki
It is not integrated but they are compatible. If something does not work, it is a bug. I have used plugin_wiki and wizard together without problems. On Nov 30, 3:00 pm, JayShaffstall jshaffst...@gmail.com wrote: Okay, so I see the note from about a month ago, on the wizard video, about it not being compatible with the plugin wiki. Assuming that hasn't been fixed in the past month, does anyone have a good handle on what's needed to get the two to play well together?
[web2py] Re: Table names: plural or singular?
when the dal was designed I has singular in mind. On Nov 30, 4:11 pm, DenesL denes1...@yahoo.ca wrote: +1 for singular, it does look better in the code. On Nov 30, 4:48 pm, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural.
[web2py] JSON-RPC and some bugs
There are a few bugs related to JSON-RPC implementation. 1. version key is required since 1.1 but if I call the service without it, it still responds as if a compliant client has called it 2. id key is optional, but the service will raise KeyError if it's not present 3. there is no support for named parameters (arguments) although it's in the spec The full working draft is here: http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Re: Wizard + Plugin Wiki
You need login with 'editor' role Look at this line 'editor' : auth.user and auth.has_membership(role='editor') or auth.user_id==1, # if current user a editor? That's all ^^ On 1 dic, 01:50, mdipierro mdipie...@cs.depaul.edu wrote: It is not integrated but they are compatible. If something does not work, it is a bug. I have used plugin_wiki and wizard together without problems. On Nov 30, 3:00 pm, JayShaffstall jshaffst...@gmail.com wrote: Okay, so I see the note from about a month ago, on the wizard video, about it not being compatible with the plugin wiki. Assuming that hasn't been fixed in the past month, does anyone have a good handle on what's needed to get the two to play well together?
Re: [web2py] OFFTOPIC: FUNNY: SEO specialists
You know. I wonder if we could implement an SEO helper. You give the subject and it automatically grabs some thasaurus and gets you the similars. :D BR, Jason On Tue, 2010-11-30 at 22:58 +0100, Branko Vukelic wrote: How many SEO specialists are needed to change lightbulb bulb bulbs light cheap affordable? :) attachment: face-smile-big.png
Re: [web2py] Table names: plural or singular?
I use sigular, cause my teacher burned in into our heads if we thought different. :D BR, Jason Brower On Wed, 2010-12-01 at 01:31 +0100, Branko Vukelic wrote: Yeah, this is the pattern I usually use, too. On Wed, Dec 1, 2010 at 12:41 AM, Thadeus Burgess thade...@thadeusb.com wrote: I prefer singular for the Object models and plural for the tablenames. class Person: __tablename__ = 'people' Since the table contains many of the records, but an object instance will only contain one of those rows. -- Thadeus On Tue, Nov 30, 2010 at 5:13 PM, Branko Vukelic bg.bra...@gmail.com wrote: On Tue, Nov 30, 2010 at 10:48 PM, pbreit pbreitenb...@gmail.com wrote: Sorry for the newbie, religious question but what is the preference in web2py for table names, plural or singular? Most of the docs seem to indicate singular since that seems to make more sense in code (and you don't really use SQL all that much). But I did see some examples with plural. +1 for plural, just to make the discussion more interesting. :) Anyway, the reason for plurals is: it's a table, so it contains many records for something. Reason for singular is: ... it looks better in the API. singular in an API example: get.people.last() vs Get last person get.person.last() vs Get last person (more similar?) -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group attachment: face-smile-big.png
[web2py] Re: Any web2py/python web developers in Salt Lake City?
Thanks for your response! I'll check out experts4solutions.com. On Nov 30, 7:16 am, DenesL denes1...@yahoo.ca wrote: You can find people from all over the world in experts4solutions.com, or post an offer here and choose from the replies. On Nov 30, 12:39 am,cadrentescadren...@gmail.com wrote: I've been learning but too slowly to put together the application I envision, not my main job...looking for someone who can help.
[web2py] Re: Using Jython with web2py
Yes and Spring solved many of the original JEE AKA J2EE problems to the point the JEE people adopted the Spring way. I worked with many of the original EJB containers, some of it was not fun. Python and web2py makes getting work done so much easier. Ron On Nov 30, 1:50 pm, Michele Comitini michele.comit...@gmail.com wrote: When I need to have fun I go reading this on springpython home: Spring Python is an offshoot of the Java-based Spring Framework and Spring Security, targeted for Python. Spring provides many useful features, and I wanted those same features available when working with Python. I always thought the other way, I need Spring in Java for doing the most basic things that can be done in Python :-D mic 2010/11/29 mdipierro mdipie...@cs.depaul.edu: For me Enterprise means: - easy to use (low startup costs) - always backward compatible (worth the investment) - enterprise = business + non-profit; enterprise != large bloated bussiness I do not disagree with your definition: pragmatic, agile and extensible web framework for fast development. On Nov 29, 2:58 am, pierreth pierre.thibau...@gmail.com wrote: On Nov 29, 1:39 am, mdipierro mdipie...@cs.depaul.edu wrote: please let us know if things work or do not work. We have not tested web2py with jython much, Massimo Well, I won't dig that much in Jython with web2py for the moment. In a longer term interest, I would like to be able to use web2py in a Java infrastructure with Hibernate. I think it might be a really nice tool for prototyping in the enterprise world. Also I would like to use web2py with sqlalchemy with Python Spring. I see the mix of the three as a potential solution for the enterprise world too. In fact, I don't understand that you labeled web2py as an Enterprise Web Framework. Without wanting to offend you, I see web2py as a pragmatic, agile and extensible web framework for fast development. I think web2py as a too tight coupling for enterprise development. DAL in not a real ORM and it does not make it easy to apply domain driven design. Add the fact that the web2py book is mixing presentation with the control, I think web2py is favoring pragmatism over abstraction. It is not bad by itself but it conflicts with my vision of the enterprise way. I would appreciate your comments. Pierre
[web2py] Re: Design advice for many to many
On Nov 30, 11:16 pm, JayShaffstall jshaffst...@gmail.com wrote: Traditional: the traditional way would be to create a model to represent the relationship between students and courses. This is somewhat subjective, but IMO just do this. It is simpler, and all else being equal, the simplest approach is the one that is easiest to debug, maintain, document and optimize.
[web2py] Syntax for placeholders in executesql
Hey all, I was trying to use executesql with placeholders, based on the documentation in source and the mailing list [1]. The syntax on the site seems to suggest using question marks, for example: db.executesql(select * from auth_user where id = ?, [4]) I was banging my head against this for a while until I realized that the syntax that works is actually: db.executesql(select * from auth_user where id = %s, [4]) (not sure if this is in postgres or everywhere in general.) Is this correct, and if so can it be added to the documentation? Thanks! [1] http://groups.google.com/group/web2py/browse_thread/thread/dd01da67ca713421/baf2e0b206892be1?lnk=gstq=postgresql+placeholders#baf2e0b206892be1
[web2py] Re: Using Jython with web2py
On Nov 26, 6:41 pm, mdipierro mdipie...@cs.depaul.edu wrote: It works (some of us have tested it) but there are some know problems and I would not recommend it in production. One problem is a known problem with Java regular expression parses that Sun marked as won't fix. It is not a web2py specific problem but can cause some web2py templates send enter into a loop. This is the bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5050507. Oracle seems to have a valid reason to not fix the bug. They are giving suggestions how to get around. It seems easy to refactor web2py apps having this problem unless regular are created dynamically but I guess this is rare. This seems to be the major problem with Jython and web2py. Do you have other reasons for not recommending web2py with Jython?
[web2py] How to call a function in an other controller?
Hi, is there any way to execute a function in an other controller? controller1.py func(): do something controller2.py func(): do something else call func() of controller1.py do some more things return I don't want to redirect the user.
[web2py] auth.change_password() not workign
Hey, I'm using web2py (Version 1.83.2) on my local machine. I used auth.change_password() function and it works fine on my local machine. But when I tried the same on live site with Version 1.88.2 , it's not working. Is there any change specific to this in the newer version?