[web2py] web2py code generating its templates to that of an MVC JavaScript framework?
Dear web2py community, I think it would be great to get this feature added to the roadmap. In the meantime I will be sticking to my Bottle + hand-coded AngularJS approach. Below I have stipulated the advantages and disadvantages to code generating static JavaScript + HTML5 from our web2py templates. * Advantages:* - Client becomes decoupled from backend - This is great for testing and generally is good software engineering practise - Client can be packaged up into an HTML5 app (e.g.: with Adobe PhoneGap for deployment to native mobile apps) - Longer term would be great to get integration with PhoneGap's API built in to the code generation - Being generated for an MVC framework makes testing, debugging and by-hand modifications easier; as well as hijacking that community - web2py can be shrunk into two parts, a microframework and a compilation framework. This will make it much more competitive to both Bottle and Django *Disadvantages:* - Development time for code generator and its integration into web2py - New versions of the MVC framework might break backwards compatibility; adding to the development time for web2py [though their devs may start providing patches] Thanks for your consideration, Alec Taylor -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Login with ID rather than email?
Hmm, that does slightly confuse me. Am I supposed to add in a 'username' field? This is how the `auth_user` table looks by default, and after registering I tried the value in each column for username; but nothing logged me in: CREATE TABLE auth_user( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name CHAR(128), last_name CHAR(128), email CHAR(512), password CHAR(512), registration_key CHAR(512), reset_password_key CHAR(512), registration_id CHAR(512) ); On Mon, May 27, 2013 at 3:13 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: auth.define_tables(username=True) On Sunday, 26 May 2013 22:41:09 UTC-5, marco mansilla wrote: El Mon, 27 May 2013 13:00:11 +1000 Alec Taylor alec.t...@gmail.com escribió: Is it possible to login to web2py by ID rather than by email? Thanks for all information, Alec Taylor if you mean something like username yes... and there are some ways to hardcode the behaviour for this field to take the id value... when you define a username field, automatically auth asks for it instead of email. Marco. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to mark the 'id' field as readable and writable?
Here is what I've tried on my auth_user table: Field('id', 'id', readable=True, writable=True, unique=True), But it makes not difference to what is displayed on screen. How do I get this to work? Thanks for all suggestions -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Login with ID rather than email?
I have actually migrated some data, and have a second userid type field; and the email field isn't unique. How do I enable login with that second userid field (of type integer)? On Tue, May 28, 2013 at 5:48 AM, Niphlod niph...@gmail.com wrote: if you do auth.define_tables(username=True) a username field is added. BTW: by id we all understood you want to login using the username in the registration rather than the email. If instead you meant by the serial id associated with the auth_user row then forget about username On Monday, May 27, 2013 8:38:30 PM UTC+2, Alec Taylor wrote: Hmm, that does slightly confuse me. Am I supposed to add in a 'username' field? This is how the `auth_user` table looks by default, and after registering I tried the value in each column for username; but nothing logged me in: CREATE TABLE auth_user( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name CHAR(128), last_name CHAR(128), email CHAR(512), password CHAR(512), registration_key CHAR(512), reset_password_key CHAR(512), registration_id CHAR(512) ); On Mon, May 27, 2013 at 3:13 PM, Massimo Di Pierro massimo@gmail.com wrote: auth.define_tables(username=True) On Sunday, 26 May 2013 22:41:09 UTC-5, marco mansilla wrote: El Mon, 27 May 2013 13:00:11 +1000 Alec Taylor alec.t...@gmail.com escribió: Is it possible to login to web2py by ID rather than by email? Thanks for all information, Alec Taylor if you mean something like username yes... and there are some ways to hardcode the behaviour for this field to take the id value... when you define a username field, automatically auth asks for it instead of email. Marco. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Login with ID rather than email?
(I have tried the `auth.settings.login_userfield = 'olduserid'` option; but all it did was change the input label, the validator (for email) remained) On Tue, May 28, 2013 at 11:24 AM, Alec Taylor alec.tayl...@gmail.com wrote: I have actually migrated some data, and have a second userid type field; and the email field isn't unique. How do I enable login with that second userid field (of type integer)? On Tue, May 28, 2013 at 5:48 AM, Niphlod niph...@gmail.com wrote: if you do auth.define_tables(username=True) a username field is added. BTW: by id we all understood you want to login using the username in the registration rather than the email. If instead you meant by the serial id associated with the auth_user row then forget about username On Monday, May 27, 2013 8:38:30 PM UTC+2, Alec Taylor wrote: Hmm, that does slightly confuse me. Am I supposed to add in a 'username' field? This is how the `auth_user` table looks by default, and after registering I tried the value in each column for username; but nothing logged me in: CREATE TABLE auth_user( id INTEGER PRIMARY KEY AUTOINCREMENT, first_name CHAR(128), last_name CHAR(128), email CHAR(512), password CHAR(512), registration_key CHAR(512), reset_password_key CHAR(512), registration_id CHAR(512) ); On Mon, May 27, 2013 at 3:13 PM, Massimo Di Pierro massimo@gmail.com wrote: auth.define_tables(username=True) On Sunday, 26 May 2013 22:41:09 UTC-5, marco mansilla wrote: El Mon, 27 May 2013 13:00:11 +1000 Alec Taylor alec.t...@gmail.com escribió: Is it possible to login to web2py by ID rather than by email? Thanks for all information, Alec Taylor if you mean something like username yes... and there are some ways to hardcode the behaviour for this field to take the id value... when you define a username field, automatically auth asks for it instead of email. Marco. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Autocomplete widget on SQLFORM.grid search?
I haven't been able to get this to work: # Models db.define_table('category',Field('name')) db.define_table('product',Field('name'),Field('category')) db.product.category.widget = SQLFORM.widgets.autocomplete(request, db.category.name, limitby=(0,10), min_length=2) # View {{= SQLFORM.grid(db.product) }} How do I bind the search input box to the autocomplete widget? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Autocomplete widget on SQLFORM.grid search?
I know, but it could also help suggest possible values to search for details on in the grid On Tue, May 28, 2013 at 1:03 PM, Anthony abasta...@gmail.com wrote: The autocomplete widget is for when a field appears in a create or update form -- it is used to help you fill in a value for the field. Anthony On Monday, May 27, 2013 10:43:11 PM UTC-4, Alec Taylor wrote: I haven't been able to get this to work: # Models db.define_table('category',Field('name')) db.define_table('product',Field('name'),Field('category')) db.product.category.widget = SQLFORM.widgets.autocomplete(request, db.category.name, limitby=(0,10), min_length=2) # View {{= SQLFORM.grid(db.product) }} How do I bind the search input box to the autocomplete widget? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Login with ID rather than email?
Is it possible to login to web2py by ID rather than by email? Thanks for all information, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Converting SQLite to DAL?
Hi Cliff, I no longer have a Micrsoft Access database; I now have a simple SQLite database. Will rename the tables so that they work with the conversion script. On Sat, Apr 20, 2013 at 7:26 AM, Cliff Kachinske cjk...@gmail.com wrote: Pardon me if I'm telling you things you already know. For the short version, skip to the bottom two paragraphs. You can think of a db driven application as having several layers. The bottom layer is the database engine and the rdbms. For this simplicity I'm discussing them as one unit, though they are not quite. This layer stores the data and performs the CRUD operations. It knows how to do these things. For what you are trying to do, that would be SQLite. On top of the rdbms there is a layer that tells the rdbms what to do. The language it generally uses for this is SQL. There are statements like INSERT, DELETE, UPDATE. In the day-to-day operations, those are the most important ones. This middle layer also transmits data between the rdbms and the top layer. Some people call this the business rules layer. The top layer interacts with the (most of the time) human user. Sometimes this is called the presentation layer. What Microsoft did with Access is blur the natural and easy distinctions between these layers. The result is Access, a confusingly mixed bag of rdbms, business rules layer and presentation layer. They also threw in an IDE. That all seems really convenient and I guess it's OK if one can solve all one's computer app needs with Access. But if one ever need to grow beyond it, Access has not taught anything about the Natural Order Of Things. So I'm pretty sure your db dump is a collection of SQL commands to create tables in SQLite and populate those tables with the data that was in the Access tables. All you have right now is the bottom layer of your application. I hope you're still with me because the news is actually quite good. You can use SQLFORM.grid and SQLFORM.smartgrid to manage the data in these tables. The great thing about smartgrid especially is that it knows about table joins so you still don't have to dig into DAL syntax. On Friday, April 19, 2013 1:42:45 AM UTC-4, Alec Taylor wrote: I finally completed a successful conversion of my Microsoft Access database to SQLite 3; after trying numerous scripts on a couple of platforms. I used the `.dump` command to create a *.sql file with the `CREATE TABLE` and associated statements. Then using the extract_sqlite_models.py from the scripts folder I generated some code; but found that what was generated was legacy database accesses; it didn't generate the modern syntax with Field() and whatnot. How do I automate the conversion of the SQLite 3 database to web2py DAL's syntax? (furthermore would like to access the current .db from web2py; as there is data there) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Need help getting cgihandler.py to work
I have a server which only supports talking to Python using CGI. It also requires a custom shebang line. I was able to get the sample one working, from: http://wiki.python.org/moin/CgiScripts But I can't figure out how to make the cgihandler.py version work. Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] No `Field`s generated by 'extract_sqlite_models.py'
Using aforementioned script I get no `Field`s in the generated DAL schema; all I get are the table names. For example: CREATE TABLE OeTy(OfNa varchar(50),FiAm float,Of A smallint,OfSt varchar(255)); Becomes: legacy_db.define_table('OeTy', migrate=False) How do I get this to work properly? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Converting SQLite to DAL?
I finally completed a successful conversion of my Microsoft Access database to SQLite 3; after trying numerous scripts on a couple of platforms. I used the `.dump` command to create a *.sql file with the `CREATE TABLE` and associated statements. Then using the extract_sqlite_models.py from the scripts folder I generated some code; but found that what was generated was legacy database accesses; it didn't generate the modern syntax with Field() and whatnot. How do I automate the conversion of the SQLite 3 database to web2py DAL's syntax? (furthermore would like to access the current .db from web2py; as there is data there) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: EmberJS is the web2py of the client! :)
FYI: The presenter/author has published his examples using metawidget and AngularJS to generate forms: http://files.meetup.com/4966012/Metawidget%20AngularJS%20Examples.zip On Wed, Apr 17, 2013 at 7:12 AM, Niphlod niph...@gmail.com wrote: On Tuesday, April 16, 2013 10:38:11 PM UTC+2, Magnitus wrote: Well, basically, it limited the usefulness of the form facilities and the tight default integration between authentication and the rendered pages took some time to bypass and then there was stripping the layout.html file to it's bare essentials. Overall, I've always been much happier to use web2py for it's server-side features and let it be a flexible interface with which 100% custom-made client-side code could interact. yeah. the real problem is that no-one working on angularjs is making public its own widgets. All that it takes is overloading SQLFORM.widgets and given that we ship web2py with a formstyle parameter that can be a callable from some time, all that is needed is something that generates angular templates out of models (and someone that is willing to do it). Once stable, that formstyle can be included in standard web2py and the newwidgets.py module shipped in gluon/contrib. then SQLFORM(thetable, formstyle='angularjs') will be all what's needed Right now I don't have any interest in angularjs so I call myself out of the competition, but feel free to pack a starter app and I'll be more than glad to review the code. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] bootstrap interface builder
Not bad! Also I should mention that there are quite a few players in this market; using Twitter Bootstrap as base. On Thu, Apr 18, 2013 at 3:37 AM, Massimo DiPierro massimo.dipie...@gmail.com wrote: http://www.layoutit.com/ -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Python 3 compatibility?
Looks like it hasn't been updated for 4 months… I will bump up the feature thread of it. On Sun, Apr 14, 2013 at 3:11 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: We will not do the mistake Python made: break backward compatibility and not make it worthwhile. We are already working on web3py. It is on github. You can already help us port it to python 3.0. yet the which will be worthwile. better internal logic, better helpers, better forms, etc. Once that is done we can backport to web2py. There is no point to port code before we improve it. Massimo On Saturday, 13 April 2013 09:20:48 UTC-5, samuel bonilla wrote: I have a proposal called 'web2py +' which is to give support to python 3.x, is the same code but support is for python 3.x, 'web2py plus' is for developers who want to migrate to python 3.x is only a proposal, I have not started work, I want to hear comments about it thanks... El viernes, 12 de abril de 2013 19:51:23 UTC-5, twan...@gmail.com escribió: Hi, I'm interested (very interested) in a Python web framework that works with Python 3.x (3.3+, in particular). What is the status of web2py's py3 support? I found a late-2011 thread in this group where Massimo was betting that there would be a Python 2.8 and hence no pressing need to even care about 3.x. Me, I have no interest in 2.y, and if web2py doesn't support the current and in fact better version of Python then I will reluctantly have to look elsewhere. Thanks in advance, -- B -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Form generator from web2py JSON to AngularJS made easier
At an AngularJS usergroup meeting at Google a week or so ago; I heard a talk on metawidget. Seems to be perfect for my needs, so I'm sharing a link: http://metawidget.sourceforge.net/doc/reference/en/html/ch03s02.html I remember Massimo mentioning at some point that the future of web2py client-side will encompass a JavaScript framework such as Backbone, Ember or AngularJS. Maybe this will assist? :) All the best, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: EmberJS is the web2py of the client! :)
Another vote for AngularJS On Wed, Apr 3, 2013 at 8:58 PM, David Marko dma...@tiscali.cz wrote: This scenario of one-page application is quite important for mobile hybrid applications. In this case you need standalone app running in device and consuming data from server. The server provides JSON coomunication with app. We have a great experience with http://trigger.io http://angularjs.org/ ... -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: EmberJS is the web2py of the client! :)
Just went through a couple of the examples with Meteor It's certainly interesting; but is quite verbose to write and manage. Most impressive was how completely self-contained those examples are. Other frameworks documentation definitely need to pickup their game. For example, when I was testing Ember.js many months ago it had such horrible documentation that I started looking at competitors. On Wed, Apr 3, 2013 at 10:58 PM, David Marko dma...@tiscali.cz wrote: Meteor is different beast as it is also serverside platform based on node.js ... But development of this framework is quite slow ... -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: EmberJS is the web2py of the client! :)
I hear what you're saying, but ember/data seems far too young to be a feature point; and everything else you mentioned was mere speculation. Not to discount you entirely, what you mentioned about prerendering templates server-side is a very good point. This has been a feature request with AngularJS for a while now. Hopefully we'll have it in the Angular world soon. On Thu, Apr 4, 2013 at 1:28 AM, Arnon Marcus a.m.mar...@gmail.com wrote: As for real-time / WebSockets stuff, the Ember guys are working on an adapter for EmberData that is going to do just that - so once you implement the relevant modifications for your server, you could start using Web-Sockets in Ember with the same app you already developed with it (!) - no code would have to be changes, as all the data-related code will have already been using EmberData, ans do it's just a matter of switching a back-end-adapter in EmberData, and the rest will stay as it is, and everything will fly ! Easy-peasy... :) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: EmberJS is the web2py of the client! :)
On Thu, Apr 4, 2013 at 7:05 AM, Arnon Marcus a.m.mar...@gmail.com wrote: I agree that it does seem right now, that the current trend in the web-development world, in general, is moving in the direction of transferring more and more tasks to the client, as those become more and more capable. But I wouldn't bury web2py just yet... (nor any other server-side framework for that matter) As in the WebSockets story, the current temporary Hype is exaggerating the perception of the long-term eventual-effect. I think server-side frameworks are here to stay - at least for the foreseeable future - it's not gonna be an all or nothing transference in all cases, not even in most. It is still much harder on the client, even with things like Ember - especially considering the whole cross-browser/platform story. The whole Google thing about - everything going to the web... I don't buy it - not yet. Google-Docs is an amazing idea in theory - in practice, it's a buggy mess of crap... (and in Google's own chrome, for f#ck sake...) Most simple applications, websites, etc. are not as complex as, say, an Intranet business applications (such as the one I've been working on for the past 3 years) - which is a market still dominated by desktop applications. But yes, the expectations are changing... Slowly... I think it's going to be a long and hybrid-ridden transition. For now, I've seen talks about how to maximize loading time, template-rendering can be done on the server, even for desktop usage - and that's rendering to plain HTML, not a JavaScript Object-Tree - so it can still be done in web2py. Once the static HTML loads, the framework then kicks-in, and starts climbing and crawling over the DOM, attaching itself and building it's JavaScript-Object-Tree and injecting dependencies into the DOM and such... There are frameworks that go that rout - don't know to what degree Angular or Ember are in this category, though... The main incentive here, other than speeding-up loading time, is the whole SEO story... (search-engine-optimization) Search-engine crawlers/spiders need static HTML to search in - if the entire thing is Javascript-generated, it is virtually unsearchable... And no web-site owner wants that... Only Intranet applications don't care about such things... Then there's this thing about resources, RESTfull'ness and ORMs... I think that web2py's models and controllers will remain relevant, as there is a difference between the model of the data in it's view's usage, and the model of the data in the database. Most of what the controllers are doing in web2py, in my experience, apart from querying the DAL, is data-manipulation - translating one data-model into another, to meet the needs of the views for optimal and elegant usage. This role can stay in the server, as in some cases, much less information has to go through the wire this way. Can this be done in the client's controllers? Maybe. But I'm not sure it should - not in all cases. I think it might actually be easier for a client to deal with a data-model that is already structured in a manner that most fits the need at hand - and have that be CRUD'ed in that form. A client's MVC component shouldn't care how the data is actually stored on the database - it can request it's resources in a form that is already pre-transformed and structured especially for it's needs. So what you can do, is have the starting-point server-side portion of the URL of each screen, still be of a web2py controller, which would then either be transferred via a web2py view if it's a full-refresh/first-time-load, or as a JSON resource in an AJAX manner is all other cases. In both scenarios, the web2py's controller's role would be to query the DAL and optimally translate the data for the client's screen - for the GET method, and do a reverse-translation for the POST one... So here's what I see: I see a diverse web-development world, with varying degrees of server-side logic usage, in some cases dynamically switching from server to client and back, based on needs, requirements, trade-offs criteria, and target-platforms. Not a bad argument Arnon, but you shouldn't discount search scrapers so easily. I think Google's Search Bot has support AJAX for a good 5 years now. Translating between web2py DAL and (for example) AngularJS forms is not completely straightforward. However, with the help of metawidget it is very possible. What would be best is if we had an SQLFORM() style generator in JavaScript; which is completely decoupled from the server side. This appears to be what metawidget is. Now we just need the generator on the Python end and we'll be home free. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit
Re: [web2py] Re: IMG in A tag of SQLFORM `submit_button`?
Thanks, using BUTTON fixed the problem. On Sun, Mar 31, 2013 at 12:18 AM, Annet anneve...@googlemail.com wrote: I am trying to solve a similar problem, and am considering Bootstrap's i class=some-icon/i in a custom widget ... div class=input-prepend span class=somethingi class=some-icon/i/span input class=btn type=submit /div http://twitter.github.com/bootstrap/base-css.html#icons Annet -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: IMG in A tag of SQLFORM `submit_button`?
*bump* On Tue, Mar 26, 2013 at 6:18 PM, Alec Taylor alec.tayl...@gmail.com wrote: {{=SQLFORM.factory(submit_button=XML(SPAN('hello', IMG(_src=URL('static', 'img/bg.png')}} How do I get this to work? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] IMG in A tag of SQLFORM `submit_button`?
{{=SQLFORM.factory(submit_button=XML(SPAN('hello', IMG(_src=URL('static', 'img/bg.png')}} How do I get this to work? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Refresh page on successful form submission; and response.flash?
(I'm using SQLFORM) Currently all I get is my `response.flash` message and the URL changes from: http://localhost/foo/1; to http://localhost/foo/1#;. Instead I want the whole page to refresh so the changes the user made propagates. I do not want to use LOAD. How do I refresh the page on successful form submission? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Joining the relation result of a join with another relation?
# Model [appname/models/far.py] db.define_table('far_members', Field('far_id', db.far, requires=IS_IN_DB(db, 'far.id')), Field('user_id', db.auth_user, default=auth.user_id, writable=False, requires=IS_IN_DB(db, 'auth_user.id')) ) db.define_table('far', Field('cool_title'), Field('cool_content') ) # Controller [appname/controllers/default.py] ''' I want to return the user profiles of all `far_members` ''' def far(): return db(db.auth_user.id == db(db.far_members.far_id == request.args(0)).select(self.db.far_members.user_id)).select() # Call (id=1 is not blank) $ curl -X GET localhost/appname/far/1 Server Error -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Joining the relation result of a join with another relation?
Thanks, but that didn't work; I got this error: type 'exceptions.AttributeError' 'Row' object has no attribute 'id' On Wed, Mar 20, 2013 at 7:27 AM, Richard Vézina ml.richard.vez...@gmail.com wrote: If this select : db(db.far_members.far_id == request.args(0)).select(self.db.far_members.user_id) return more then one row you need to use : belongs http://web2py.com/books/default/chapter/29/06#belongs So your query will look something like that : db(db.auth_user.id.belongs(db(db.far_members.far_id == request.args(0)).select(self.db.far_members.user_id))).select() Richard On Tue, Mar 19, 2013 at 4:06 PM, Alec Taylor alec.tayl...@gmail.com wrote: # Model [appname/models/far.py] db.define_table('far_members', Field('far_id', db.far, requires=IS_IN_DB(db, 'far.id')), Field('user_id', db.auth_user, default=auth.user_id, writable=False, requires=IS_IN_DB(db, 'auth_user.id')) ) db.define_table('far', Field('cool_title'), Field('cool_content') ) # Controller [appname/controllers/default.py] ''' I want to return the user profiles of all `far_members` ''' def far(): return db(db.auth_user.id == db(db.far_members.far_id == request.args(0)).select(self.db.far_members.user_id)).select() # Call (id=1 is not blank) $ curl -X GET localhost/appname/far/1 Server Error -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Joining the relation result of a join with another relation?
Thanks, this did the trick: return db((db.auth_user.id == db.far_members.user_id) (db.far_members.far_id == request.args(0)) ).select(db.auth_user.ALL) Finally is there a way to exclude a field (blacklist) in the select function query? (I don't want password to appear there; even though it's hashed) On Wed, Mar 20, 2013 at 1:30 PM, Ricardo Pedroso rmdpedr...@gmail.com wrote: On Tue, Mar 19, 2013 at 8:06 PM, Alec Taylor alec.tayl...@gmail.com wrote: # Model [appname/models/far.py] db.define_table('far_members', Field('far_id', db.far, requires=IS_IN_DB(db, 'far.id')), Field('user_id', db.auth_user, default=auth.user_id, writable=False, requires=IS_IN_DB(db, 'auth_user.id')) ) db.define_table('far', Field('cool_title'), Field('cool_content') ) # Controller [appname/controllers/default.py] ''' I want to return the user profiles of all `far_members` ''' def far(): return db(db.auth_user.id == db(db.far_members.far_id == request.args(0)).select(self.db.far_members.user_id)).select() # Call (id=1 is not blank) $ curl -X GET localhost/appname/far/1 Server Error See if it's what you want: def far(): _set = db( (db.auth_user.id == db.far_members.user_id) (request.args(0) == db.far_members.far_id)) rows = _set.select(db.auth_user.ALL) _select = DIV(_set._select(db.auth_user.ALL)) return DIV(TABLE(rows), _select) Ricardo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Sites Powereb by web2py = Sites *Powered* by web2py
Suggest making the change on the homepage! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Replace all forms to use the HTML5 `placeholder` rather than `label`?
How do I replace all forms to use the HTML5 `placeholder` rather than `label`? Here is how I currently do it: def signup_form_function(): signup_form = SQLFORM(db.auth_user) for label in signup_form.elements('label'): label[_style] = display:none; placeholders = { email: email address, expertise: expertise; press `+` to add more -, } pwd = { password: password } for input in signup_form.elements(input[type=text]): input[_placeholder] = placeholders.get(input[_name], ) for input in signup_form.elements(input[type=password]): input[_placeholder] = pwd.get(input[_name], '') signup_form.elements('input[type=submit]')[0][_value] = Signup signup_form.elements('input[type=submit]')[0][_class] = btn btn-large btn-primary if signup_form.process().accepted: response.flash = foo return signup_form -- But maybe this could be done at the schema level; e.g.: utilising the label attribute of the Field tuple? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] My hack to add JSON support to `request.vars`
Might be helpful to someone, also maybe we should implement it as `request.vars.json`, like Python-Requests does? vars = request.vars vars = str(vars) vars = json.loads(vars[vars.find({)+2 : vars.rfind(\': \'\')]) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] gluon.http.HTTP default headers aren't `**response.headers`?
Why isn't the content-type inherited from response.headers in the HTTP object construction? def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True)), **response.headers) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: text/html; charset=UTF-8 Date: Sat, 09 Mar 2013 05:05:19 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True))) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: application/json X-Powered-By: web2py Date: Sat, 09 Mar 2013 05:05:33 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: gluon.http.HTTP default headers aren't `**response.headers`?
(pasted output was in reverse order .) On Sat, Mar 9, 2013 at 4:08 PM, Alec Taylor alec.tayl...@gmail.com wrote: Why isn't the content-type inherited from response.headers in the HTTP object construction? def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True)), **response.headers) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: application/json X-Powered-By: web2py Date: Sat, 09 Mar 2013 05:05:33 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive def test(): response.headers['Content-Type'] = 'application/json' raise HTTP(500, json.dumps(dict(test=True))) HTTP/1.1 500 INTERNAL SERVER ERROR Path=/ Content-Type: text/html; charset=UTF-8 Date: Sat, 09 Mar 2013 05:05:19 GMT Server: Rocket 1.2.6 Python/2.7.3 Content-Length: 14 Connection: keep-alive {test: true} {test: true} -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Raising HTTP errors as JSON?
How do I raise HTTP errors as JSON? My attempt: In [1]: import json In [2]: from gluon.http import HTTP In [3]: raise HTTP(412, json.dumps({'error': 'must accept terms'})) --- HTTP Traceback (most recent call last) ipython-input-11-4878ff8c2cfc in module() 1 raise HTTP(412, json.dumps({'error': 'must accept terms'})) HTTP: 412 PRECONDITION FAILED -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Raising HTTP errors as JSON?
Oh, looks like it works on an endpoint level; not sure how to get rid of the XML style comment though !-- -- Output from curl: GET /arbg/error HTTP/1.1 Host: localhost Accept: */* HTTP/1.1 404 NOT FOUND Set-Cookie: session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d; Path=/ Content-Length: 555 Content-Type: text/html; charset=UTF-8 Date: Wed, 06 Mar 2013 09:39:20 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {error: unauthorized_client}!-- xx //-- FYI: I am running web2py version 2.4.1-alpha.2+timestamp.2013.02.21.10.15.58 On Wed, Mar 6, 2013 at 8:15 PM, Niphlod niph...@gmail.com wrote: what did you expect ? On Wednesday, March 6, 2013 9:37:26 AM UTC+1, Alec Taylor wrote: How do I raise HTTP errors as JSON? My attempt: In [1]: import json In [2]: from gluon.http import HTTP In [3]: raise HTTP(412, json.dumps({'error': 'must accept terms'})) --- HTTP Traceback (most recent call last) ipython-input-11-4878ff8c2cfc in module() 1 raise HTTP(412, json.dumps({'error': 'must accept terms'})) HTTP: 412 PRECONDITION FAILED -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py 2.4.2 is OUT
For Windows PyDot is the native Python solution; which unlike PyGraphViz; doesn't require C extensions built. Will have a go at abstracting the implementation so either can be used first chance I get (probably not starting for another 7 days) On Wed, Mar 6, 2013 at 6:16 AM, Derek sp1d...@gmail.com wrote: Eh, I'd rather have it not shown unless it actually does something. It's poor software design if you have a button which just gives you an error message. On Tuesday, March 5, 2013 10:48:27 AM UTC-7, LightDot wrote: I know of some users that made it work on windows, so it wouldn't be enough to just check the OS. Also, if the button is hidden in case the lib import fails, then new users would never see it and be reminded that they can install the library and use it. In both cases, the button serves a cause, IMHO. Regards, Ales On Tuesday, March 5, 2013 6:27:09 PM UTC+1, Derek wrote: Tried to 'graph models' on a windows machine, old apps get the error: invalid function (appadmin/graph_model) Created a new app from the wizard, clicked 'graph models' pygraphviz library not found Tried to install pygraphviz on Windows (after installing Graphviz), get this message: Your Graphviz installation could not be found. And the reason why: 3) You are using Windows There are no PyGraphviz binary packages for Windows but you might be able to build it from this source. See http://networkx.lanl.gov/pygraphviz/reference/faq.html So, can we have it disable the 'graph models' if you are running on Windows? Thanks! On Sunday, March 3, 2013 8:38:19 PM UTC-7, Massimo Di Pierro wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Raising HTTP errors as JSON?
401 was actually the error code that would be relevant there. Surprised that the XML comments were removed in 2.4.2; had been tracing the commits. Just checked and noticed I am on 02.21.10.15.58 and it was fixed in 02.22.18.44.48 . Thanks for the other tips; should be helpful :D On Wed, Mar 6, 2013 at 9:57 PM, Ricardo Pedroso rmdpedr...@gmail.com wrote: On Wed, Mar 6, 2013 at 9:43 AM, Alec Taylor alec.tayl...@gmail.com wrote: Oh, looks like it works on an endpoint level; not sure how to get rid of the XML style comment though !-- -- Output from curl: GET /arbg/error HTTP/1.1 Host: localhost Accept: */* HTTP/1.1 404 NOT FOUND Set-Cookie: session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d; Path=/ Content-Length: 555 Content-Type: text/html; charset=UTF-8 Date: Wed, 06 Mar 2013 09:39:20 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {error: unauthorized_client}!-- xx //-- I started using this: raise HTTP(status, body, None, **{'Content-Type': 'application/json'}) where status - an HTTP status code (200, 404, 500, ...) body - a json.dumps(something) This way I don't need to put a .json extension in the end of url To get rid of those xxx's you can upgrade to 2.4.2 Note: web2py return a Content-Type: text/plain; charset=utf-8 when using a .json extension I think it for max compatibility. PS: In your example your are issuing a 404 where a 403 would be a better fit Ricardo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Raising HTTP errors as JSON?
FYI: I get: Content-Type: application/json When I have: `response.view = 'generic.json'`, e.g.: on a `@request.restful()` On just a regular GET request on a `@service.json` endpoint I get: Content-Type: text/html; charset=UTF-8 And with a POST that has its args given with `-d` curl arg I get: Content-Type: application/x-www-form-urlencoded With reply (same reply whether containing .json in URL or not): Content-Type: text/html; charset=UTF-8 On Wed, Mar 6, 2013 at 10:15 PM, Alec Taylor alec.tayl...@gmail.com wrote: 401 was actually the error code that would be relevant there. Surprised that the XML comments were removed in 2.4.2; had been tracing the commits. Just checked and noticed I am on 02.21.10.15.58 and it was fixed in 02.22.18.44.48 . Thanks for the other tips; should be helpful :D On Wed, Mar 6, 2013 at 9:57 PM, Ricardo Pedroso rmdpedr...@gmail.com wrote: On Wed, Mar 6, 2013 at 9:43 AM, Alec Taylor alec.tayl...@gmail.com wrote: Oh, looks like it works on an endpoint level; not sure how to get rid of the XML style comment though !-- -- Output from curl: GET /arbg/error HTTP/1.1 Host: localhost Accept: */* HTTP/1.1 404 NOT FOUND Set-Cookie: session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d; Path=/ Content-Length: 555 Content-Type: text/html; charset=UTF-8 Date: Wed, 06 Mar 2013 09:39:20 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {error: unauthorized_client}!-- xx //-- I started using this: raise HTTP(status, body, None, **{'Content-Type': 'application/json'}) where status - an HTTP status code (200, 404, 500, ...) body - a json.dumps(something) This way I don't need to put a .json extension in the end of url To get rid of those xxx's you can upgrade to 2.4.2 Note: web2py return a Content-Type: text/plain; charset=utf-8 when using a .json extension I think it for max compatibility. PS: In your example your are issuing a 404 where a 403 would be a better fit Ricardo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py 2.4.2 is OUT
TBH: They're all lacking. The best option would be to get model import with wwwsqldesigner working: https://github.com/ondras/wwwsqldesigner Using just JavaScript, it currently allows you to visually design your database schemas. At the moment it only supports export to web2py DAL; but if someone can add in import from web2py that would be the optimal solution :) On Wed, Mar 6, 2013 at 11:23 PM, Phyo Arkar phyo.arkarl...@gmail.com wrote: D3.js is far better than pydot , pygraphviz . On Wed, Mar 6, 2013 at 5:05 PM, António Ramos ramstei...@gmail.com wrote: Why dont you use a javascript library for the graph? This way you dont have problems with with windows/linux 2013/3/6 Alec Taylor alec.tayl...@gmail.com For Windows PyDot is the native Python solution; which unlike PyGraphViz; doesn't require C extensions built. Will have a go at abstracting the implementation so either can be used first chance I get (probably not starting for another 7 days) On Wed, Mar 6, 2013 at 6:16 AM, Derek sp1d...@gmail.com wrote: Eh, I'd rather have it not shown unless it actually does something. It's poor software design if you have a button which just gives you an error message. On Tuesday, March 5, 2013 10:48:27 AM UTC-7, LightDot wrote: I know of some users that made it work on windows, so it wouldn't be enough to just check the OS. Also, if the button is hidden in case the lib import fails, then new users would never see it and be reminded that they can install the library and use it. In both cases, the button serves a cause, IMHO. Regards, Ales On Tuesday, March 5, 2013 6:27:09 PM UTC+1, Derek wrote: Tried to 'graph models' on a windows machine, old apps get the error: invalid function (appadmin/graph_model) Created a new app from the wizard, clicked 'graph models' pygraphviz library not found Tried to install pygraphviz on Windows (after installing Graphviz), get this message: Your Graphviz installation could not be found. And the reason why: 3) You are using Windows There are no PyGraphviz binary packages for Windows but you might be able to build it from this source. See http://networkx.lanl.gov/pygraphviz/reference/faq.html So, can we have it disable the 'graph models' if you are running on Windows? Thanks! On Sunday, March 3, 2013 8:38:19 PM UTC-7, Massimo Di Pierro wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr
Re: [web2py] Re: Raising HTTP errors as JSON?
Not to worry, already upgraded all my servers On Wed, Mar 6, 2013 at 11:58 PM, Niphlod niph...@gmail.com wrote: If on old version, you can zero out the returning an iterator (or a list) instead of the body, i.e raise HTTP(401, [json.dumps(whatever)]) vs raise HTTP(401, json.dumps(whatever)) On Wednesday, March 6, 2013 12:15:07 PM UTC+1, Alec Taylor wrote: 401 was actually the error code that would be relevant there. Surprised that the XML comments were removed in 2.4.2; had been tracing the commits. Just checked and noticed I am on 02.21.10.15.58 and it was fixed in 02.22.18.44.48 . Thanks for the other tips; should be helpful :D On Wed, Mar 6, 2013 at 9:57 PM, Ricardo Pedroso rmdpe...@gmail.com wrote: On Wed, Mar 6, 2013 at 9:43 AM, Alec Taylor alec.t...@gmail.com wrote: Oh, looks like it works on an endpoint level; not sure how to get rid of the XML style comment though !-- -- Output from curl: GET /arbg/error HTTP/1.1 Host: localhost Accept: */* HTTP/1.1 404 NOT FOUND Set-Cookie: session_id_arbg=127.0.0.1-d5613ca1-ff65-4c0e-a5ce-737c6024655d; Path=/ Content-Length: 555 Content-Type: text/html; charset=UTF-8 Date: Wed, 06 Mar 2013 09:39:20 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {error: unauthorized_client}!-- xx //-- I started using this: raise HTTP(status, body, None, **{'Content-Type': 'application/json'}) where status - an HTTP status code (200, 404, 500, ...) body - a json.dumps(something) This way I don't need to put a .json extension in the end of url To get rid of those xxx's you can upgrade to 2.4.2 Note: web2py return a Content-Type: text/plain; charset=utf-8 when using a .json extension I think it for max compatibility. PS: In your example your are issuing a 404 where a 403 would be a better fit Ricardo -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to include headers in gluon.http.HTTP exceptions?
My attempt: msg = (403, json.dumps({state: , error_message: None, error: unauthorized_client}), None, {'Content-Type': 'application/json'}) raise HTTP(*msg) What I get back: HTTP/1.1 403 FORBIDDEN Content-Length: 68 Content-Type: text/html; charset=UTF-8 Date: Thu, 07 Mar 2013 02:45:08 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {state: , error_message: null, error: unauthorized_client} Should also note that I get that same header content-type back when I access the URL with .json when the controllers are decorated with `@service.json`. How do I include headers in gluon.http.HTTP exceptions? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: How to include headers in gluon.http.HTTP exceptions?
Okay, got it to work; but it's rather messy: raise HTTP(*msg[0:2], **msg[3]) On Thu, Mar 7, 2013 at 1:47 PM, Alec Taylor alec.tayl...@gmail.com wrote: My attempt: msg = (403, json.dumps({state: , error_message: None, error: unauthorized_client}), None, {'Content-Type': 'application/json'}) raise HTTP(*msg) What I get back: HTTP/1.1 403 FORBIDDEN Content-Length: 68 Content-Type: text/html; charset=UTF-8 Date: Thu, 07 Mar 2013 02:45:08 GMT Server: Rocket 1.2.6 Python/2.7.3 Connection: keep-alive {state: , error_message: null, error: unauthorized_client} Should also note that I get that same header content-type back when I access the URL with .json when the controllers are decorated with `@service.json`. How do I include headers in gluon.http.HTTP exceptions? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] compute unique hash for each tuple/row?
What's the DAL syntax for computing a unique hash for each tuple/row? (so that no other tuple/row has that same hash) What I have tried: Field('my_field_name', unique=True, compute=lambda q: CRYPT(digest_alg='sha1',key='my_field_name',salt=True)(str(q)).split('$')[0]), -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: on social auth
It doesn't claim *web2py* compatibility it claims *webpy* compatibility I'm guessing it means web.py On Tue, Mar 5, 2013 at 1:10 AM, Michele Comitini michele.comit...@gmail.com wrote: First of al I like a library that claims web2py compatibility that's a very good sign! Does social-auth support a common API (aka janrain) to access social info or it is just the auth part? For the auth part we already cover already much of it, the dying OAuth1.0a and the now stable OAuth2.0,we have also backward compatibility with the broken facebook implementation. Maintenance is a relative issue, since these protocols should be rather stable. mic 2013/3/4 Niphlod niph...@gmail.com: that it is pure-python indeed, and frankly reinventing the wheel with a contrib module for every oauth service out there starts to be kinda hard to maintain (talking about dropbox, linkedin, openid, etc in gluon/contrib). On Sunday, March 3, 2013 9:52:57 PM UTC+1, Alan Etkin wrote: https://github.com/omab/python-social-auth Is it pure-python? What are the improvements compared to Janrain or any other built-in authentication mechanism? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: on social auth
On Tue, Mar 5, 2013 at 1:24 AM, Niphlod niph...@gmail.com wrote: On Monday, March 4, 2013 3:10:33 PM UTC+1, Michele Comitini wrote: First of al I like a library that claims web2py compatibility that's a very good sign! ? web2py is out (part of the reason why I asked if someone was interested). There's webpy, flask and django. Does social-auth support a common API (aka janrain) to access social info or it is just the auth part? seems also extra data For the auth part we already cover already much of it, the dying OAuth1.0a and the now stable OAuth2.0,we have also backward compatibility with the broken facebook implementation. Maintenance is a relative issue, since these protocols should be rather stable. That was more or less the big point: what if someone like you leaves the module the way it is and some changes are introduced in the APIs ? Did anyone tested the contrib module against something that was not facebook, google or linkedin ? There are 44 backends already tested with that module. We have 6 contrib modules for managing various oauth implementations and most of it remains probably untested (there are no unittest available for all of them)... rant mode=good way ^_^ At the end of the day. why should web2py reinvent the wheel every time (this is only an example) instead of relying on battle-tested libraries ? Less code to include in the distribution, less code to maintain, more users to test the features (testers for web2py modules and contribs are REALLY lacking), less probability that if the maintainer has something else to do the code would be updated anyway. /rant Agreed. E.g.: I tested the LinkedIn many many months ago; reported a bug; and didn't get it fixed . If we can just tie in libraries which have the functionality we want; we'll be much better off :) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Unable to import from modules folder?
My app has default routes; so I can't figure out why I can't import. I created the app mynewapp as a new simple app; then copied over the views + default models from the latest welcome app. In the modules directory I put foo_module.py, containing: #!/usr/bin/env python # coding: utf8 class Foo: def foo(): return 'bar' --- In controllers/mynewapp I put: from applications.mynewapp.modules.foo_module import Foo # also tried # from foo_module import Foo And received this error type 'exceptions.ImportError' No module named mynewapp.modules.foo_module --- How do I import functions and/or classes from /modules to my controllers? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Unable to import from modules folder?
Confirmed that the alternate suggested syntax doesn't work (same error); and that a blank '__init__.py' file is present in my modules directory. On Mon, Mar 4, 2013 at 4:10 AM, Niphlod niph...@gmail.com wrote: why don't you use the simplest form from foo_module import Foo ? PS: check that there's an __init__.y in the modules folder. If you want to use appname.modules.foo_module path, you need to check for the __init__.py also in the applications directory. On Sunday, March 3, 2013 6:03:19 PM UTC+1, Alec Taylor wrote: My app has default routes; so I can't figure out why I can't import. I created the app mynewapp as a new simple app; then copied over the views + default models from the latest welcome app. In the modules directory I put foo_module.py, containing: #!/usr/bin/env python # coding: utf8 class Foo: def foo(): return 'bar' --- In controllers/mynewapp I put: from applications.mynewapp.modules.foo_module import Foo # also tried # from foo_module import Foo And received this error type 'exceptions.ImportError' No module named mynewapp.modules.foo_module --- How do I import functions and/or classes from /modules to my controllers? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Unable to import from modules folder?
YAY! - Just figured out the problem. Looks like there was no '__init__.py' file in my application root directory (web2py/applications/mynewapp). Now that I've put one there; importing works :D On Mon, Mar 4, 2013 at 4:25 AM, Alec Taylor alec.tayl...@gmail.com wrote: Confirmed that the alternate suggested syntax doesn't work (same error); and that a blank '__init__.py' file is present in my modules directory. On Mon, Mar 4, 2013 at 4:10 AM, Niphlod niph...@gmail.com wrote: why don't you use the simplest form from foo_module import Foo ? PS: check that there's an __init__.y in the modules folder. If you want to use appname.modules.foo_module path, you need to check for the __init__.py also in the applications directory. On Sunday, March 3, 2013 6:03:19 PM UTC+1, Alec Taylor wrote: My app has default routes; so I can't figure out why I can't import. I created the app mynewapp as a new simple app; then copied over the views + default models from the latest welcome app. In the modules directory I put foo_module.py, containing: #!/usr/bin/env python # coding: utf8 class Foo: def foo(): return 'bar' --- In controllers/mynewapp I put: from applications.mynewapp.modules.foo_module import Foo # also tried # from foo_module import Foo And received this error type 'exceptions.ImportError' No module named mynewapp.modules.foo_module --- How do I import functions and/or classes from /modules to my controllers? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] web2py 2.4.2 is OUT
Looking good, especially the new serialisation and 2d geospatial On Mon, Mar 4, 2013 at 2:38 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: The book will be out shortly describing this version. I am sure there are some corners to iron but I could not wait any longer. Changelog: - 2D GEO API: geoPoint, getLine, geoPolygon - support for 'json' field type in DAL - schema export with db.as_json/as_xml, thanks Alan - graph representation of models - admin based on bootstrap, thanks Paolo - support for semantic versioning - new bootstrap based admin, thanks Paolo - improved scheduler (and change in scheduler field names), thanks Niphlod - graphiz support added to adm, thanks Jose - on_failure in grid - db.table.field.abs() - better wiki - geoPoint, getLine, geoPolygon - better reporting of 500 ajax errors - better grid - improved/fixed mongodb support - improved parse_as_rest(patterns=...), thanks Denes - improved IMAP DAL support, thanks Alan - improved security when cookies in sessions - Row.as_xml, as_json, as_dict, as_yaml thanks Alan - smarted custom_import - setup-ubuntu-12-04-redmine-unicorn-web2py-uwsgi-nginx.sh - added support for motor and pulsar servers, thanks Niphlod - added json-rpc2 support - added pypyodbc.py driver - allow auth.settings.ondelete='CASCADE' - new syntax IS_EXPR(lambda value: ... - using google for QR codes (although Graph API will be deprecated in 2015) - upgraded fpdf to 1.7.1 - bug fixes (including issues with calendar.js and archive tables) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: RESTful vs JSONRPC
Can you expand a little on features? Would be interested in a more concrete example of when to use JSONRPC over REST On Sat, Mar 2, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote: JSONRPC is a method to invoke functions that is standardized. REST is a standardized method to represent something. Standards are constructed on different things: JSONRPC standardizes the transport method and the returned values, while REST standardizes how you should represent a given entity and how you should interact with the entity itself (not the format itself). That being said, there's no standards on how to implement a particular functionality: REST is useful to interact with models, hence it's more geared towards representing your objects, and if your objects are db records, REST methods map very well to the usual CRUD operations. JSONRPC instead is more keen to map to the functional side of things: you need to code interactions with the model in your functions. That's why you can find largely on the internet both of them, but when the exposed API is something that needs to give access to a wide interlinked model the preferred method is REST, while if it exposes only features you find JSONRPC as the standard. On Saturday, March 2, 2013 9:45:35 AM UTC+1, Phyo Arkar wrote: From what it seems, RESTFUL seems a bit more complex vs JSONRPC. What are the advantages for using REST, when using full AJAX Framework like qooxdoo? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Optimising caching and enabling gzip for web2py on heroku?
Going through the Google PageSpeed Insights report (https://developers.google.com/speed/pagespeed/insights) to see what I should optimise to improve my site-load speed. The two high priority ones to worry about are: - Leverage browser caching - Enable compression How do I deal with these internally to web2py and on heroku? (e.g.: Rocket doesn't support gzip; so how do I configure this on heroku? - All the guides I saw were for Django or Flask…) FYI: I have also enabled these two lines in my db.py: response.optimize_css = 'concat,minify,inline' response.optimize_js = 'concat,minify,inline' How do I optimize these High priority metrics PageSpeed found? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Unique combination of fields in DAL?
How do I have unique field combinations in DAL? So only one of each of these 2-tuples should be allowed: db.define_table('foo', Field('bar_id', db.bar, requires=IS_IN_DB(db, 'bar.id')), Field('user_id', db.auth_user, default=auth.user_id, writable=False, requires=IS_IN_DB(db, 'auth_user.id')), ) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Unique combination of fields in DAL?
Thanks, at the moment form validation is fine to do without. What are these new DAL callbacks you're speaking of? :) On Thu, Feb 28, 2013 at 10:43 PM, Niphlod niph...@gmail.com wrote: multiple solutions have been posted in this group, but it depends if you need a validation that works for forms (in which case a requires with a smart combination of request.vars is ok) or for database inserts/updates (in which case the relatively new DAL callbacks rock - and I use them a lot). Either way, there's no syntax to enforce a PK on the table at the database level with 2 columns involved. On Thursday, February 28, 2013 12:38:13 PM UTC+1, Alec Taylor wrote: How do I have unique field combinations in DAL? So only one of each of these 2-tuples should be allowed: db.define_table('foo', Field('bar_id', db.bar, requires=IS_IN_DB(db, 'bar.id')), Field('user_id', db.auth_user, default=auth.user_id, writable=False, requires=IS_IN_DB(db, 'auth_user.id')), ) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Unique combination of fields in DAL?
Are those executing all in one callback to the database? To me it seems like I can get the same # of callbacks by: 1. Find record (x,y) in db 2. If exists, return Exists msg 3. Else, insert (x,y) into db So this naïve method would have two callbacks, and be quite inefficient. Can I do this with one callback? On Fri, Mar 1, 2013 at 2:59 AM, DenesL denes1...@yahoo.ca wrote: http://web2py.com/books/default/chapter/29/06#before-and-after-callbacks On Thursday, February 28, 2013 10:43:12 AM UTC-5, Alec Taylor wrote: Thanks, at the moment form validation is fine to do without. What are these new DAL callbacks you're speaking of? :) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Exposing `gluon.http.HTTP` as JSON?
One solution I can hack together is: @service.json def index(): raise HTTP(404, json.dumps({Hello:'bar', Foo: 'tar'})) However when I access it without '.json' I would still get the error response in JSON. How can I make it so that JSON errors are only shown for '.json'; and normal text messages are shown for HTML? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: Keyed tables and str references?
Whoops, I'm actually using SQLite (for dev) and Postgres [with PostGIS] (for prod). :\ Guess the requires=IS_IN_DB is the only syntax remaining for me to enforce referential integrity… On Friday, February 22, 2013 5:57:24 AM UTC+11, DenesL wrote: Hi Alec, is your db one of the supported ones for keyed tables? (DB2, MS-SQL, Ingres or Informix) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Need for '/index/args' following controller to grab 'args'?
Is there some method—e.g.: rewriting/specifying-in the routes—that will allow me to grab 'args' from '/controller_name/args' rather than having to use '/controller_name/index/args'? (this will result in much cleaner URLs for my users/clients) Thanks for all suggestions, Alec Taylor PS: I have reported the issue (with associated test-cases) here: http://code.google.com/p/web2py/issues/detail?id=1346 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Keyed tables and str references?
I have a bunch of tables, for simplicity lets say: db.define_table('foo', Field('foo_id'), # str Field('bar', 'reference haz.haz_id'), primarykey=['foo_id'] ) db.define_table('haz', Field('haz_id'), # str Field('foo_id', 'reference foo.foo_id'), primarykey=['haz_id'] ) (and yes, bad DB design; but it's to prove a point!) It gives me an error; on my actual db it shows: type 'exceptions.TypeError' argument of type 'bool' is not iterable On this test-case it gives: TypeError: %d format: a number is required, not NoneType How am I supposed to reference string keys between tables? E.g.: is there an `IS_IN_DB` syntax I should be using? Thanks for all suggestions, Alec Taylor PS: The keys on my actual dataset are MD5 hashes -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
Didn't know that. Okay, modified my routes.py: routers = dict( BASE = dict( default_application = 'studentstartups', applications = ['admin', 'fruit'], default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ) ) Now with this controller: # web2py\applications\fruit\controllers\salad.py def index(): print 'request.args =', request.args return str(request.args) And with this command+output with curl: $ curl -X GET http://localhost/fruit/salad/index/f ['f'] And with this output from server log: request.args = ['f'] It has become obvious that only with /index/ between salad and `args` can I get anything out of request.args… =( Bug? On Tue, Feb 19, 2013 at 4:12 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 9:04 AM, Alec Taylor alec.tayl...@gmail.com wrote: Thanks, what's the routes syntax to specific functions? This didn't work: fruit = dict( default_function = 'index', controllers = ['salad'], functions = ['index','user','download','call', 'data','error','profile',] ) Am I meant to specify the list in BASE? No, anything app-specific goes in the app's router. BTW, there's ordinarily no reason to list applications or controllers, unless you need to exclude one that's defined, because the default settings find them for you. If you're making the same request (http://localhost/fruit/salad/f), I think it should be interpreted as http://localhost/fruit/salad/index/f; that is, args = ['f']. What are you seeing? On Tue, Feb 19, 2013 at 3:49 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 8:38 AM, Niphlod niph...@gmail.com wrote: ! Missed that. On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: You've listed salad as a function, but it's a controller. PS: Next thing to code is a small page where you load routes, a text input where you can insert an http url, and a textarea with the resulting Wsplitted url (function, controller, args, vars, language, etc) (in out). @Jonathan: if it's technically possible and you don't have time, I'll put in my todo-list (and enlist you as a consultant :-P) Another thing that could be helpful in debugging routes is to call URL() with specified arguments and see what it generates. That would have shown a problem with the fruit/salad router. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Unable to import function from the appname\modules folder to my controllers
How do I import variables, functions and classes from my appname\modules folder? Following: http://rochacbruno.com.br/more-web2py-custom-validators/ I have a 'web2py\applications\appname\modules\validator.py' file, for simplicity I added this function to it: def hi(): print hello Now in 'web2py\applications\appname\controllers\default.py' I write: from validators import hi # fail import validators.hi #fail local_import('hi') # fail local_import('validators.hi') #fail How do I import variables, functions and classes from my appname\modules folder? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Unable to import function from the appname\modules folder to my controllers
Perfect, thanks. On Wed, Feb 20, 2013 at 12:48 AM, Johann Spies johann.sp...@gmail.com wrote: On 19 February 2013 15:30, Alec Taylor alec.tayl...@gmail.com wrote: How do I import variables, functions and classes from my appname\modules folder? from applications.appname.modules.modulefile import * Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
Bug reported: http://code.google.com/p/web2py/issues/detail?id=1346 On Tue, Feb 19, 2013 at 10:34 PM, Alec Taylor alec.tayl...@gmail.com wrote: Didn't know that. Okay, modified my routes.py: routers = dict( BASE = dict( default_application = 'studentstartups', applications = ['admin', 'fruit'], default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ) ) Now with this controller: # web2py\applications\fruit\controllers\salad.py def index(): print 'request.args =', request.args return str(request.args) And with this command+output with curl: $ curl -X GET http://localhost/fruit/salad/index/f ['f'] And with this output from server log: request.args = ['f'] It has become obvious that only with /index/ between salad and `args` can I get anything out of request.args… =( Bug? On Tue, Feb 19, 2013 at 4:12 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 9:04 AM, Alec Taylor alec.tayl...@gmail.com wrote: Thanks, what's the routes syntax to specific functions? This didn't work: fruit = dict( default_function = 'index', controllers = ['salad'], functions = ['index','user','download','call', 'data','error','profile',] ) Am I meant to specify the list in BASE? No, anything app-specific goes in the app's router. BTW, there's ordinarily no reason to list applications or controllers, unless you need to exclude one that's defined, because the default settings find them for you. If you're making the same request (http://localhost/fruit/salad/f), I think it should be interpreted as http://localhost/fruit/salad/index/f; that is, args = ['f']. What are you seeing? On Tue, Feb 19, 2013 at 3:49 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 8:38 AM, Niphlod niph...@gmail.com wrote: ! Missed that. On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: You've listed salad as a function, but it's a controller. PS: Next thing to code is a small page where you load routes, a text input where you can insert an http url, and a textarea with the resulting Wsplitted url (function, controller, args, vars, language, etc) (in out). @Jonathan: if it's technically possible and you don't have time, I'll put in my todo-list (and enlist you as a consultant :-P) Another thing that could be helpful in debugging routes is to call URL() with specified arguments and see what it generates. That would have shown a problem with the fruit/salad router. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?
Thanks Bruno, works like a charm. Only caveat is that the error_message is always grabbed from the first validator… On Sat, Feb 16, 2013 at 6:21 AM, Bruno Rocha rochacbr...@gmail.com wrote: Cool! but it does not allow the transformation. class CUSTOM(object): you can use a function or a lambda to validate or/and transform the field in the way you want it is the same as onvalidation and onsuccess form callbacks but it can be used per field in models or controller level Usage: # the validate function should return the error_message or None def begins_with_a(value): if not value.startswith('a'): return Should start with a else: return None # the transform function should return a value def to_upper(value): return value.upper() db.define_table(foo, Field(bar)) db.foo.bar.requires = CUSTOM(begins_with_a, to_upper) CUSTOM(begins_with_a, to_upper)('apple') ('APPLE', None) CUSTOM(begins_with_a, to_upper)('orange') ('ORANGE', 'Should start with a') def __init__(self, validate=lambda value: None, transform=lambda value: value): self.validate = validate self.transform = transform def __call__(self, value): return(self.transform(value), self.validate(value)) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: auth.settings.login_next has no functionality?
I'm not using auth.navbar(). On Wed, Feb 20, 2013 at 1:46 AM, Anthony abasta...@gmail.com wrote: If you are using auth.navbar(), by default it adds a _next variable to the auth URLs that redirects back to the page where the navbar link was clicked. The _next variable overrides the auth.settings.[action]_next settings, which are only meant as fallbacks in case there is no _next referrer. If you don't want auth.navbar() to add the _next variable by default, you can pass it the referrer_actions argument, which is a list of actions for which you do want the _next variable (so, just leave 'login' out of that list, or set it to None if you never want the _next variable). Anthony On Monday, February 18, 2013 1:39:30 AM UTC-5, Alec Taylor wrote: How do I redirect to a different page on login? Here's what I've tried: auth.settings.login_next = URL('profile') Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: auth.settings.login_next has no functionality?
It's a custom profile function. I have a controllers\profile.py file. On Wed, Feb 20, 2013 at 4:12 AM, Annet anneve...@googlemail.com wrote: Is 'profile' a custom profile function? otherwise, what about: auth.settings.login_next=URL('user',args='profile') Annet -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: auth.settings.login_next has no functionality?
Anthony, I did try with URL('profile', 'index') but got some looping error which Firefox picked up… #controllers/profile.py def index(): return dict() On Wed, Feb 20, 2013 at 5:33 AM, Anthony abasta...@gmail.com wrote: OK, it would help then if you (a) show the links as well as the code that produces them, and (b) describe what is happening instead of the expected behavior. Note, if your profile function is in a separate profile.py controller, then URL('profile') may not generate the URL you need -- if you only pass one argument to URL(), it assumes it is the function name (and defaults to the application and controller of the current request). Anthony On Tuesday, February 19, 2013 11:01:58 AM UTC-5, Alec Taylor wrote: I'm not using auth.navbar(). On Wed, Feb 20, 2013 at 1:46 AM, Anthony abas...@gmail.com wrote: If you are using auth.navbar(), by default it adds a _next variable to the auth URLs that redirects back to the page where the navbar link was clicked. The _next variable overrides the auth.settings.[action]_next settings, which are only meant as fallbacks in case there is no _next referrer. If you don't want auth.navbar() to add the _next variable by default, you can pass it the referrer_actions argument, which is a list of actions for which you do want the _next variable (so, just leave 'login' out of that list, or set it to None if you never want the _next variable). Anthony On Monday, February 18, 2013 1:39:30 AM UTC-5, Alec Taylor wrote: How do I redirect to a different page on login? Here's what I've tried: auth.settings.login_next = URL('profile') Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
routers = dict( BASE = dict( default_application = 'fruit', applications = ['fruit', 'admin'], default_controller = 'default', controllers = 'DEFAULT', default_function = 'index', ), fruit = dict( default_function = 'index', functions = ['index','user','download','call', 'data', 'error','profile','salad'] ) ) On Mon, Feb 18, 2013 at 7:17 PM, Niphlod niph...@gmail.com wrote: of course this can't be possible, the entire framework will implode without a proper request routing: have you some custom routing in place ? -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
I have created a tiny test-case which proves that I can't properly acquire request.args: https://gist.github.com/anonymous/4978457 What am I doing wrong; how am I supposed to acquire request.args? (I want URL per uid of record) On Tue, Feb 19, 2013 at 12:48 AM, Niphlod niph...@gmail.com wrote: did you try turning debug on for routes ? Can you confirm that curl hits the function you're printing args into ? (i.e. it doesn't call /fruit/index/salad/foo) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
Thanks, what's the routes syntax to specific functions? This didn't work: fruit = dict( default_function = 'index', controllers = ['salad'], functions = ['index','user','download','call', 'data','error','profile',] ) Am I meant to specify the list in BASE? On Tue, Feb 19, 2013 at 3:49 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 8:38 AM, Niphlod niph...@gmail.com wrote: ! Missed that. On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: You've listed salad as a function, but it's a controller. PS: Next thing to code is a small page where you load routes, a text input where you can insert an http url, and a textarea with the resulting Wsplitted url (function, controller, args, vars, language, etc) (in out). @Jonathan: if it's technically possible and you don't have time, I'll put in my todo-list (and enlist you as a consultant :-P) Another thing that could be helpful in debugging routes is to call URL() with specified arguments and see what it generates. That would have shown a problem with the fruit/salad router. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: How to get request.args from an index() function?
*controllers that is On Tue, Feb 19, 2013 at 4:04 AM, Alec Taylor alec.tayl...@gmail.com wrote: Thanks, what's the routes syntax to specific functions? This didn't work: fruit = dict( default_function = 'index', controllers = ['salad'], functions = ['index','user','download','call', 'data','error','profile',] ) Am I meant to specify the list in BASE? On Tue, Feb 19, 2013 at 3:49 AM, Jonathan Lundell jlund...@pobox.com wrote: On 18 Feb 2013, at 8:38 AM, Niphlod niph...@gmail.com wrote: ! Missed that. On Monday, February 18, 2013 5:23:55 PM UTC+1, Jonathan Lundell wrote: You've listed salad as a function, but it's a controller. PS: Next thing to code is a small page where you load routes, a text input where you can insert an http url, and a textarea with the resulting Wsplitted url (function, controller, args, vars, language, etc) (in out). @Jonathan: if it's technically possible and you don't have time, I'll put in my todo-list (and enlist you as a consultant :-P) Another thing that could be helpful in debugging routes is to call URL() with specified arguments and see what it generates. That would have shown a problem with the fruit/salad router. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Replace default /register and /login views
I am trying to replace these views with custom ones I've created. So I have a folder called user with a login.html and a register.html. Putting this user folder in web2py/appname/views does not make the system use these views. Moving them to the web2py/appname/views/default folder also has no affect. How do I use custom views for my auth.* stuff in web2py? (e.g.: so @auth.requires_login() redirects to the modified views) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Replace default /register and /login views
Thanks On Mon, Feb 18, 2013 at 3:49 AM, Anthony abasta...@gmail.com wrote: By default, web2py looks for a view with the same name as the associated function in a folder with the same name as the associated controller. In the scaffolding app, auth actions are handled by the user() function in the default.py controller, so it will automatically use the /views/default/user.html view for all auth actions. If you want to set a custom view, you can do something like: def user(): auth_views = dict(login='default/login.html', register='default/register.html') response.view = auth_views.get(request.args(0), response.view) return dict(form=auth()) You could also create completely separate functions for login and registration. Anthony On Sunday, February 17, 2013 10:34:11 AM UTC-5, Alec Taylor wrote: I am trying to replace these views with custom ones I've created. So I have a folder called user with a login.html and a register.html. Putting this user folder in web2py/appname/views does not make the system use these views. Moving them to the web2py/appname/views/default folder also has no affect. How do I use custom views for my auth.* stuff in web2py? (e.g.: so @auth.requires_login() redirects to the modified views) Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] auth.settings.login_next has no functionality?
How do I redirect to a different page on login? Here's what I've tried: auth.settings.login_next = URL('profile') Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] How to get request.args from an index() function?
I can't get the request.args from an index function. E.g.: within app 'fruit' I have a controller 'salad', like so: # web2py/applications/fruit/controllers/salad.py def index() print request.args return dict() # curl -X GET localhost/fruit/salad/foo # web2py console output: [] How to get request.args from an index() function? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py + exceptions(tickets) service?
On Fri, Feb 15, 2013 at 8:00 PM, Niphlod niph...@gmail.com wrote: Thanks for the answer Niphlod, but didn't understand the last part about being alerted(besides taking a look at the admin app). Cheers! http://web2py.com/books/default/chapter/29/13#Collecting-tickets and https://github.com/web2py/web2py/blob/master/scripts/tickets2email.py If you need additional features contribute back some code (or at least the ideas :P) -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. ^Awesome -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Validator: {Validator1 OR validator2} - Can I get that requires on a Field?
I am writing in a signup form for users of my site. To signup, they can either use their email address `IS_EMAIL()`; or an outside uid (covered by an `IS_MATCH()`). (it's a 1 field form) One solution to validating the form is to just check the vars in the controller, and have two Fields in the Table; one for email, the other for this outside uid. Is there another solution; utilising multiple validators in the requires, much like `IS_NONE_OR()` validator? Thanks for all suggestions, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: web2py + exceptions(tickets) service?
Cool website; however web2py has those features built-in :) As for setting up email alerts for tickets—e.g.: that have been reported a certain number of times—I think that's a strong feature-request to add into the issue queue (or build yourself and pull-request back). On Fri, Feb 15, 2013 at 6:39 PM, Luciano Laporta Podazza lucianopoda...@gmail.com wrote: On Thursday, February 14, 2013 4:39:14 PM UTC-3, Niphlod wrote: as far as I'm concerned no, but adding support shouldn't be that difficult if you have time to spend on it. PS: If you just need to be alerted as soon as an exception has been fired by your app, web2py has already all the bits you need. Thanks for the answer Niphlod, but didn't understand the last part about being alerted(besides taking a look at the admin app). Cheers! On Thursday, February 14, 2013 5:00:24 PM UTC+1, Luciano Laporta Podazza wrote: Hello!, I would like to know if there's something like http://www.exceptional.io but with support for web2py?. Thanks! -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Integrating iPhone device tokens into web2py auth
Hmm; good point. On Wed, Feb 13, 2013 at 4:30 AM, howesc how...@umich.edu wrote: for our system we have anonymous users (users with no email address), and known users (users with an email address. Apple does not expose the MAC address, the IMEI or the apple UDID of iOS devices to developers. their policies strictly forbid the use of hardware identifiers in apps distributed via the app store. Apple also strongly suggests that you verify all in-app-purchases from your server to prevent theft (and it's worth it, i see lots of attempted theft) so, given that our business wants users to be able to use 95% of the apps features without creating an account (sharing your email/password and some other info we ask for), and we use apple's receipt verification to check for fraudulent purchases, both the client and the server have to know about a particular application install. that gets us to where i am at today: - app launches and gets an OAuth token from the server (creates an end_user record on the server) (this OAuth token essentially becomes an application installation identifier) - app stores data about the user - server stores data about the user - later user may login which may be logging in to an existing account they made on another device (cause lots of apple device users have multiple devices) or a new user. in the login case we merge the activity of the user from before login. now if the business would allow us to require login before the user started the app, problem is solved.but we would lose 50-70% of our new users daily. On Monday, February 11, 2013 9:01:40 PM UTC-8, Alec Taylor wrote: On Tue, Feb 12, 2013 at 4:29 AM, howesc how...@umich.edu wrote: Thanks Alec, that will be a nice contribution. re my special odd pain in the rear-end login flow.well we (the engineers) failed to sell that to the business. users can make purchases via apple without a proper logged in account, and we need to track those on the server. hence the anonymous user. it would be really nice if apple shared with us the itunes user ID on app launch, but they don't because they believe that violates the user's privacy (and i kinda agree on that point). So i'm stuck with an overly complex login flow. :( cfh How do you differentiate between different anonymous users? Are you looking at MAC address or other related IDs? It sounds to me that that's still an open problem. And that not generating any ID but storing data in LocalStorage (or a cookie; or whatever else: locally) would be the most secure way of confirming accountability. Given an e-commerce scenario; on checkout the anonymous user would submit their entire LocalStorage; which obviously includes cart. Their shipping details and whatnot would include an email address, so create them that profile; log them in; and email them their randomly generated password. #problem=solved -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Converting Field of a SQLFORM.grid to local timezone of a user.....
To keep things simple on the database side; how about making all times UTC? Then use JavaScript to impose timezone on the client-side. On Wed, Feb 13, 2013 at 2:20 PM, Michael Beller mjbel...@gmail.com wrote: this stores dates in UTC but displays date in alternate timezone. You can set the represent property based on a timezone stored in the users profile or derived from locale settings ... from pytz import timezone import pytz db.define_table('t_date', Field('f_name'), Field('f_datetime', type='datetime', default=request.utcnow), Field('f_utcdatetime', type='datetime', default=request.utcnow), migrate=True) db.t_date.f_datetime.represent = lambda value, row : pytz.UTC.localize(value).astimezone(timezone('US/Eastern')) I used information in the following two pages for help ... http://stackoverflow.com/questions/7065164/how-to-make-an-unaware-datetime-timezone-aware-in-python?lq=1 http://pypi.python.org/pypi/pytz/ On Tuesday, February 12, 2013 7:40:59 AM UTC-5, Michael Beller wrote: I've also been researching and experimenting ... I've come to the conclusion to only store utc dates (e.g., using utcnow) in the data base and then use .represent or other means to convert for display. Most notably, use the putz python library ... On Tuesday, February 12, 2013 1:58:26 AM UTC-5, rochacbruno wrote: I am on mobile now and I cant ellaborate a good code example, but I can give you a hint. db.table.datefield.represent = lambda value, row : value.strftime(%Y/%m/%d) grid = SQLFORM.grid(db.table) so grid will use the represent callback to display the data. following this example you can do def set_timezone(value, row): return value. #do the calculation db.table.field.represent = set_timezone Em 12/02/2013 04:44, newbie neha...@gmail.com escreveu: On Tuesday, 12 February 2013 11:06:00 UTC+5:30, newbie wrote: Hi, I have a table x, with fields name,place,timezone_offset.And another table y ,having field 'servertime',which stores the current time of the server its fetching the values from. db.define_table('x',Field('name'),Field('place'),Field('timezone_offset')) db.define_table('y',Field('name'),Field('servertime')) User will set the timezone offset in table x, for a particular name. There is one thread continuously running in background in the server which will save the servertime as local time using datetime.datetime.now() in table y for the name. And finally this data displayed by using SQLFORM.grid on the UI. Problem facing: We have to convert the local time saved for the name field as per saved timezone_offset in x table and display on the grid without modifying anything on database level. It means suppose for name ='Alex' timezone_offset was being saved as -5 in x table and suppose server running on different timezone lets say on +5.30 so for name Alex server will save the servertime in +5.30 format as it is the local time for the server but when it will be displayed on the grid servertime should first get converted to Alex timezone_offset which is set as -5 and then display on the grid. Can anyone please suggest me how can I achieved in web2py? Is there any way to achieve it using SQLFORM.grid()? Thanks. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Integrating iPhone device tokens into web2py auth
On Tue, Feb 12, 2013 at 4:29 AM, howesc how...@umich.edu wrote: Thanks Alec, that will be a nice contribution. re my special odd pain in the rear-end login flow.well we (the engineers) failed to sell that to the business. users can make purchases via apple without a proper logged in account, and we need to track those on the server. hence the anonymous user. it would be really nice if apple shared with us the itunes user ID on app launch, but they don't because they believe that violates the user's privacy (and i kinda agree on that point). So i'm stuck with an overly complex login flow. :( cfh How do you differentiate between different anonymous users? Are you looking at MAC address or other related IDs? It sounds to me that that's still an open problem. And that not generating any ID but storing data in LocalStorage (or a cookie; or whatever else: locally) would be the most secure way of confirming accountability. Given an e-commerce scenario; on checkout the anonymous user would submit their entire LocalStorage; which obviously includes cart. Their shipping details and whatnot would include an email address, so create them that profile; log them in; and email them their randomly generated password. #problem=solved -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Integrating iPhone device tokens into web2py auth
Not to worry, I'm releasing a generalised open-source OAuth2 Library for web2py. As for your current mechanism of anonymous tokens… how about just storing a cookie (or some other client-side storage) and when the user logs-in or registers all their customisations (e.g.: if e-commerce, their cart) will be sent securely to the server on receipt of successful authentication. That would be a much cleaner, more secure, streamlined and self-contained model than your current one. On Sun, Feb 10, 2013 at 9:33 AM, howesc how...@umich.edu wrote: - Apple explicitly does not allow using the hardware identifier in your app, and will reject app submission that do that. because of this each app install logs in first as an anonymous user. - website users use standard web2py auth - app connections to the server use our modified OAuth API implementation. this forgoes web2py auth, but reads and writes to the same user table that web2py auth uses. this allows the 2 different systems to connect. - the mobile apps are native code on their respective platforms, the website is html. unfortunately our modified OAuth implementation is pretty specific to our needs and so i don't think it's a candidate for us to open source. i'll take a look into what we are doing though to see if any of it can/should be open sourced. cfh On Saturday, February 9, 2013 11:40:50 AM UTC-8, Kenny wrote: Howesc, Thanks for great info. So, does mobile app user have to register web2py via access token provided by their hardware in mobile application? May you explain how you built the login/registration module for mobile app users along with web2py? Do you code in html5 with native code for developing your mobile app? Sorry for asking more than one question, this topic sounds so interesting! :) Thank you! On Feb 9, 2013 11:45 AM, howesc how...@umich.edu wrote: well what we are using is a hybrid model: - the ios device uses a modified form of OAuth to get access tokens (and we have the confusing problem of users start anonymous but with an access token, and then may later create an account associating an email and other user data with the account) - the website uses web2py's auth to login those same users - the APNS token (Apple Push Notification Service) is provided optionally by the user if they opt-in to push notifications. as such it's not a primary key for the user and can't be used for authentication. if the user chooses to share it with us we store that in a field on our user table. Note that the APNS token is device specific, so if the user has multiple devices then they might have multiple tokens. does that clarify at all? cfh On Friday, February 8, 2013 9:46:42 PM UTC-8, Massimo Di Pierro wrote: I do not know how this works. Can you give us more details? On Friday, 8 February 2013 20:31:14 UTC-6, howesc wrote: i have millions of APNS tokens! i'd share, but they are tied to an app i did not tie APNS tokesn to web2py auth, but i added fields to my end user table, and the device uses my REST JSON API to POST the APNS tokens to the server and update the user. we don't use the APNS token as any sort of user identifier. does that help? lemme know if you are interested in more details. christian On Thursday, February 7, 2013 5:22:28 PM UTC-8, chris_g wrote: I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain Device Tokens. I'm curious if anyone has implemented a solution that takes care of this. I'd like to see how it was integrated with web2py's auth. Thanks, Chris -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+un...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Mmm, suppose I could do things like that… But it is rather annoying that web2py has no built-in reverse-engineering (intropspection) that can impose a web2py overlay atop an existing database… On Sat, Feb 9, 2013 at 7:04 PM, Bruno Rocha rochacbr...@gmail.com wrote: If your contrib needs to have its own models and controllers, then you should create it as a plugin. Or you can create a module and define an API for it, take a dummy example. /modules/myawesomemodule.py class MyAwesomeClass(object): it creates the Awesome object which is a login_method to use include in your models db = DAL() from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something def __init__(db, *args, **kwargs): self.db = db def define_tables(self, migrate=True): self.table1 = self.db.define_table(table1, Field(a_field), migrate=migrate ) self.table2 = self.db.define_table(table2, Field(a_field), migrate=migrate ) def do_something(self): self.data = self.db(.).select() # do domething return data Then in following your documentation developers should use you module api as: models/db.py db = DAL(.) from myawesomemodule import MyAwesomeClass something = MyAwesomeClass(db) something.define_tables() auth.settings.login_methods = something On Sat, Feb 9, 2013 at 5:34 AM, Alec Taylor alec.tayl...@gmail.com wrote: But I am creating a contrib for: https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods (OAuth2; my work-in-progress is on Github) But because of the design of the standard I require 3 additional tables + a user table. So how do you propose I manage this scenario? On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha rochacbr...@gmail.com wrote: Usually you create a script file in /models/db.py then you define your tables there, so when starting in shell mode you pass -M python web2py.py -S yourapp -M -M run the models/* files and defines your table as object for you to access. Every framework works in this way. Optionally, you can use db.executesql(PUT YOUR SQL HERE) and do it by your own... On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor alec.tayl...@gmail.com wrote: Hold up; you mean to tell me I need to redefine the schema each time a new db (DAL object) needs to access it? That sounds silly. Isn't there a way around this? On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: let say you have table1 and table2 in database, you shoud define your tables db.define_table('table1', ..) and only after that you will have access to db.table1 you can;t access db.table2 if it is not defined even if it exists in the database -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
On Sat, Feb 9, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote: wait a second . you may be missing an important bit. DAL has no introspection whatsoever for retrieving existing tables if you have not defined them. That doesn't mean that you have to define tables at every connection (it's easy, but let's assume you don't want to). When you define tables on an empty database, some .table files are created in the databases/ folder . They are pickles of the table structure, the same one DAL uses to compare with the existing model and - optionally - do a migration. Once you have those .table files, you can skip the define_table() statements giving auto_import=True to the DAL connection (obviously the database uri has to be the same one with the tables in it). The only thing you may need is to pass along the folder where the .table files are with the folder parameter . PS: an oauth2 implementation has been achieved by michele, it's a few days away to be included in the web2py source . https://github.com/web2py/web2py/pull/57 Wait, what, seriously?! :( I can't see that pull request ATM (github is under maintenance), but I did post an announcement here on the web2py list over 8 days ago… Might've been nicer to tell me then. Anyway, I have around 30 custom exceptions built on the gluon.http.HTTP class, so will review the patch once github is back online and see what I can integrate… I guess -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Okay, GitHub maintenance has ended. That pull-request isn't for a server; it's for a consumer. I'm building—and have just about finished—an OAuth2 server (provider) for web2py. To put it simply: We currently consume Facebook to grab facebook user details and whatnot With my package we will be able to expose our data for other people to consume; in the same way other people consume Facebook. Anyway, it's very close to completion. Have a handful of [found] bugs left. Also fixed that db problem with a rather elegant decorator; but it's still nowhere near how I'd like it to be. On Sun, Feb 10, 2013 at 12:42 AM, Alec Taylor alec.tayl...@gmail.com wrote: On Sat, Feb 9, 2013 at 11:53 PM, Niphlod niph...@gmail.com wrote: wait a second . you may be missing an important bit. DAL has no introspection whatsoever for retrieving existing tables if you have not defined them. That doesn't mean that you have to define tables at every connection (it's easy, but let's assume you don't want to). When you define tables on an empty database, some .table files are created in the databases/ folder . They are pickles of the table structure, the same one DAL uses to compare with the existing model and - optionally - do a migration. Once you have those .table files, you can skip the define_table() statements giving auto_import=True to the DAL connection (obviously the database uri has to be the same one with the tables in it). The only thing you may need is to pass along the folder where the .table files are with the folder parameter . PS: an oauth2 implementation has been achieved by michele, it's a few days away to be included in the web2py source . https://github.com/web2py/web2py/pull/57 Wait, what, seriously?! :( I can't see that pull request ATM (github is under maintenance), but I did post an announcement here on the web2py list over 8 days ago… Might've been nicer to tell me then. Anyway, I have around 30 custom exceptions built on the gluon.http.HTTP class, so will review the patch once github is back online and see what I can integrate… I guess -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] SQLite tables not recognised in web2py; even when web2py created them?
Experiencing some very strange errors on the latest web2py (2.4.1-alpha.2+timestamp.2013.02.07.05.36.19). In my 'myapp2' application I have created a database, defined as follows: db = DAL('sqlite://mydb2.sqlite', pool_size=1, check_reserved=['all']) Now I defined some tables and inserted some data into it. (all from the \modules folder) To confirm the tables and data exists I opened up the 5KB SQLite file in two different external database programs, including the SQLite Manager firefox extension. It was all there. But one of my functions in that same \modules folder couldn't find an entry in the db (the db DAL object was sent from \controllers though). So from my code (and subsequent from $web2py.py -S myapp2) I ran db.tables and got []. The exact same connection string is used throughout my code; so why isn't this working? Thanks for all suggestions, Alec Taylor PS: Searching my entire web2py directory brought up only one sqlite file named 'mydb2' -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Fully self contained example: web2py.py -p 80 -S myapp2 web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.4.1-alpha.2+timestamp.2013.02.07.05.36.19 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), Oracle(cx_Oracle), MongoDB(pymongo), IMAP(imaplib) Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] Type copyright, credits or license for more information. In [1]: db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all']) In [2]: db.tables Out[2]: [] In [3]: db.define_table('examples_are_awesome', Field('foo')) Out[3]: Table examples_are_awesome (id,foo) In [4]: db.commit() # tried with + without this line In [5]: db.tables Out[5]: ['examples_are_awesome'] In [6]: exit web2py.py -p 80 -S myapp2 web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.4.1-alpha.2+timestamp.2013.02.07.05.36.19 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), Oracle(cx_Oracle), MongoDB(pymongo), IMAP(imaplib) Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] Type copyright, credits or license for more information. In [1]: db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all']) In [2]: db.tables() Out[2]: [] On Sat, Feb 9, 2013 at 3:07 AM, Alec Taylor alec.tayl...@gmail.com wrote: Experiencing some very strange errors on the latest web2py (2.4.1-alpha.2+timestamp.2013.02.07.05.36.19). In my 'myapp2' application I have created a database, defined as follows: db = DAL('sqlite://mydb2.sqlite', pool_size=1, check_reserved=['all']) Now I defined some tables and inserted some data into it. (all from the \modules folder) To confirm the tables and data exists I opened up the 5KB SQLite file in two different external database programs, including the SQLite Manager firefox extension. It was all there. But one of my functions in that same \modules folder couldn't find an entry in the db (the db DAL object was sent from \controllers though). So from my code (and subsequent from $web2py.py -S myapp2) I ran db.tables and got []. The exact same connection string is used throughout my code; so why isn't this working? Thanks for all suggestions, Alec Taylor PS: Searching my entire web2py directory brought up only one sqlite file named 'mydb2' -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Editing problem with current admin app
Nico: Try with the latest web2py (from github); I had that same problem you mentioned 'till I upgraded On Sat, Feb 9, 2013 at 3:11 AM, Nico Zanferrari nicoz...@gmail.com wrote: I wish I could, but unfortunately I don't have any CSS knowledge ;-(( But I'll be happy to help with testing and debugging, if needed. Nico 2013/2/7 Massimo Di Pierro massimo.dipie...@gmail.com Can you help us fix the css? On Wednesday, 6 February 2013 15:14:40 UTC-6, Nico Zanferrari wrote: Hi, I really like the web editor inside the current admin app, and I'm using it more and more for various reasons. I think that the recent changes are pointing towards a Github look and feel, where you have a notification area on the top and an editing frame in the middle. This works quite fine with current web2py admin app but: 1. the editing frame is too small (roughly half the number of the Github lines) 2. the editing frame is not fixed. This really is a big issue, because if you're editing down the first page you cannot see the notification area on the top and so you miss any message when you save (not even an error one!). Is it a known problem? Should I open a ticket? Thank you, Nico -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
On Sat, Feb 9, 2013 at 6:28 AM, Niphlod niph...@gmail.com wrote: dal has no introspection (i.e. it doesn't ask any schema information, nor it tries to calculate it). until you define your tables (or do DAL(, auto_import=True)) DAL will never know that a table exists. Unfortunately that didn't work… In [1]: db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all'], auto_import=True) --- TypeError Traceback (most recent call last) ipython-input-3-2e594e209033 in module() 1 db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all'], auto_import=True) web2py\gluon\dal.pyc in __init__(self, uri, pool_size, folder, db_codec, check_reserved, migrate, fake_migrate, migrate_ enabled, fake_migrate_all, decode_credentials, driver_args, adapter_args, attempts, auto_import, bigint_id, debug, lazy_tables, db_uid, do_connect) 7228 if auto_import or dbdict: 7229 self.import_table_definitions(adapter.folder, - 7230 items=dbdict[items]) 7231 7232 @property TypeError: 'NoneType' object has no attribute '__getitem__' On Friday, February 8, 2013 5:14:22 PM UTC+1, Alec Taylor wrote: Fully self contained example: web2py.py -p 80 -S myapp2 web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.4.1-alpha.2+timestamp.2013.02.07.05.36.19 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), Oracle(cx_Oracle), MongoDB(pymongo), IMAP(imaplib) Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] Type copyright, credits or license for more information. In [1]: db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all']) In [2]: db.tables Out[2]: [] In [3]: db.define_table('examples_are_awesome', Field('foo')) Out[3]: Table examples_are_awesome (id,foo) In [4]: db.commit() # tried with + without this line In [5]: db.tables Out[5]: ['examples_are_awesome'] In [6]: exit web2py.py -p 80 -S myapp2 web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2013 Version 2.4.1-alpha.2+timestamp.2013.02.07.05.36.19 Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL(pg8000), Oracle(cx_Oracle), MongoDB(pymongo), IMAP(imaplib) Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] Type copyright, credits or license for more information. In [1]: db = DAL('sqlite://myapp2.sqlite', pool_size=1, check_reserved=['all']) In [2]: db.tables() Out[2]: [] On Sat, Feb 9, 2013 at 3:07 AM, Alec Taylor alec.t...@gmail.com wrote: Experiencing some very strange errors on the latest web2py (2.4.1-alpha.2+timestamp.2013.02.07.05.36.19). In my 'myapp2' application I have created a database, defined as follows: db = DAL('sqlite://mydb2.sqlite', pool_size=1, check_reserved=['all']) Now I defined some tables and inserted some data into it. (all from the \modules folder) To confirm the tables and data exists I opened up the 5KB SQLite file in two different external database programs, including the SQLite Manager firefox extension. It was all there. But one of my functions in that same \modules folder couldn't find an entry in the db (the db DAL object was sent from \controllers though). So from my code (and subsequent from $web2py.py -S myapp2) I ran db.tables and got []. The exact same connection string is used throughout my code; so why isn't this working? Thanks for all suggestions, Alec Taylor PS: Searching my entire web2py directory brought up only one sqlite file named 'mydb2' -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
Hold up; you mean to tell me I need to redefine the schema each time a new db (DAL object) needs to access it? That sounds silly. Isn't there a way around this? On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: let say you have table1 and table2 in database, you shoud define your tables db.define_table('table1', ..) and only after that you will have access to db.table1 you can;t access db.table2 if it is not defined even if it exists in the database -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Integrating iPhone device tokens into web2py auth
You'd probably be better off using OAuth2… On Fri, Feb 8, 2013 at 12:22 PM, chris_g chrisgu...@gmail.com wrote: I'm looking into supporting Apple push notifications in an iPhone app that connects to a web2py server. In order to know which devices to push details to, web2py's auth module would presumably need to maintain Device Tokens. I'm curious if anyone has implemented a solution that takes care of this. I'd like to see how it was integrated with web2py's auth. Thanks, Chris -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: SQLite tables not recognised in web2py; even when web2py created them?
But I am creating a contrib for: https://github.com/web2py/web2py/tree/master/gluon/contrib/login_methods (OAuth2; my work-in-progress is on Github) But because of the design of the standard I require 3 additional tables + a user table. So how do you propose I manage this scenario? On Sat, Feb 9, 2013 at 6:26 PM, Bruno Rocha rochacbr...@gmail.com wrote: Usually you create a script file in /models/db.py then you define your tables there, so when starting in shell mode you pass -M python web2py.py -S yourapp -M -M run the models/* files and defines your table as object for you to access. Every framework works in this way. Optionally, you can use db.executesql(PUT YOUR SQL HERE) and do it by your own... On Sat, Feb 9, 2013 at 4:13 AM, Alec Taylor alec.tayl...@gmail.com wrote: Hold up; you mean to tell me I need to redefine the schema each time a new db (DAL object) needs to access it? That sounds silly. Isn't there a way around this? On Saturday, February 9, 2013 4:40:28 PM UTC+11, Vasile Ermicioi wrote: let say you have table1 and table2 in database, you shoud define your tables db.define_table('table1', ..) and only after that you will have access to db.table1 you can;t access db.table2 if it is not defined even if it exists in the database -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Autoincrement field
Optionally you can define a field of `type='id'` and web2py will use this field as auto-increment id field. This is not recommended except when accessing legacy database tables. With some limitation, you can also use different primary keys and this is discussed in the section on Legacy databases and keyed tables. — http://web2py.com/books/default/chapter/29/06#DAL,-Table,-Field -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Why must 'id' primary-key Field in DAL be an integer?
https://github.com/web2py/web2py/blob/master/gluon/dal.py#L1776 The reason I ask is that I am following the OAuth2 spec which uses hashes for IDs. I mean, I can have two IDs; one which I never [ever!] use; but that wouldn't be very efficient… in code conciseness or database design. So why must 'id' primary-key Field in DAL be an integer? Thanks for all information, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] web2py IDEs; maintain a wiki with plugins?
Can we bring up a community wiki page for this? For editing web2py apps, I have personally used: Eclipse, Geany, Sublime Text 2, nano and the online editor. Currently my editor of choice is Sublime Text 2. In the quoted message below this repo was mentioned; https://github.com/cassiobotaro/my_sublime However when attempting to install I get this: D:\Projects\my_sublimepython setup.py Traceback (most recent call last): File setup.py, line 6, in module USER = os.getlogin() AttributeError: 'module' object has no attribute 'getlogin' How do I fix this? Also, what's a good 'lightweight' IDE for use with web2py; which supports: - Code completion - Syntax highlighting (preferably for web2py functions+libraries+objects also) - Goto definition (where this function was defined or object was initiated) - Open folder as project (preferably from command-line; currently do this with sublime_text folder_location - Linux and Windows Thanks for all suggestions, Alec Taylor On Sat, Feb 2, 2013 at 3:13 AM, select gr...@delarue-berlin.de wrote: On Thursday, January 31, 2013 1:26:45 PM UTC+1, Johann Spies wrote: On 31 January 2013 13:03, Jason Brower enco...@gmail.com wrote: Interesting that we have coding tools built into our framework. http://www.webdesignerdepot.com/2013/01/web-ides-the-future-of-coding/ When webeditors become as good as emacs, vim, bluefish, I will consider it. For now I did not find any editor that can compete with them. http://ace.ajax.org/build/kitchen-sink.html (c9 editor) is already quite impressive IMHO, with the vim commands enabled it feels quite natural to work with, then again i have ST2 which makes me super happy Here are the plugins I use, in case you use ST2 for web2py too AdvancedNewFile AutoPep8 BracketHighliter (with some color customization) CssComb DocBlockr Emmet (Zen Coding) LiveReload SublimeCodeIndel SublimeLinter (https://github.com/cassiobotaro/my_sublime/blob/master/SublimeLinter.sublime-settings for web2py) SideBar Regards. Johann -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[web2py] Unstructured table creation in DAL; akin to NoSQL?
I am porting a library to web2py's DAL from pymongo; and looking through it I'll likely need to write something like these two lines (and the corresponding function): if not db[tablename]: create_my_tables() Which is fine; but got me thinking. Can we add support for unstructured data in DAL? - Specifically generalised key-value pair type things? Thanks for your consideration, Alec Taylor -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Unstructured table creation in DAL; akin to NoSQL?
On Fri, Feb 1, 2013 at 4:23 AM, Alan Etkin spame...@gmail.com wrote: I am porting a library to web2py's DAL from pymongo; and looking Sorry, may I ask what library? dal already has experimental support for mymongo trough the MongoDBAdapter. Have you considered using/extending it? I am porting it to DAL from Mongo; allowing for Mongo + other DBs to be used + the DAL syntax and its many advantages (form generation whatnot). Probably just 30 minutes of work left for it then another little bit for testing and it'll be ready. My fork is public and on github. Will post it on this list when it's fully tested + better documented. -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] Re: Autoincrement field
On Wed, Jan 30, 2013 at 1:15 AM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Please open a ticket about this. http://code.google.com/p/web2py/issues/detail?id=1311 -- --- You received this message because you are subscribed to the Google Groups web2py-users group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [web2py] How to implement web2py password encryption in php
What version of web2py have you started your app on? On Mon, Jan 28, 2013 at 6:32 PM, hasan alnator halna...@gardeniatelco.com wrote: Dear Alen , but i need to know What is the encryption what web2py implements on the password field in the auth_user table ? Best Regards, On Mon, Jan 28, 2013 at 10:29 AM, Alec Taylor alec.tayl...@gmail.com wrote: Use the same hash function that you use in web2py; in php. For further discussion on how to write this in; go onto a PHP mailing-list. On Mon, Jan 28, 2013 at 6:08 PM, hasan alnator halna...@gardeniatelco.com wrote: Dear Alec, I tried this but am now getting the same value in the databae : ?php echo hash('ripemd160', 'mypassword'); ? regards, On Mon, Jan 28, 2013 at 10:05 AM, Alec Taylor alec.tayl...@gmail.com wrote: http://php.net/manual/en/function.hash.php On Mon, Jan 28, 2013 at 5:59 PM, Hassan Alnatour halna...@gardeniatelco.com wrote: Dear ALL , How can i implement web2py password encryption in php ? Best Regards, -- -- -- -- -- --
Re: [web2py] Re: How do I import `gluon.dal` from Python shell?
Thanks, but is there a non-hacky solution? On Mon, Jan 28, 2013 at 6:55 PM, Emilius Omeen om...@bk.ru wrote: import sys sys.path.append('/home/www-data/web2py') from gluon import DAL, Field -- --
Re: [web2py] Re: Autoincrement field
Which DB are you using BTW? Because if you're using something like MySQL; they have inbuilt autoincrement fields which would be much better to utilise than what we provide in the DAL. Maybe we should have an 'autoincrement' field, like we have a 'datetime' field? Gracefully degrade to a lambda if there isn't native autoincrement support. On Tue, Jan 29, 2013 at 1:44 AM, szimszon szims...@gmail.com wrote: Hi! I wonder if somebody could help me. The definet_table('sometable', Field('otherid', compute=lambda r: r['id']) ) doesn't work for me. :( Sould it work? With other than r['id'] it's working. Version 2.4.1-alpha.2+timestamp.2013.01.27.10.24.17 2010. május 28., péntek 16:02:23 UTC+2 időpontban mdipierro a következőt írta: yes On May 28, 3:44 am, Mathieu Clabaut mathieu.clab...@gmail.com wrote: I guess that one may want some more constraints on the autoincrement field. For example, it shall begin at 100 for ecample. It may be because for example, before the application exists some paper records where made which were referenced by number 100) For such a problem, I've set up with: Field('ref_number', compute=lambda r: r['id'] + 100) Which I hope would eliminate the race solution as it is calculate upon insertion in the database... Is it the case ? -Mathieu On Thu, May 27, 2010 at 23:25, mdipierro mdipie...@cs.depaul.edu wrote: What is wrong with the default id field that web2py creates for every table? On May 27, 3:16 pm, matclab mathieu.clab...@gmail.com wrote: Hello, I'm finding this message in a thread from February... I thought that autoincremented field would guaranty unicity in the table. I'm afraid the provided solution would allow two record to have the same autonumber field (think about an access from two users at the same time). I guess the autoincrement should be done on the DAL or database side, inside a transaction What do you think about it ? On 19 jan, 21:38, Thadeus Burgess thade...@thadeusb.com wrote: max_id= db(db.table.autonumber1).select(db.table.autonumber, # select all records, and only pull the autonumber column orderby=~db.table.autonumber, # descending sort on the autonumber, (highest first) limitby=(0,1) # limit the query and only select the first record ).first().autonumber # pull the first record from the web2py rows object, and get its autonumber member db.table.autonumber.default = max_id + 1 # Set the table default as the last autonumber and incremented by one. db.table.autonumber.writable = False form = crud.create(db.table) -Thadeus On Tue, Jan 19, 2010 at 4:32 AM, ceriox cer...@gmail.com wrote: thanks for the reply but i'm not a good web2py programmer ... i writing my first real app you can write the code for my request? (i can't understand the post of your link) -- You received this message because you are subscribed to the Google Groups web2py-users group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+un...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com . For more options, visit this group athttp:// groups.google.com/group/web2py?hl=en. -- --
Re: [web2py] Re: How do I import `gluon.dal` from Python shell?
On Tue, Jan 29, 2013 at 12:07 AM, Bruno Rocha rochacbr...@gmail.com wrote: Is there the option to put the gluon folder on your site-packages or dist-packages folder Or maybe, start web2py in shell mode? -- Perfect, thanks. Had forgotten about the shell option. --