[web2py] Do not show None

2016-07-07 Thread Kenneth
Hello, I fetch a number on records from the database and show it on the screen. Is there a way to not print the text None for fields that are in the state None. I could use if field != None but I'd rather not use IF if there is an other way. Kenneth -- Resources: - http://web2py.com - http

[web2py] gluon.template import render

2016-07-07 Thread lucas
hello one and all, the render function under gluon.template is great and powerful. how can i pass two or three context rows to it, like? from gluon.render import render xyz=""" {{="%s, %s" % (sCustomer.last_name, sCustomer.first_name)}} {{="%i: %s - %s" % (sItem.number, sItem.name, sItem.descri

[web2py] Re: Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
Here is the code as promised for the db.py and default.py. On Thursday, July 7, 2016 at 2:19:10 PM UTC-5, Jeff Riley wrote: > > Hello all. Me again. I have run into an interesting issue. I have > installed and followed niphlod's w2p_timezone_plugin. In order to make it > work on my local PC

[web2py] Re: how to handle boolean's tri states?

2016-07-07 Thread Alfonso Serra
> > Thanks Richard, Anthony, very good answers. > The use case is simple: For example, query articles with a field of uncatalogued, you can either select catalogued, uncatalogued or all (doesnt matter if its uncatalogued). To store such filter i can make use of a boolean tri state, True, False

Re: [web2py] Re: Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
I have that in the default.py file. I will send the code when I get to my computer. Thank you, Jeff Riley > On Jul 7, 2016, at 5:10 PM, Marlysson Silva wrote: > > Where you are inicialize session.plugin_timezone_tx ? > > I too already had this issue, this happen because the script get timezon

[web2py] Re: how to handle boolean's tri states?

2016-07-07 Thread Anthony
If the form contains a checkbox and the user leaves it unchecked, I would say the correct value to store is False. Storing None would make sense if the boolean field were completely excluded from the form. If an empty checkbox should be recorded as None, then when would you ever record False --

[web2py] Support graph database pyDAL.

2016-07-07 Thread Marlysson Silva
Are you have some planning in port some graph database to operations in pyDAL? By example: Neo4j , OrientedDB... -- 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 Issu

[web2py] Re: Pythonanywhere Timezone

2016-07-07 Thread Marlysson Silva
Where you are inicialize session.plugin_timezone_tx ? I too already had this issue, this happen because the script get timezone based on the server localization. I solved this using other way, converting user timezone to UTC and at showing converted in user timezone. They are some steps to do

Re: [web2py] Re: how to handle boolean's tri states?

2016-07-07 Thread Richard Vézina
Alfonso, What you use case? As HTML radio box doesn't allow NULL and by default web2py set bool field type as check box by default, it doesn't implment the NULL state as it doesn't make much sens to do it as false or NULL result in the same HTML tag state. You would need to use other widget repr

[web2py] Re: how to handle boolean's tri states?

2016-07-07 Thread Alfonso Serra
MySQL with TINYINT as booleans: db = DAL("mysql://", pool_size = 10, check_reserved=None, migrate=True) db._adapter.types['boolean']='TINYINT(1)' db._adapter.TRUE = 1 db._adapter.FALSE = 0 -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py

[web2py] Re: how to handle boolean's tri states?

2016-07-07 Thread Dave S
On Thursday, July 7, 2016 at 12:32:08 PM UTC-7, Alfonso Serra wrote: > > If i define a boolean field as: > > Field("mybool", "boolean", required = False, notnull = False, default = > None) > > Its stored as False if its not present in request.post_vars. The proper > behaviour would be to store

[web2py] how to handle boolean's tri states?

2016-07-07 Thread Alfonso Serra
If i define a boolean field as: Field("mybool", "boolean", required = False, notnull = False, default = None ) Its stored as False if its not present in request.post_vars. The proper behaviour would be to store a null value in this case, which allows to handle boolean's tri-states. To achieve

[web2py] Pythonanywhere Timezone

2016-07-07 Thread Jeff Riley
Hello all. Me again. I have run into an interesting issue. I have installed and followed niphlod's w2p_timezone_plugin. In order to make it work on my local PC I need to setup my db.py as follows. import pytz user_timezone = session.plugin_timezone_tx or 'UTC' db.define_table('events',

Re: [web2py] Querying auth_user by group

2016-07-07 Thread Richard Vézina
Notice : db().select(...) empty set will be abandonned (deprecated) probably... So better to specify table you are querying as you are writting new code... Ref.: https://github.com/web2py/pydal/issues/388 Richard On Thu, Jul 7, 2016 at 3:03 PM, Richard Vézina wrote: > Add a where clause to re

Re: [web2py] Querying auth_user by group

2016-07-07 Thread Richard Vézina
Add a where clause to remove them something like this : ~db.auth_group.startswith('user_') On Thu, Jul 7, 2016 at 2:57 PM, wrote: > Richard, > > Thank you for your reply. > > Using the code you suggested, implemented as this: > > users=db().select( > db.auth_user.id, db.auth_user.first_name

Re: [web2py] Querying auth_user by group

2016-07-07 Thread ahz001
Richard, Thank you for your reply. Using the code you suggested, implemented as this: users=db().select( db.auth_user.id, db.auth_user.first_name, db.auth_user.last_name, db. auth_group.role, left=[db.auth_membership.on(db.auth_user.id == db.auth_membership. user_id), db.auth_grou

Re: [web2py] Querying auth_user by group

2016-07-07 Thread Richard Vézina
Why not do that instead of you first example : db(db.auth_user.id > 0).select(..., left=[db.auth_membership.on( db.auth_user.id == db.auth_membership.user_id), db.auth_group.on(db.auth_membership.group_id==db.auth_group.id)]) Richard On Thu, Jul 7, 2016 at 1:30 PM, wrote: > I assign each user

[web2py] Querying auth_user by group

2016-07-07 Thread ahz001
I assign each user either group A or B, and by default web2py assign users to the user_%d groups. I would like to query which users are in groups A, B, and NULL so that (1) I can verify each user is in the right group and (2) no users are in zero groups. I have this controller users = db(~db.a

[web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Anthony
For incoming URLs, you could map the language to a URL arg or query string variable. For outgoing URLs, you could either set that same URL arg or var and rely on a routes_out rewrite rule, or you could simply prepend URLs generated via the URL() function with the language. In either case, you c

Re: [web2py] Restricting Access by IP

2016-07-07 Thread Marc Smith
hafte: I think you posted to the wrong thread... A friendly bump to the others: Is there a way to restrict access by IP address in web2py's main/core routes.py? Right now I'm doing it in appname/controllers/appadmin.py with this: --snip-- if request.client not in ['x.x.x.x']: raise HTTP(404)

Re: [web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Carlos Cesar Caballero Díaz
Hi, thanks for answer my question, but this is the parameter-based router, I need to use the pattern-based one. (http://web2py.com/books/default/chapter/29/04/the-core?search=routes#Pattern-based-system) Greetings. El 07/07/16 a las 09:28, Marlysson Silva escribió: This not work? http://web2p

[web2py] Re: choosing radio and submit inputs in view

2016-07-07 Thread lucas
perfect and excellent, it works famously. lucas -- 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 t

[web2py] Re: URL based internationalization and pattern router

2016-07-07 Thread Marlysson Silva
This not work? http://web2py.com/books/default/chapter/29/04/the-core?search=routes#URL-rewrite Using a languages dictionary , or setting a default language routers = dict( BASE = dict(default_application='myapp'), myapp = dict(languages=['en', 'it', 'jp'], default_language='en'),) Em qui

[web2py] URL based internationalization and pattern router

2016-07-07 Thread Carlos Cesar Caballero
Hi, I need some starting point to implement the URL based internationalization using the pattern based router, I really need to use the router, but there is so little documentation... I am clonning our yii2 cms base application (supporting right now sites like http://santiagohermes.com http://a

[web2py] Re: Can't get a working web2py that will support many of the example apps. Most seem to be broken!

2016-07-07 Thread Anthony
> > But as a shortcut (I am pretty new with python, admittedly), I have tried > some of the referenced appliances in the repo including, finally, outside > the repo, Instant Press. It was promising but it simply throws a lot of > exceptions as you start to use it. It also has not been mainta

[web2py] Re: choosing radio and submit inputs in view

2016-07-07 Thread Anthony
{{=form.custom.submit.element(_value='Submit')}} or: {{=form.element(_type='submit', _value='Submit')}} In the second example, you can leave out _type if _value uniquely identifies the button among all elements in the form. Anthony On Thursday, July 7, 2016 at 2:52:51 AM UTC-4, lucas wrote: >

[web2py] Re: show_if multiple selections

2016-07-07 Thread Anthony
Also, keep in mind that the DAL's logical operators are "&" and "|", not "and" and "or". In any case, show_if does not support multiple conditions, so .belongs is the way to go here. Anthony On Thursday, July 7, 2016 at 7:19:45 AM UTC-4, Jeff Riley wrote: > > Worked perfectly. Thank you Marlys

[web2py] Can't get a working web2py that will support many of the example apps. Most seem to be broken!

2016-07-07 Thread Jim Spoerl
Hi all. I am very frustrated, I must say. After several weeks of work (and reading and re-reading all that I have found online), I simply cannot get installed a working environment. I do now have the latest stable release of web2py installed along with nginx and uwsgi. That works as a framew

[web2py] Re: show_if multiple selections

2016-07-07 Thread Marlysson Silva
You'we welcome :D , mark the answer as completed. Em quinta-feira, 7 de julho de 2016 08:19:45 UTC-3, Jeff Riley escreveu: > > Worked perfectly. Thank you Marlysson. > > db.events.event_level.show_if = (db.events.event_type.belongs("Mood", > "Headache", "Nausea", "Pain")) > > > On Thursday, Ju

[web2py] Re: show_if multiple selections

2016-07-07 Thread Jeff Riley
Worked perfectly. Thank you Marlysson. db.events.event_level.show_if = (db.events.event_type.belongs("Mood", "Headache", "Nausea", "Pain")) On Thursday, July 7, 2016 at 5:54:31 AM UTC-5, Marlysson Silva wrote: > > Try use belongs, of DAL. > > > http://web2py.com/books/default/chapter/29/06/t

[web2py] Re: show_if multiple selections

2016-07-07 Thread Marlysson Silva
Try use belongs, of DAL. http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#belongs Em quinta-feira, 7 de julho de 2016 06:24:08 UTC-3, Jeff Riley escreveu: > > Hello all. I am trying to get the line below from my db.py file to work. > Currently it is only working for

[web2py] Re: new experimental feature in trunk - rows.join(...)

2016-07-07 Thread Mirek Zvolský
Massimo, this is great ! >From your second example I think, it could work for serial m:1 joins too. Example: invoice_item >- product >- product_group If I want list invoice_items with product.name + with product_group.name Realy is this now possible? Dne úterý 5. července 2016 20:20:06 UTC+2

[web2py] show_if multiple selections

2016-07-07 Thread Jeff Riley
Hello all. I am trying to get the line below from my db.py file to work. Currently it is only working for the first entry "Mood". Any ideas? db.events.event_level.show_if = ((db.events.event_type == "Mood") or (db.events.event_type == "Headache") or (db.events