[web2py] Re: web2py scheduler period and repeats result not expected

2014-06-25 Thread Niphlod
@guys..if you queue a task inside models, you're queuing a new task at every request ! ;-D On Thursday, June 26, 2014 6:17:54 AM UTC+2, 黄祥 wrote: > > i've already tried, but got the same result + another strange output > during start web2py. here is the detail step i took. > 1. create new

[web2py] Re: cannot access web2py.com today

2014-06-25 Thread Niphlod
no, it's up. check the link. On Thursday, June 26, 2014 8:06:23 AM UTC+2, Oli wrote: > > is web2py.com down today? > > Am Freitag, 20. Juni 2014 10:17:22 UTC+2 schrieb Niphlod: >> >> nope, it's up >> >> http://www.downforeveryoneorjustme.com/web2py.com >> >> On Friday, June 20, 2014 9:12:50 AM UTC

[web2py] Re: cannot access web2py.com today

2014-06-25 Thread Oli
is web2py.com down today? Am Freitag, 20. Juni 2014 10:17:22 UTC+2 schrieb Niphlod: > > nope, it's up > > http://www.downforeveryoneorjustme.com/web2py.com > > On Friday, June 20, 2014 9:12:50 AM UTC+2, Oli wrote: >> >> is web2py.con down today? >> > -- Resources: - http://web2py.com - http://we

[web2py] how to turn off the record counter on Sqlform.grid

2014-06-25 Thread JorgeH
hello Is it possible to turn off the record counter , on the top right of the table generated by sqlform.frid ?? -- 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 Issue

[web2py] Re: web2py scheduler period and repeats result not expected

2014-06-25 Thread 黄祥
i've already tried, but got the same result + another strange output during start web2py. here is the detail step i took. 1. create new web2py app (copas the welcome folder and rename it into test) 2. copas the scheduler.py into models (test\models\scheduler.py) *test\models\scheduler.py* db.defi

[web2py] Re: web2py scheduler period and repeats result not expected

2014-06-25 Thread Tim Richardson
Except that I pass the function, rather than a string, my usage is the similiar to yours: scheduler.queue_task(demo1, repeats = 0, period = 180,prevent_drift=True) On Thursday, June 26, 2014 11:38:13 AM UTC+10, 黄祥 wrote: > > hi, > > i tested and learned from web2py doc

[web2py] Re: Book erratum

2014-06-25 Thread Tim Richardson
PR submitted. On Sunday, June 22, 2014 3:05:05 AM UTC+10, villas wrote: > > Chapter 3 - wiki signature > > This: > def wiki(... menugroups=None) > > Should be: > def wiki(... menu_groups=None) > > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.

[web2py] web2py scheduler period and repeats result not expected

2014-06-25 Thread 黄祥
hi, i tested and learned from web2py documentation about web2py scheduler but ended with result not expected for period and repeats. e.g. *models/scheduler.py* db.define_table('asdf', Field('asdf'), auth.signature) from gluon.scheduler import Scheduler def demo1(): db.asdf.inser

[web2py] Re: Uniqueness in Multi-tenants

2014-06-25 Thread Carlos Zenteno
@cliff Good idea, let me study it and see if I can make it work... thanks On Wednesday, June 25, 2014 4:33:17 PM UTC-5, Cliff Kachinske wrote: > > You could build a custom validator around something like this: > > new_value.strip() # Leading/trailing white space can fool humans > if not db( >

[web2py] Re: Uniqueness in Multi-tenants

2014-06-25 Thread Carlos Zenteno
@stifan Thanks for the response. You are right on the request_tenant field, and I should had explained it better. When you use tenants, you kind of partition the database so only the users of that tenant can see the info/data of that tenant, but all the information of all the tenants are in t

[web2py] combining two queries on different table (one reference the other) - newbie db

