[web2py] beginner question: select first

2015-02-06 Thread Alex Glaros
can someone please consolidate my knowledge or tell me where in documentation this is explained the first() in this line below: this_message = db(db.InternalMessage.id == request.get_vars.filter).select() *.first()* allows below to work in view: {{=this_message.created_by.last_name}} if the

[web2py] Re: Question about web2py roadmap.

2015-02-06 Thread JoeCodeswell
Dear Anthony, You said, And if you need a completely customized form, you can do so by writing a formstyle function, using form.custom, or with hand-coded HTML. With the latter two options, if you need to re-use the form code, you can put it in a template and include it where needed. Thanks,

[web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Anthony
Just use pure HTML as usual and (a) make sure the name attributes of form fields correspond to the names of your database table fields, and (b) at the end of the form, include the following: {{=form.custom.end}} in place of: /form form.custom.end includes the two hidden fields used by web2py

Re: [web2py] Re: beginner question: select first

2015-02-06 Thread Michele Comitini
when you want only one and the first better use .select(limitby=(0,1)) and proper orderby, else you can be disappointed by performance... 2015-02-06 20:52 GMT+01:00 Anthony abasta...@gmail.com: rows = db(query).select() In the above, rows is a Rows object, which acts like a list of Row

[web2py] adding signature to url after login

2015-02-06 Thread weheh
I have a URL that I want to direct to after login. Something like _next_url = URL(c, f, v, signature=True). The problem is this. The signature is computed before login. After login, the signature isn't valid. Is there a way to recompute the signature for a URL after the fact ... after the URL

[web2py] Re: Is there an issue with my web2py install? can't pickle function objects

2015-02-06 Thread Maggs
I have done some debugging on this by creating a brand new app and trying to use the same db.py file as my app that's not working. When doing so I removed some pieces of code I thought might be causing the problem and it looks like I've narrowed it down. In the app that I have running in the

[web2py] Re: Is there an issue with my web2py install? can't pickle function objects

2015-02-06 Thread Maggs
Hi Dave, The Web2py and python versions: web2py™ Version 2.9.11-stable+timestamp.2014.09.15.23.35.11 Python Python 2.7.6: /usr/bin/python2.7 (prefix: /usr) The OS is Ubuntu 14.04. Web2py is a fresh install. No upgrades. Source installation. Thanks, M On Thursday, February 5, 2015 at 8:33:27

[web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Anthony
You asked, Can you share examples...?. Here are links to a couple of app pages i remember finding difficult to achieve using *my *level of understanding of standard web2py techniques, for the version available at development time. To be sure web2py has improved since then. -

Re: [web2py] Re: beginner question: select first

2015-02-06 Thread Anthony
On Friday, February 6, 2015 at 4:20:02 PM UTC-5, Michele Comitini wrote: when you want only one and the first better use .select(limitby=(0,1)) and proper orderby, else you can be disappointed by performance... Yes, and even in that case, you can still use .first() to extract that single

[web2py] how to design email reply function with multiple select

2015-02-06 Thread Alex Glaros
am looking for a rough idea on how to approach email reply to multiple recipients There is a one-to-many two-table model: 1. parent Message table, and 2. child recipientsOfMessage. May be many records in recipientsOfMessage table to each 1 Message table record. Would I use

[web2py] Re: how to design email reply function with multiple select

2015-02-06 Thread Alex Glaros
okay, seems like selectable might be one way to go form = SQLFORM.smartgrid(db.InternalMessageRecipient, selectable=lambda ids: redirect(URL('sendGroupEmails', vars=dict(ids=ids))) it allows user to select a group of email recipients from grid. Was able to pass selected ids to another

[web2py] Defining own Auth Tables

2015-02-06 Thread Maggs
Hello all, I'm creating a new question from a brief conversation I had going on in this thread: https://groups.google.com/forum/#!topic/web2py/UYqS8nIkeQY. So basically I have an app that uses nothing but web2py (no wsgi or apache) and in this app I want to add 2 additional auth tables. One of

[web2py] Re: beginner question: select first

2015-02-06 Thread Anthony
rows = db(query).select() In the above, rows is a Rows object, which acts like a list of Row objects. To extract a single Row object, you would do: row = rows[index] Specifically, to get the first Row, you would do: first_row = rows[0] rows.first() is simply equivalent to rows[0], except

[web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Dan Feeney
Hi Joe, When I needed to create a custom form, I followed this: http://web2py.com/books/default/chapter/29/07/forms-and-validators#Custom-forms I still used the widgets serialized by the web2py model code and only modified the layout. However, it looks like they have some helpful goodies in

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Leonel Câmara
Do you want a list of all field types? This would do it: field_types = [] for table in db.tables: for field in db[table].fields: field_types.append(db[table][field].type) However you will have a lot of ids. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation)

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Richard Vézina
Yes!! That what I thought... I had already db.table.field.type in mind, but didn't know how to invoque adapter... Thanks Anthony. Richard On Fri, Feb 6, 2015 at 7:55 AM, Anthony abasta...@gmail.com wrote: And if you want the actual Postgres field type for a given field, you can do:

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Richard Vézina
I work around that by just print string of db.table.field.type and write my model in web2py then generate SQL with an SQL generator app... :) This will be all right, I am not writing SQL that much anymore, I let web2py generate it form me :) Richard On Fri, Feb 6, 2015 at 9:23 AM, Richard

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Richard Vézina
Hello Leonel, Actually my tables names are prefixed with old postgres schema name so, I can easily filter the one of interest... Also, the IDs fields don't matter, since the are prefixed with table name like so tablename_id... I also change some fields names that are common in many table like

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Richard Vézina
Hoho! As you mention Anthony, db._adapter.types[] doesn't provide the direct backend type... You get the type but not the extend of the domain of the field... Also, notice that in case of web2py decimal db.table.field.type will be 'decimal(4, 2)' and the key in _adapter.types is only 'decimal'

[web2py] Re: How to deploy Web2py on the NEW Openshift directory layout for Python web apps?

2015-02-06 Thread Ramkrishan Bhatt
HI Everyone, I used web2py admin for openshift application deployment. I got success but still in url openshift welcome page is redirecting. I have configure setup.py also. but i am getting problem to routs my apps in openshift. Why only applications folder is getting include in wsgi folder.

[web2py] Re: SQLFORM hanging on insert

2015-02-06 Thread Ian W. Scott
Thanks for your response Massimo. I'll try to put together a minimal version today and post it. Ian On Thursday, February 5, 2015 at 4:46:46 PM UTC-5, Massimo Di Pierro wrote: Does it hang if you use sqlite? Can you provide a minimalist app that we can try. There is nothing wrong with your

Re: [web2py] how may I get programmatically postgres field type from web2py model definition?

2015-02-06 Thread Anthony
And if you want the actual Postgres field type for a given field, you can do: db._adapter.types[db.tablename.fieldname.type] However, you will get back values that include Python string formatting syntax, such as: VARCHAR(%(length)s) Anthony On Friday, February 6, 2015 at 4:55:31 AM UTC-5,

[web2py] Re: Best practices for Lazy Tables

2015-02-06 Thread Anthony
On Friday, February 6, 2015 at 2:28:44 AM UTC-5, Niphlod wrote: response.toolbar() holds a pretty nice view of what's lazy and what's not, so what's the issue ? The deal is ideally going throughout the whole model and NEVER see ANY db.tablename, i.e. like the part in red

Re: [web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Carlos Cesar Caballero Díaz
I know that web2py is very flexible, that's why I'm here and i'm working with web2py since almost 4 years, but this is my point, with two examples: In the very first web2py code example in the manual, in the image blog example, we find this code in the controller: def index(): images =

[web2py] Calling some url 100 times async

2015-02-06 Thread António Ramos
hello, i have an app that need to call some url with a param. if i use a loop i will call it synchronously. This means that only when i get the response from the current get, the script will move the the next get request right ? This is not good for what i need because i want to call an online

Re: [web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Richard Vézina
As a single dev for a relative big app, I tend to put as much stuff as possible in controller because I read and code there all the time, so it is much easier to debug trouble shoot, etc. I often had to look very long cause a malfunction due to a refactoring because the offending code forgotten

[web2py] Re: Calling some url 100 times async

2015-02-06 Thread Anthony
Maybe something like this: https://github.com/ross/requests-futures On Friday, February 6, 2015 at 12:37:38 PM UTC-5, Ramos wrote: hello, i have an app that need to call some url with a param. if i use a loop i will call it synchronously. This means that only when i get the response from

Re: [web2py] Re: Question about web2py roadmap.

2015-02-06 Thread Anthony
In the very first web2py code example in the manual, in the image blog example, we find this code in the controller: def index(): images = db().select(db.image.ALL, orderby=db.image.title) return dict(images=images) Accessing from controller to the dal, in a simple query could

[web2py] Re: Question about web2py roadmap.

2015-02-06 Thread JoeCodeswell
Dear Anthony, Thanks for *ALL your service* to web2py and your replies to this discussion. First, let me state emphatically,* I am a grateful user supporter of web2py*. My questions and comments are my effort to improve it *for my Workflow, *which is, as i indicated before, *View* (as in