Re: [web2py] Do not show None

2016-07-08 Thread Manuele Pesenti
Il 08/07/16 08:54, Kenneth ha scritto: > 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. I woul

Re: [web2py] Re: Identifyng Relationship

2016-07-08 Thread Carlos Cesar Caballero Díaz
Thanks Anthony for your time and answers, I will use another tool for this project then, the DB already exist with the "Identifying Relationship" structure and I can't change it. Greetings. El 06/07/16 a las 12:21, Anthony escribió: On Wednesday, July 6, 2016 at 8:39:57 AM UTC-4, Carlos Cesar

[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
Just in case anyone is wondering why I would build such a strange little web app, it is for my personal use. I was dianosed with brain cancer 6 weeks ago and these are the items my doctors want me to track everyday. So I thought Web2py would be perfect. On Thursday, July 7, 2016 at 2:19:10 PM

[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Marlysson Silva
Are you trying to get the timezone just of the your location? Case yes, you set your timezone at code, and deploy in pythonanywhere with value personal of the timezone. But you want timezone by any place, then I go prepare a article showing what I made to solved this. Em sexta-feira, 8 de jul

[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Marlysson Silva
Are you trying to get the timezone just of the your location? Case yes, you set your timezone at code, and deploy in pythonanywhere with value personal of the timezone. But you want timezone by any place, then I go prepare a article showing what I made to solved this. Em sexta-feira, 8 de ju

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

2016-07-08 Thread Alfonso Serra
Just to post the right solution. filter_in didnt work out since im not saving the form when its posted, just using the form to generate a query. So the right solution would be something like: form = SQLFORM(db.myfilters).process(dbio=False, keepvalues=True, onvalidation=enable_bool_tri_state)

[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
I would like to know how a timezone by any place would be done, so I look forward to your article. For me I am just going to keep it set to US/Central. Also if anyone wants to use the code I have provided to build this sort of web app for the general public, please feel free to use what I hav

[web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Marlysson Silva
Great, I will preparing them. Put your code on github to follow the development, and to contribuit in something. Em sexta-feira, 8 de julho de 2016 10:52:26 UTC-3, Jeff Riley escreveu: > > I would like to know how a timezone by any place would be done, so I look > forward to your article. For m

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

2016-07-08 Thread Anthony
On Thursday, July 7, 2016 at 7:36:57 PM UTC-4, Alfonso Serra wrote: > > 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)

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

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 9:48:52 AM UTC-4, Alfonso Serra wrote: > > Just to post the right solution. > > filter_in didnt work out since im not saving the form when its posted, > just using the form to generate a query. > So the right solution would be something like: > > > form = SQLFORM(db.myfi

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

2016-07-08 Thread Alfonso Serra
You are right. The real scenario is: Im using a table to store filters that are used to retrieve data from another table. This other table are bookings, and i need a filter to retrieve either all of them, or with kids, or without them. The form of such filters has 3 kind of submits "Execute fi

Re: [web2py] Re: Identifyng Relationship

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 8:39:01 AM UTC-4, Carlos Cesar Caballero wrote: > > Thanks Anthony for your time and answers, I will use another tool for this > project then, the DB already exist with the "Identifying Relationship" > structure and I can't change it. > That's an important detail that

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

2016-07-08 Thread Richard Vézina
I would rather use a string field with a drop box as it may arrive that you add more filter creteria, your three state bool wouldn't be enough once there... It makes your system less custom and easier to extend... Richard On Fri, Jul 8, 2016 at 10:41 AM, Alfonso Serra wrote: > You are right. T

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

2016-07-08 Thread Anthony
> I think i have a few choices, either use the form's onvalidation callback > Actually, that won't work either, because the conversion of booleans happens after validation. However, instead, you can use the "onsuccess" callback (this is called after validation and database insert, but since y

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

2016-07-08 Thread Anthony
Also, note that you can test for field.type == 'boolean' rather than field.widget == bool_radio_widget. Anthony On Friday, July 8, 2016 at 9:48:52 AM UTC-4, Alfonso Serra wrote: > > Just to post the right solution. > > filter_in didnt work out since im not saving the form when its posted, > jus

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

2016-07-08 Thread Alfonso Serra
Absolutetly right, i just realised that. @Richard Rather than a string field, i tried your approach using an integer and IS_IN_SET() but the problem is that bool conversion happens after that is executed. Hmm, actually this might work since as integer the bool conversion wont take place, right?

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

2016-07-08 Thread Richard Vézina
Hello Alfonso, In my last email, I don't mean what I suggested before. But instead of using a boolean type field use just a string field (or a reference field better) so you can add new criteria if it ever happen in the future and you don't need to kind of customize the behavior of your boolean fi

RE: [web2py] Re: Pythonanywhere Timezone

2016-07-08 Thread Jeff Riley
https://github.com/Sailor972/medicaltracker.git Sent from Mail for Windows 10 From: Marlysson Silva -- 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

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

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 11:21:53 AM UTC-4, Alfonso Serra wrote: > > Ill read about custom fields, that may be interesting, but since the bool > conversion is done on form's process i dont think it will do the trick. But > a custom field might not do the conversion. > As long as the custom fie

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

2016-07-08 Thread Jim Spoerl
Well, in the interest of trying out the wiki again, I tried to reinstall web2py from the "source" site download. All went well. I made sure all was well with permissions (www-data on Debian Wheezy) and with the SSL stuff including the admin password file. Also the wsgi handler file was copie

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

2016-07-08 Thread Richard Vézina
gid stand for group id... I grep the web2py code base you can see where gid is referenced : tools.py 6451:gid = group.id 6454:auth.add_membership(gid) contrib/fpdf/ttfonts.py 918:def getHMetric(self, numberOfHMetrics, gid): 920:if (gid < numberOfHMetrics):

[web2py] orderby part of a string...

2016-07-08 Thread Richard
Can we do that : http://stackoverflow.com/questions/8989098/postgres-order-data-by-part-of-string ? Maybe like this ? orderby='substring(tablename.fieldname, ...)' ?? Thanks Richard -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py

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

2016-07-08 Thread Anthony
Please always show your code and the full traceback and describe the exact actions to reproduce the problem. Anthony -- 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

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

2016-07-08 Thread Jim Spoerl
Thanks, Richard. Nothing was left over from previous work since I reinstalled the root directory from scratch. the DB is sqlite so we were starting from an empty DB. So I think the problem must be in the downloaded source. Is this correct? Here is the ticket: 24.233.114.172.2016-07-08.12-2

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

2016-07-08 Thread Richard Vézina
Can you show you mods to the welcome please... You may try to remove the auth.wiki() at line 60 of controllers/default.py though we need to understand how to reproduce this error. There maybe a bug in auth.wiki(). Difficult to say without knowing what you did... Richard On Fri, Jul 8, 2016 at

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

2016-07-08 Thread Alfonso Serra
This should do it: Field("with_kids", "integer", length = 1, notnull = False, default=None, required = False, requires=IS_NULL_OR(IS_INT_IN_RANGE(0,2)) ) Ive tested it and it converts correctly, and accepts the tri state. Thanks again. -- Resources: - http://web2py.com - http://web2py.com/bo

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 11:12:53 AM UTC-7, Richard wrote: > > Can you show you mods to the welcome please... > > You may try to remove the auth.wiki() at line 60 of controllers/default.py > though we need to understand how to reproduce this error. There maybe a bug > in auth.wiki(). Difficul

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 11:38:36 AM UTC-7, Dave S wrote: > > > On Friday, July 8, 2016 at 11:12:53 AM UTC-7, Richard wrote: >> >> Can you show you mods to the welcome please... >> >> You may try to remove the auth.wiki() at line 60 of >> controllers/default.py though we need to understand how

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

2016-07-08 Thread Anthony
> > From the code snippet in the ticket, it looks like at line 6453, gid >> should be set with the result of the insert, but I haven't yet looked at >> the whole code. >> > > As a test/workaround, a fresh install and manually creating the > wiki_editor group (using the admin interface or the sq

Re: [web2py] orderby part of a string...

2016-07-08 Thread Richard Vézina
Answer is yes it work just fine... db(db.ref_colorimeter_color.filter_parameter.belongs(['delta_a', 'delta_a_b'])).select(db.ref_colorimeter_color.color, orderby="substring(color, '\(([^\)]+)\)')") But with this : db.ref_colorimeter_color.color.regexp('\(([^\)]+)\)') It doesn't seems to work as

[web2py] Re: Do not show None

2016-07-08 Thread Alfonso Serra
Declare your field as: Field("price", "double", represent = lambda f, r: r.price if r.price != None else " ") Here represent is a function that will format the field's value and takes the field itself and the row as arguments. To display the table. def index(): table = SQLTABLE(db(db.myt

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

2016-07-08 Thread Jim Spoerl
Creating the "wiki_editor" role manually is straightforward for you but since I am a beginner, I would appreciate it if you could show how this is done. Thanks very much! /Jim On Friday, July 8, 2016 at 2:55:19 PM UTC-4, Anthony wrote: > > From the code snippet in the ticket, it looks like at

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 12:55:09 PM UTC-7, Jim Spoerl wrote: > > Creating the "wiki_editor" role manually is straightforward for you but > since I am a beginner, I would appreciate it if you could show how this is > done. > Thanks very much! /Jim > > cd web2py/applications/myapp sqlite3 da

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

2016-07-08 Thread Anthony
You can use appadmin to make an insert in the db.auth_group table or follow the documentation (see auth.add_group): http://web2py.com/books/default/chapter/29/09/access-control#Authorization. Anthony On Friday, July 8, 2016 at 3:55:09 PM UTC-4, Jim Spoerl wrote: > > Creating the "wiki_editor" r

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

2016-07-08 Thread Jim Spoerl
OK. I will try that when I can find a few moments of "prime" time. By the way, it seems strange to me that no one else reported this in the two and a half months since the error was introduced. Is there really so little use of web2py these days. That would be so strange since it seems to me t

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 1:31:33 PM UTC-7, Anthony wrote: > > You can use appadmin to make an insert in the db.auth_group table or > follow the documentation (see auth.add_group): > http://web2py.com/books/default/chapter/29/09/access-control#Authorization > . > > Anthony > I was assuming ap

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 1:46:24 PM UTC-7, Jim Spoerl wrote: > > OK. I will try that when I can find a few moments of "prime" time. By the > way, it seems strange to me that no one else reported this in the two and a > half months since the error was introduced. Is there really so little us

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

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 4:39:58 PM UTC-4, Dave S wrote: > > > > On Friday, July 8, 2016 at 1:31:33 PM UTC-7, Anthony wrote: >> >> You can use appadmin to make an insert in the db.auth_group table or >> follow the documentation (see auth.add_group): >> http://web2py.com/books/default/chapter/29

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

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 4:46:24 PM UTC-4, Jim Spoerl wrote: > > OK. I will try that when I can find a few moments of "prime" time. By the > way, it seems strange to me that no one else reported this in the two and a > half months since the error was introduced. Is there really so little use

Re: [web2py] orderby part of a string...

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 12:13:41 PM UTC-7, Richard wrote: > > Answer is yes it work just fine... > > db(db.ref_colorimeter_color.filter_parameter.belongs(['delta_a', > 'delta_a_b'])).select(db.ref_colorimeter_color.color, > orderby="substring(color, '\(([^\)]+)\)')") > > But with this : > >

[web2py] Re: Uploading multiple images in web2py

2016-07-08 Thread Fabio Ceccarani
Thanks Ron. Thanks Massimo, I have 6 upload fields (img01, img02,...img06); there is way to use multiple upload with only one in a SQLFORM? Thanks Fabio Il giorno mercoledì 6 luglio 2016 09:45:53 UTC+2, Massimo Di Pierro ha scritto: > > Mind that with modern browsers (tested on chrome), drop

[web2py] web2py traceback is not clear to tell the error

2016-07-08 Thread 黄祥
let say i have a code: *models/db_wizard_1_bank.py* db.define_table('bank', Field('name'), Field('website'), format = '%(name)s') *controllers/install.py* def index(): if db(db.auth_permission).isempty() and db(db.auth_membership).isempty(): # create index : auth_user db.executesql('CREATE INDE

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

2016-07-08 Thread Alfonso Serra
Sorry, to finish up some considerations... Ive been investigating how web2py assigns default validators to field types. If im not wrong this is done by SQLFORM which imports a function from gluon.dal called _default_validators. In this function the relationship between web2py field types and

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 5:47:42 PM UTC-7, 黄祥 wrote: > > let say i have a code: > *models/db_wizard_1_bank.py* > db.define_table('bank', > Field('name'), > Field('website'), > format = '%(name)s') > > *controllers/install.py* > def index(): > if db(db.auth_permission).isempty() and db(db.aut

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread Marlysson Silva
The keys of dictionary of bulk_insert are fields of table that you want you insert. Try so: db.bank.bulk_insert([ {'name' : 'bank0', 'website' : 'http://www.bank0.com' }, {'name' : 'bank1', 'website' : 'http://www.bank1.com'}, ] ) Em sexta-feira, 8 de julho de 2016 21:47:42 UTC-3, 黄祥 escreveu:

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

2016-07-08 Thread Anthony
On Friday, July 8, 2016 at 8:51:21 PM UTC-4, Alfonso Serra wrote: > > Sorry, to finish up some considerations... > > Ive been investigating how web2py assigns default validators (or widgets) > to field types. > > If im not wrong this is done by SQLFORM which imports a function from > gluon.dal c

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

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 7:41:19 AM UTC-7, Alfonso Serra wrote: > > [...] > In any case the "with_kids" fields from the filter's table should be a > boolean tristate, that i should handle properly when the form is processed. > Not when the form its saved into the db, if its saved. > I'm inc

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 6:31:29 PM UTC-7, Marlysson Silva wrote: > > The keys of dictionary of bulk_insert are fields of table that you want > you insert. > Try so: > > db.bank.bulk_insert([ {'name' : 'bank0', 'website' : 'http://www.bank0.com > '}, {'name' : 'bank1', 'website' : 'http://www

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread 黄祥
the apps is build from scratch, no created index before either from apps and from database side. the only place i create index is in the controllers/install.py, and it's only execute one time only. my logic during first code install script is : execute create index first then execute insert tabl

[web2py] Re: web2py traceback is not clear to tell the error

2016-07-08 Thread Dave S
On Friday, July 8, 2016 at 8:12:39 PM UTC-7, 黄祥 wrote: > > the apps is build from scratch, no created index before either from apps > and from database side. the only place i create index is in the > controllers/install.py, and it's only execute one time only. > > my logic during first code ins

[web2py] running web2py module from terminal return AttributeError: 'thread._local' object has no attribute '

2016-07-08 Thread 黄祥
i have web2py modules that insert new data for new web2py app: *modules/test_install.py* #!/usr/bin/env python # coding: utf8 import sys; sys.path.append('site/web2py/') from gluon import current #from gluon import * from gluon.contrib.webclient import WebClient install = WebClient('http://127.