2014-06-25 Thread Riccardo C
Dear all, I am trying to formulate a query to get ALL the people that know a language AND leave in a specific city. As I am not an expert I thought that was a good idea to have two tables as following: auth.settings.extra_fields['auth_user']= [ Field('city',requires=IS_IN_SET(('UK - London','IT

[web2py] Re: Need to have "def 4()" and "def dir()" to 301 redirect. Is it possible?

2014-06-25 Thread Cliff Kachinske
You probably need to use the URL rewrite facility. Read here for information about it: http://web2py.com/books/default/chapter/29/04/the-core#URL-rewrite Once your request gets to the web2py router, it will be parsed as follows: www.mydomain.comargs(0)/..args(n)?vars So in the case of www.

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Cliff Kachinske
Graham, I have done form submission both ways. I much prefer self-submission. Much less code to write, so fewer opportunities for error. On Thursday, June 19, 2014 9:30:15 AM UTC-4, Graham Ranson wrote: > > I'm new to python and web2py...I have a small, but non-trivial, web > application and wa

[web2py] Re: Uniqueness in Multi-tenants

2014-06-25 Thread Cliff Kachinske
You could build a custom validator around something like this: new_value.strip() # Leading/trailing white space can fool humans if not db( (db[target_table][target_field==new_value) & (db[target_table].tenant_id==tenant_id) ).isempty(): return new_value, error_message return new_value,

[web2py] Re: A way to trigger method on update?

2014-06-25 Thread 黄祥
afaik, compute didn't work on update. for onupdate, is execute on form level not on dal, please take a look at book chapter about that. ref: http://web2py.com/books/default/chapter/29/07/forms-and-validators best regards, stifan -- Resources: - http://web2py.com - http://web2py.com/book (Docum

[web2py] Re: Uniqueness in Multi-tenants

2014-06-25 Thread 黄祥
please try (not tested) db._common_fields.append(Field('request_tenant', default = request.env.http_host, writable = False, unique = True) ) ref: http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer best regards, stifan -- Resources: - http://web2py.com - http://web2

Re: [web2py] Re: IS_IN_SET options list separator

2014-06-25 Thread Carlos Correia
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Em 24-06-2014 18:48, Massimo Di Pierro escreveu: > There is no syntax to do this. > Thanks for the answer. I'll try to fix it through javascript, ten. > On Monday, 23 June 2014 12:49:21 UTC-5, Carlos Correia wrote: > > Hi, > > Is there a way to in

[web2py] Re: Group or/and Field

2014-06-25 Thread Niphlod
although stored into the database, the membership information is carried along within the session. I don't see a reason to bring around the same data twice... if the reason behind is just "logic", then it doesn't make sense to duplicate the data. If the reason is serious reporting/datamining/com

[web2py] Uniqueness in Multi-tenants

2014-06-25 Thread Carlos Zenteno
We cannot enforce uniqueness (unique=true) within a tenant in multi-tenancy because the database does not know about tenants. Has anybody found a way to enforce/design uniqueness using multi-tenancy? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/

[web2py] Group or/and Field

2014-06-25 Thread Carlos Zenteno
I am classifying my users within groups (ie, carpenters group) but I am wondering if it would be useful or more efficient to also add a field in auth_user (ie, is_carpenter). Would it be faster to check the is_carpenter flag in the db or to do it from the auth system checking the membership of

[web2py] Re: Hypermedia API and Collection+JSON in web2py

2014-06-25 Thread Cliff Kachinske
Massimo, I like the way your thoughts are headed. doesn't the many2many issue goes away if one uses, for example, MongoDB? On Sunday, June 22, 2014 4:45:06 PM UTC-4, Massimo Di Pierro wrote: > > I added Hypermedia API support to web2py using Collection+JSON. > Experimental. > Collection+JSON is

[web2py] Re: how to making a field unique based on another field's value

2014-06-25 Thread Massimo Di Pierro
It is not too simple. Given: db.define_table('table1', Field('name')) db.define_table('table2',Field('name'),Field(table1','reference table1')) define: def require_unique(form): if db.table2(name=form.vars.name,table1=form.vars.table1): form.errors.name="Must be unique!" then when proces

Re: [web2py] accessing tables using web2py scheduler

2014-06-25 Thread cory bekker
ah yes, you got me to think differently about the problem. Thanks Nophlod, I will try a different approach. On Jun 25, 2014, at 8:57 AM, Niphlod wrote: > ok, the question at this point is really, what you'd expect "auth.user_id" to > be assumed as a value when you run inside a queued task on

[web2py] Re: how to making a field unique based on another field's value

2014-06-25 Thread Ian W. Scott
I believe you just set this through the "requires" property of the field: db.table2.table1_name.requires(IS_IN_DB(db, 'table1.name', db.table1._format)) That prevents entering any values in table1_name that aren't in table1.name. I believe you can also set

[web2py] Re: web2py compilation order

2014-06-25 Thread Niphlod
the same exact thing happens also without "compilation". all models are exeecuted alphabetically (that's why usually database definitions are in 0_db.py ;-) ) On Wednesday, June 25, 2014 10:51:17 AM UTC+2, aman...@gmail.com wrote: > > > web2py users, > > I've recently started using web2py for so

Re: [web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread Niphlod
ok, the question at this point is really, what you'd expect "auth.user_id" to be assumed as a value when you run inside a queued task on the scheduler On Wednesday, June 25, 2014 5:55:48 PM UTC+2, Cory wrote: > > Here is a better example of what I mean. > > *in controller:* > > @auth.requi

Re: [web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread cory bekker
Here is a better example of what I mean. in controller: @auth.requires_login() def foo(): row = db(db.mytable.id == auth.user_id).select().first() return dict() in scheduler.py def sched_function(): row = db(db.mytable.id == auth.user_id).select().first() ret

Re: [web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread Massimo Di Pierro
You can do: if auth.user and "some other condition": db.define_table('thing',Field('name')) so the table is always in the DB but web2py only sees it conditionally. Sometimes I do that for speed reasons. On Wednesday, 25 June 2014 09:52:09 UTC-5, Niphlod wrote: > > there's no such thing (con

[web2py] Re: Sending the ID of the newly registered user in email message (auth.messages.verify_email)

2014-06-25 Thread Massimo Di Pierro
wrong cut and paste. From the code d = dict(request.vars) d.update(dict(key=key, link=link,username=form.vars[username])) I just changed d = dict(from.vars) d.update(dict(key=key, link=link,username=form.vars[username])) because you are right. %(id)s should be allowed. On Wednesday, 25 June 20

[web2py] Re: Sending the ID of the newly registered user in email message (auth.messages.verify_email)

2014-06-25 Thread Massimo Di Pierro
from the code gluon/tools.py d.update(dict(key=key, link=link,username=form.vars[username])) On Tuesday, 24 June 2014 18:08:48 UTC-5, Kenwyn Pilgrim wrote: > > Hi > I'm trying to send the *id* of the newly registered user in the string > *auth.messages.verify_email*. I've tried *%(id)s* but imm

[web2py] how to making a field unique based on another field's value

2014-06-25 Thread KRG KCIHTRAK
I have two tables like below. Table1 (Field(name), unique = True) Table2 (Field(table1_name, 'reference Table1', Field(name)) I want to make the Table2's name field as unique based on the value in table1_name. how can I do it with web2py? -- Resources: - http://web2py.com - http://w

[web2py] web2py compilation order

2014-06-25 Thread amancode
web2py users, I've recently started using web2py for some web apps and am convinced its an awesome tool - i wanted to check if any of you came across an interesting behavior i noticed. When i create three model files as "db.py" (defines variable 'db'), "menu.py" and "scheduler.py" (access v

[web2py] Re: how to use require js with web2py?

2014-06-25 Thread chuan137
OK, I worked out myself, simply load web2py.js before require.js, besides, configure the baseUrl properly according to the system. here is my code {{ > response.files.insert(0,URL('static','js/libs/jquery.js')) > #response.files.insert(1,URL('static','css/calendar.css')) > #response.files.insert

[web2py] Re: A way to trigger method on update?

2014-06-25 Thread Omri Levy
Yes. I have read ALL the DAL section from the manual and I think you are right. I just wonder if I could use the 'compute' or 'filter in' function as well. I never heard of form 'on update'. Is it web2py feature? Thanks! :) On Wednesday, June 25, 2014 9:58:41 AM UTC+3, 黄祥 wrote: > > i think you

[web2py] Keep values with a list:string field?

2014-06-25 Thread Ian W. Scott
I've got a SQLFORM.factory form set to keep values after processing with process(keepvalues=True). But it doesn't work on a list:string field. The (otherwise very nice) widget loses all but the first value when the form is submitted (i.e., all but the first text inputs for the field disappear).

Re: [web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread Niphlod
there's no such thing (conceptually) as "tables that exists only if the user is logged in". the concept is "a user logged in can read/update/delete/etc some tables". That's what you do in "controllers". tables are "defined" (not accessed) instead in "models", so are available to everybody, sche

[web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread Cory Bekker
I am trying to access tables that require the user to be logged in.  Am I able to access these tables within my scheduler functions? On Wed, Jun 25, 2014 at 2:55 AM, Niphlod wrote:why on hearth should you define tables based on the fact that a user is logged-in or not ?Schedule

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Anthony
> But there is one thing I did want to mention re. http://web2py.com/books/ > > default/chapter/29/07/forms-and-validators#Sharing-forms > . > > Indeed I did read > that section but it was the comment: > "Wha

[web2py] Re: web2py and self-submission/postbacks - a newcomer asks

2014-06-25 Thread Graham Ranson
Thanks for all the replies - I'll close this particular discussion now and get on with writing some exploratory code, unfortunately, as always seems the case, the past week or so has had rather too many, apparently urgent, distractions... But there is one thing I did want to mention re. http:/

[web2py] Re: accessing tables using web2py scheduler

2014-06-25 Thread Niphlod
why on hearth should you define tables based on the fact that a user is logged-in or not ? Scheduler functions are executed in a world that does not care for the usual request/response/session environment, and surely they do no count to be "logged in"... On Wednesday, June 25, 2014 12:53:57 A