[web2py] Re: IS_IN_DB using a dal.Set

2011-04-21 Thread niknok
derby=gdb.municipality.name).as_list() mp_dd2=[(i['municipality']['psgc_m'],\ i['municipality']['name']+' ('+i['province']['name']+')')\ for i in mp_list if i] Field('mun

[web2py] IS_IN_DB using a dal.Set

2011-04-21 Thread niknok
I have a set mp_list=gdb(gdb.municipality.province==gdb.province.id) which I'm trying to use it in a select field but causes an error: Field('municipality',requires=IS_IN_DB(mp_list,'municipality.psgc_m', '%(municipality.name)s (%(province.name)s)')) I

[web2py] cascading select, automatic triggers

2011-04-20 Thread niknok
I have a form with three cascading selects. A change in the selection, causes it to change the contents of the other selects. They work just fine, but I have other optional fields in the form which I wish the user to check out or input something before doing a "real" user triggered form submit. W

[web2py] Re: plugin_wiki as help system

2011-04-20 Thread niknok
Great! Thanks Massimo. On Apr 20, 8:43 pm, Massimo Di Pierro wrote: > You can use comment for that purpose > > Field(,comment=A('help',_href='...')) > > or you can do > > Field('name',...) > > db.table.name.help =

[web2py] Re: "race" keyword?

2011-04-19 Thread niknok
ing the code. > > On Apr 19, 7:46 am, niknok wrote: > > > > > > > > > >From the ticket: > > > Traceback (most recent call last): > >   File "/home/nrg/Projects/web2py/gluon/restricted.py", line 188, in > > restricted > >     ex

[web2py] plugin_wiki as help system

2011-04-19 Thread niknok
I'm wondering if there's any way to implement a help system in the context of a field in conjunction with plugin_wiki. Conceptual use: Table('myTable', Field('myField', help='slug_to_help_page_sub-section') help='slug_to_help_page_section_index') In a form, the user will see a help icon

[web2py] "race" keyword?

2011-04-19 Thread niknok
>From the ticket: Traceback (most recent call last): File "/home/nrg/Projects/web2py/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/home/nrg/Projects/web2py/applications/bbc/models/db_donor.py", line 419, in initializer.fillup(db) File "applications

[web2py] "race" keyword?

2011-04-19 Thread niknok
>From the ticket: Traceback (most recent call last): File "/home/nrg/Projects/web2py/gluon/restricted.py", line 188, in restricted exec ccode in environment File "/home/nrg/Projects/web2py/applications/bbc/models/db_donor.py", line 419, in initializer.fillup(db) File "applications

[web2py] importing CSV / NameError: global name 'request' is not defined"

2011-04-19 Thread niknok
I am trying to call this module that contains a series of import_csv_file statement like so: from my model, db_history.py I call up a module to import a series of csv files: initialize=local_import('initialize') initialize.fillup(db) my modules/fillup.py looks like this: import os def fill

[web2py] using bpython

2011-04-19 Thread niknok
bpython as a shell is a bit unforgiving for newbies. Attempting to use non-existing methods (or use it wrongly) will cause it to fail, and then uncremoniously drop you back to ipython. For example, I typed: "db.field(" Despite this, I still find it quite useful, but wish that if it would handle t

[web2py] assigning default values using '='

2011-04-16 Thread niknok
The '=' notation is not a popular method but since it's supported and I personally like it, I simply wish to be consistent in my code. I expect to see replies to the effect of "stick with 'default='", and I probably would if this issue is not considered a bug ;P but in the meantime ... I was tryin

[web2py] Re: Use bpython with web2py

2011-04-14 Thread niknok
I'm running Ubuntu 10.04 and tried your code and it's working fine in my case. But, I do like to report that I occasionally see bpython crash and revert to ipython. In some cases, the code I was trying out were pure python code, not web2py code. On Apr 14, 11:14 am, Bruno Rocha wrote: > I found

[web2py] Re: custom widget doesn't validate correctly

2011-04-14 Thread niknok
s=IS_IN_DB(db, > db.gender, '%(description)s', > zero=None))),nb sp,nbsp) >         for key,name in field.requires.options()] >     return DIV(*items) > > define_table('t', > Field('gender', 'reference gender',comment='*',widget=radio_h)) >

[web2py] Re: extra text in forms

2011-04-13 Thread niknok
On Tuesday, April 12, 2011 1:34:01 AM UTC-4, niknok wrote: > > > This is how I use it right now.. Looking for a way to change > > 'instruction' field. > > > form=SQLFORM.factory( > >     Field('instruction','text', writable=False, default

[web2py] Re: extra text in forms

2011-04-11 Thread niknok
DenesL wrote: > Can you provide an example of what you want?. > > On Apr 11, 8:57 pm, niknok wrote: > > > > > Yes, I know it can be done in Views. What I was wondering about is how > > to do so from the controller. > > > On Apr 11, 10:07 pm, Johann Spies

[web2py] Re: registering visitors vs users - looking for suggestions

2011-04-11 Thread niknok
Here are some of the ideas I'm playing around with: Option 1: automagically create an email address I've been reading on Login Methods from the book. I wonder if there's an easy way to create a third-party email address (gmail for example) for those users who have none? If a user say they don't h

[web2py] Re: extra text in forms

2011-04-11 Thread niknok
Yes, I know it can be done in Views. What I was wondering about is how to do so from the controller. On Apr 11, 10:07 pm, Johann Spies wrote: > On 10 April 2011 23:42, niknok wrote: > > >  This might sound too basic, but I couldn't find out how to display extra > > text

[web2py] Re: Use bpython with web2py

2011-04-11 Thread niknok
Nice! Now, how do I apply the patch? On Apr 12, 4:14 am, "Arun K.Rajeevan" wrote: > Hi All, > > BPythonhttp://bpython-interpreter.org/, is a lightweight  python console > with auto completion etc., > It's a wrapper around standard python console. > for debian based systems do, > > $> sudo apt-get

[web2py] Re: registering visitors vs users - looking for suggestions

2011-04-11 Thread niknok
I'm sorry if I wasn't clear. My problem is that some of the public users may not have email addresses (That's a reality in many developing countries.) but I still need to try to minimize duplicate registration (i.e. same name, gender, dob, etc. cannot register again so i need to authenticate again

[web2py] Re: web-based shell - not working. no ouput displayed.

2011-04-11 Thread niknok
back in. I'm using Chromium, and Epiphany. None of those browsers got this particular application's web-based shell working. Again, the shell of the other apps are working alright. Just my particular app. :( On Apr 11, 8:04 am, Anthony wrote: > On Sunday, April 10, 2011 5:36:53 PM U

[web2py] registering visitors vs users - looking for suggestions

2011-04-11 Thread niknok
The application I'm trying to develop targets two kinds of users. The *real* user of the system uses the full core functions of the application, while another set of targeted users has limited access to certain functions of the system. Issues: the public user may, or may not have an email address.

[web2py] Re: import datetime vs from datetime import datetime

2011-04-10 Thread niknok
Thank you Anthony. That is very clear now. On Apr 10, 7:27 am, Anthony wrote: > On Saturday, April 9, 2011 6:37:15 PM UTC-4, niknok wrote: > > > Hello. > > > What is the difference between the statements: import datetime vs from > > datetime import datetim

[web2py] Re: custom widget doesn't validate correctly

2011-04-10 Thread niknok
Sorry for being a little thick but how do I do that? There's already a IS_IN_DB requires in the table definition. On Apr 11, 12:51 am, DenesL wrote: > You forgot to set the requires for t.gender > > On Apr 9, 6:35 pm, niknok wrote: > > > > > > > > &g

[web2py] extra text in forms

2011-04-10 Thread niknok
This might sound too basic, but I couldn't find out how to display extra text in across the width of the whole form table. Right now, I do it this way (which only displays in the input column) but I wonder what's the web2py way? form=SQLFORM.factory( Field('instruction','text', writable=Fals

[web2py] extra text in forms

2011-04-10 Thread niknok
This might sound too basic, but I couldn't find out how to display extra text in across the width of the whole form table. Right now, I do it this way (which only displays in the input column) but I wonder what's the web2py way? form=SQLFORM.factory( Field('instruction','text', writable=Fals

[web2py] web-based shell - not working. no ouput displayed.

2011-04-10 Thread niknok
I just noticed that my apps' web-based shell isn't working. I don't see any errors, there are simply no results of any commands I input in the lower screen. Not even a simple "print 'hello world'" works. So what else do I need to check? (P.S. The shell of other apps are working fine.) In addition

[web2py] Re: T usage

2011-04-09 Thread niknok
; > then > choices = dict([(x,T(x)) for x in options]) > > should work. Note: untested. > > On Apr 7, 3:29 am,niknok wrote: > > > > > > > > > Thanks DenesL. > > > What if the options are retrieved from a field of list:string type? > >

[web2py] import datetime vs from datetime import datetime

2011-04-09 Thread niknok
Hello. What is the difference between the statements: import datetime vs from datetime import datetime I got stuck with my IS_DATE_IN_RANGE error "(type object 'datetime.datetime' has no attribute 'timedelta')" until i added "import datetime" to the controller. All the while, I thought I already

[web2py] custom widget doesn't validate correctly

2011-04-09 Thread niknok
I got this custom widget from the list: def radio_h(field,value): nbsp = XML(' ') items=[TAG[''] (SPAN(name,INPUT(_type='radio',_value=key,_name=field.name,value=value)),nbsp,nbsp) for key,name in field.requires.options()] return DIV(*items) In my controller: define_table(

[web2py] Re: T usage

2011-04-07 Thread niknok
Thanks DenesL. What if the options are retrieved from a field of list:string type? On Apr 4, 10:39 pm, DenesL wrote: > Use > > choices = {'Gold':T('Gold'), 'Silver':T('Silver')} > > and update your language translations strings. > Not

[web2py] T usage

2011-04-04 Thread niknok
I tried: Field('color', 'list:string', default=answer, requires=IS_IN_SET(T(question['choices']), zero=None, multiple=True)) I would like to display the choices in the translated language but the selection will be stored in the database in the orginal language. For example: choices = ['Gold', 'Si

[web2py] online book, image display error

2011-03-31 Thread niknok
For some reason or another, I couldn't get to view these images. In chapter 3, these are: index1.png, about.png Also in chapter 7:custom_errors.png FYI.

[web2py] code not working as expected. what am I doing wrong?

2011-03-31 Thread niknok
Hello everyone. Is there anyone who could shed some light on this? 1. There are two versions of the code below which I thought are functionally the same, but the better looking code (version 1) doesn't work as expected while ugly version 2 kinda works, browsing thro

[web2py] "requires" outside field definition - unexpected behaviour

2011-03-30 Thread niknok
I have something like: form=SQLFORM.factory( Field('f1', requires=IS_IN_SET(choices)), Field('f2'), requires=IS_IN_SET(choices)) If the requires parameter is inadvertently placed outside a field definition it doesn't generate an error, and the form will "kinda" work - bu

[web2py] contrib.populate and uuid

2011-03-30 Thread niknok
On Web2Py v 1.94.5: db.define_table('person',Field('person_uuid', notnull=True, default=uuid.uuid4(), writable=False, unique=True)) from gluon.contrib.populate import populate populate(db.person, 50) Calling contrib.populate generates an error: "IntegrityError: column person_uuid is not uniq

[web2py] args(0) is always None??

2011-03-27 Thread niknok
I have this function that displays several fields from two databases. but I couldn't get it to do the following: 1) the "previous question" button actually causes an error. how come my session.item_id is always zero when I thought I was passing an incrementing value session.item_id+1 . 2) when i

[web2py] forms and lists

2011-03-26 Thread niknok
I'm trying to go through two lists using a form but I could make the form move "forward" and "backward" through the list. The tables are essentially the same except for the language used. Could someone give me a nudge to the right direction? :) Here's my code: db.define_table('questionnaire',

[web2py] Re: book "bugs"

2011-03-24 Thread niknok
t; type, which isn't listed at all? On Mar 18, 8:02 am, niknok wrote: > In Validator section of Chapter 7, the  example for IS_DATE_IN_RANGE > incorrectly uses IS_DATETIME where IS_DATE_IN_RANGE is expected: > > requires = IS_DATE(format=T('%Y-%m-%d'), >          

[web2py] Re: a few questions

2011-03-23 Thread niknok
Aha! I don't normally use 'zero=None'. Maybe I should. Thank you very much DenesL. On Mar 23, 6:23 pm, DenesL wrote: > On Mar 23, 3:35 am, niknok wrote: > > > Thanks for asking the right question. When I saw "define", I took a > > look into the code

[web2py] Re: IS_INT_IN_RANGE Behavior in Database Example

2011-03-23 Thread niknok
re validate_insert I think it's a custom function. Read back the post made by Massimo about a week ago ... On Mar 24, 5:45 am, Anthony wrote: > On Wednesday, March 23, 2011 5:33:45 PM UTC-4, Massimo Di Pierro wrote: > > > 2) if you want the check done in insert you can call > > db.table.validate

[web2py] Re: a few questions

2011-03-23 Thread niknok
did not occur again. Probably related to the test data I was making. After rebuilding the db, it didn't show itself again. [crossing my fingers..] On Mar 23, 10:28 am, DenesL wrote: > Hi, > > On Mar 22, 9:39 pm, niknok wrote: > > > Hi everyone. > > > a few questio

[web2py] a few questions

2011-03-22 Thread niknok
Hi everyone. a few question about forms: 1. why doesn't the datepicker appear when I use the sqlform.factory to generate input fields? 2. Other than customizing a view, is there a way to display radiobox options horizontally when using sqlform? I'm stuck with this "internal error": ValueError: in

[web2py] Re: book "bugs"

2011-03-22 Thread niknok
Thanks for the excellent work On Mar 18, 9:23 am, villas wrote: > Hi niknok > > I have recently been editing thebook(prompted by the suggestions of > Kevin Ivarsen).  You may find that these issues  have been resolved. > Please take a look (at the online version) and let

[web2py] Re: advanced form question

2011-03-17 Thread niknok
Yes. Try the IN_DB validators to tie them together. Search for "autopostback" by Bruno and go through its code. On Mar 14, 10:30 pm, Manuele Pesenti wrote: > Il 09/03/2011 04:44, DenesL ha scritto: > > > That is called cascaded fields. > > One example:http://groups.google.com/group/web2py/msg/b2

[web2py] book "bugs"

2011-03-17 Thread niknok
In Validator section of Chapter 7, the example for IS_DATE_IN_RANGE incorrectly uses IS_DATETIME where IS_DATE_IN_RANGE is expected: requires = IS_DATE(format=T('%Y-%m-%d'), minimum=datetime.date(2008,1,1), maximum=datetime.date(2009,12,31),

<    1   2