[web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread Andy W
Hi Annet

I appreciate the quick response.
I changed the table definition to include:

 Field('payment_amount', type='decimal(10,2)',
  label=T('Payment Amount'),
  requires=IS_DECIMAL_IN_RANGE(-1e100, 1e100, dot=".")),



Entering an amount of say '1,000' now traps the error at the form
validation stage, which is much better. However, it would be better still
if the '1,000' could be changed to '1000' in the background - any ideas?

Thanks for the help,

Andy

On Wednesday, April 22, 2015 at 10:18:18 AM UTC+4, Annet wrote:
>
> Hi Andy,
>
> Use the IS_DECIMAL_IN_RANGE() validator
>
> db.receipt.payment_amount.requires=IS_DECIMAL_IN_RANGE(-1e100, 1e100, 
> dot=".")
>
>
> From the web2py book:
>
> The minimum and maximum limits can be None, meaning no lower or upper 
> limit, respectively.
>
> The dot argument is optional and allows you to internationalize the 
> symbol used to separate the decimals.
>
> Kind regards,
>
> Annet
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread Kiran Subbaraman
I'll use something like numeraljs (http://numeraljs.com/) to deal with 
this on the browser-client, so that the server side data is just numbers 
with no formatting.



Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Wed, 22-04-2015 12:49 PM, Andy W wrote:

Hi Annet

I appreciate the quick response.
I changed the table definition to include:

|
Field('payment_amount',type='decimal(10,2)',
  label=T('Payment Amount'),
  requires=IS_DECIMAL_IN_RANGE(-1e100,1e100,dot=".")),

|


Entering an amount of say '1,000' now traps the error at the form
validation stage, which is much better. However, it would be better still
if the '1,000' could be changed to '1000' in the background - any ideas?

Thanks for the help,

Andy

On Wednesday, April 22, 2015 at 10:18:18 AM UTC+4, Annet wrote:

Hi Andy,

Use the IS_DECIMAL_IN_RANGE() validator

db.receipt.payment_amount.requires=IS_DECIMAL_IN_RANGE(-1e100,
1e100, dot=".")


From the web2py book:

The minimum and maximum limits can be None, meaning no lower or
upper limit, respectively.

The |dot| argument is optional and allows you to internationalize
the symbol used to separate the decimals.


Kind regards,

Annet

--
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 the Google 
Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to web2py+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
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 the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: A bug in _after_insert callback's document (book)? And more.

2015-04-22 Thread Ray Luo
On Apr 17, 2015 12:44 PM, "Anthony"  wrote:
>
>
 Well, in my case, the delay was caused by sending email, so it is
definitely not "milliseconds of each other". It takes some 2 or 3 seconds,
maybe even longer. And during this period, it is not that another user
would try to register with same username/email, it is somehow the same user
request would (seemingly?) be resent (by the user's app or by my reverse
proxy apache or by a wsgi middleware or whatever, which I don't know yet).
>>>
>>>
>>> Got it, but that sounds like a bug to be fixed. It shouldn't be
possible to re-submit the standard registration form twice because the
_formkey token prevents duplicate submissions. Are you using a different
method for submitting registration data?
>>
>>
>> It is because I am providing a RESTFUL api for the app to call. That is
why I (have to?) bypass all the good things in the default form-based
infrastructure such as double submit prevention. Sad but true.
>
>
> You could still implement your own functionality to prevent double
submission, such as issuing a one-time use token that gets submitted with
the registration.
>

Thanks Anthony for the very cool idea of trying to implement a (generic?)
functionality to prevent double submission. I don't exactly know how to do
that yet.

AFAIK, the web2py builtin double submission prevention is implemented in
the Form() object. It generates a one-time token and store it into cookie
session (which does not rely on DB) during form rendering, and then compare
it against cookie session during the form's self submission. A generic
implementation works for every form. Neat.

It is a different story when building a RESTful API. There would be no
rendering behavior before form submission, and normally I use state-less
HTTP basic auth and then purposely turn off session feature. Unless I force
my api callers to do HTTP POST first, to yet another dedicated "token" api,
which will issue the token and also store it into some backend storage
(such as a DB or central key-value service), blah blah. But this sounds not
"lightweight" at all.

At least in my current specific case, a unique index in DB is good enough
and to the point. Although this solution is not generic.

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread 黄祥
please try :
represent = lambda payment_amount, field: format(payment_amount, ",.2f")

best regards,
stifan

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] New error in trunk' s sqlhtml.py: AttributeError: 'SQLCustomType' object has no attribute 'represent'

2015-04-22 Thread Johann Spies
This code work without a problem in
 Version 2.9.12-stable+timestamp.2015.01.17.06.11.03

but not with the code from the trunk:

def za_arts_by_journal_by_year():

db.define_table('za_wos_papers_by_journal_by_year',
Field('journal', type=citext),
Field('pubyear', 'integer'),
Field('articles', 'integer'),
migrate = False,
rname = 'isi.za_wos_papers_by_journal_by_year')
grid = SQLFORM.grid(db.za_wos_papers_by_journal_by_year,
fields=[db.za_wos_papers_by_journal_by_year.journal,
db.za_wos_papers_by_journal_by_year.pubyear,

db.za_wos_papers_by_journal_by_year.articles],
create = False,
editable = False,
details = False,
deletable = False,
searchable = False,
maxtextlength= 200,
paginate=120,

orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
grid.element('.web2py_counter',replace=None)

where "orderby" is on line 391.

The error:

Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py"
,
line 818, in 
  File "/home/js/web2py/gluon/globals.py", line 393, in 
self._caller = lambda f: f()
  File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py"
,
line 391, in za_arts_by_journal_by_year

orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
  File "/home/js/web2py/gluon/sqlhtml.py", line 2720, in grid
elif isinstance(field.type, SQLCustomType) and
callable(field.type.represent):
AttributeError: 'SQLCustomType' object has no attribute 'represent'


I did know how to create an issue on the mercurial trunk but I am not sure
about the git repository.  What is the url again?

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread 黄祥
i'm tried to do the same thing, but with no luck
e.g.
def login_attempts():
a = request.vars.username
b = db((db.auth_user.username == str(a))).select().first()
#login_attempts = 0
if b is not None:
#login_attempts += 1
session.login_attempts = (session.login_attempts or 0) + 1
#if login_attempts >= 3 :
#cache.ram('message', lambda: login_attempts, time_expire = 5)
#response.flash = login_attempts
#session.flash = login_attempts
#redirect(URL('default','test'))
if session.login_attempts >= 3 :
login_attempts = cache.ram('login_attempts', lambda: login_attempts, 
time_expire = 5)
if not login_attempts:
session.forget(response)
#response.flash = session.login_attempts
#session.flash = session.login_attempts
#redirect(URL('default','test'))

auth.settings.login_onfail = login_attempts()

Error snapshot [image: help] 


(free variable 'login_attempts' referenced 
before assignment in enclosing scope)

is there a way to have login attempt lockout, that save in cache?

thanks and best regards,
stifan

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Visiting One SQLFORM.grid triggers another SQLFORM.grid -- bug?

2015-04-22 Thread LoveWeb2py
Hello,

I have somewhat of a weird error and I'm not sure how to fix it.

Let's say I have two controllers:

def controller1():
 grid1 = SQLFORM.grid(db.table1)
 return locals()

def controller2():
 grid2 = SQLFORM.grid(db.table2)
 return locals()

The user visits controller1 and click edit on the SQLFORM.grid, leaves the 
window idle

Next the user visits controller2 to get information to populate into 
controller1 by viewing an individual record in controller 2 from a 
different table in a separate browser

Finally the user goes back to controller1 and makes his updates. When he 
clicks submit he gets redirected to controller2 and none of his updates in 
controller1 happen.

Is this anything that can be fixed or is this normal behavior? I'm guessing 
it has something to do with the CSRF protection?


-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread 黄祥
it seems that the refresh login page, is count as login_onfail and 
login_onvalidation in web2py default user login form.
e.g.
*models/db.py*
def login_attempts():
session.login_attempts = (session.login_attempts or 0) + 1
if session.login_attempts >= 3 :
#cache.ram('login_attempts', lambda: session.login_attempts, time_expire = 
5)
response.flash = session.login_attempts

#auth.settings.login_onfail = login_attempts()
auth.settings.login_onvalidation = [login_attempts()]

*views/default/user.html add response toolbar*
{{=response.toolbar()}}

1. when i hit refresh https://127.0.0.1/test/default/user/login, the 
session is added by 1
2. when i try to input the wrong login, the sessions added by 2 (1 added by 
failure, n 1 added by refreshing the login form, i guess)

trying to use login_onfail and login_onvalidation got the same result.
is it normal behaviour, or i have the wrong steps?

thanks and best regards,
stifan

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread Anthony
You shouldn't be calling the callback function when setting the callback -- 
just put the function itself in the list -- web2py will call it at the 
appropriate point. Also, like the other Auth callback settings, 
login_onfail is a list, so you should append to it.

Instead of:

auth.settings.login_onfail = login_attempts()

it should be:

auth.settings.login_onfail.append(login_attempts)

Anthony

On Wednesday, April 22, 2015 at 9:33:32 AM UTC-4, 黄祥 wrote:
>
> it seems that the refresh login page, is count as login_onfail and 
> login_onvalidation in web2py default user login form.
> e.g.
> *models/db.py*
> def login_attempts():
> session.login_attempts = (session.login_attempts or 0) + 1
> if session.login_attempts >= 3 :
> #cache.ram('login_attempts', lambda: session.login_attempts, time_expire = 
> 5)
> response.flash = session.login_attempts
>
> #auth.settings.login_onfail = login_attempts()
> auth.settings.login_onvalidation = [login_attempts()]
>
> *views/default/user.html add response toolbar*
> {{=response.toolbar()}}
>
> 1. when i hit refresh https://127.0.0.1/test/default/user/login, the 
> session is added by 1
> 2. when i try to input the wrong login, the sessions added by 2 (1 added 
> by failure, n 1 added by refreshing the login form, i guess)
>
> trying to use login_onfail and login_onvalidation got the same result.
> is it normal behaviour, or i have the wrong steps?
>
> thanks and best regards,
> stifan
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: A bug in _after_insert callback's document (book)? And more.

2015-04-22 Thread Anthony

>
> It is a different story when building a RESTful API. There would be no 
> rendering behavior before form submission, and normally I use state-less 
> HTTP basic auth and then purposely turn off session feature. Unless I force 
> my api callers to do HTTP POST first, to yet another dedicated "token" api, 
> which will issue the token and also store it into some backend storage 
> (such as a DB or central key-value service), blah blah. But this sounds not 
> "lightweight" at all.
>
You could have the client generate its own unique token with each request 
(e.g., a UUID or timestamp) and cache that on the server for some period of 
time -- if another request comes in with the same token, then ignore the 
request and return an appropriate message (perhaps indicating whether a 
previous request was successful, in case the client didn't receive the 
success message from an earlier attempt).

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 Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Visiting One SQLFORM.grid triggers another SQLFORM.grid -- bug?

2015-04-22 Thread Niphlod
use different formname(s) for each grid.

On Wednesday, April 22, 2015 at 3:15:25 PM UTC+2, LoveWeb2py wrote:
>
> Hello,
>
> I have somewhat of a weird error and I'm not sure how to fix it.
>
> Let's say I have two controllers:
>
> def controller1():
>  grid1 = SQLFORM.grid(db.table1)
>  return locals()
>
> def controller2():
>  grid2 = SQLFORM.grid(db.table2)
>  return locals()
>
> The user visits controller1 and click edit on the SQLFORM.grid, leaves the 
> window idle
>
> Next the user visits controller2 to get information to populate into 
> controller1 by viewing an individual record in controller 2 from a 
> different table in a separate browser
>
> Finally the user goes back to controller1 and makes his updates. When he 
> clicks submit he gets redirected to controller2 and none of his updates in 
> controller1 happen.
>
> Is this anything that can be fixed or is this normal behavior? I'm 
> guessing it has something to do with the CSRF protection?
>
>
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Visiting One SQLFORM.grid triggers another SQLFORM.grid -- bug?

2015-04-22 Thread LoveWeb2py
Thanks, Niphlod! Should I define that like this?

In SQLFORM.grid(db.table1, formname="table1)

or do it in the FORM which SQLFORM.grid links to

On Wednesday, April 22, 2015 at 9:57:04 AM UTC-4, Niphlod wrote:
>
> use different formname(s) for each grid.
>
> On Wednesday, April 22, 2015 at 3:15:25 PM UTC+2, LoveWeb2py wrote:
>>
>> Hello,
>>
>> I have somewhat of a weird error and I'm not sure how to fix it.
>>
>> Let's say I have two controllers:
>>
>> def controller1():
>>  grid1 = SQLFORM.grid(db.table1)
>>  return locals()
>>
>> def controller2():
>>  grid2 = SQLFORM.grid(db.table2)
>>  return locals()
>>
>> The user visits controller1 and click edit on the SQLFORM.grid, leaves 
>> the window idle
>>
>> Next the user visits controller2 to get information to populate into 
>> controller1 by viewing an individual record in controller 2 from a 
>> different table in a separate browser
>>
>> Finally the user goes back to controller1 and makes his updates. When he 
>> clicks submit he gets redirected to controller2 and none of his updates in 
>> controller1 happen.
>>
>> Is this anything that can be fixed or is this normal behavior? I'm 
>> guessing it has something to do with the CSRF protection?
>>
>>
>>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Scheduler on Debian (Beaglebone)

2015-04-22 Thread Aydin S
Hi, Upstart does not exist in the debian on beaglebone and i do not want to 
mess with that. There is a script developed in 
https://github.com/web2py/web2py/blob/master/scripts/setup-scheduler-centos.sh 
which uses chkconfig to add the service to the start up. chkconfig also 
does not exist in the debian. 
I tried to modify the script and use update-rc.d, however all the attempts 
failed. 
What ultimately I want to do is to run periodic tasks and any suggestion is 
welcome and appreciated. I know about Celery but I found Massimo's argument 
about scheduler convincing and wanted to use it. By the way, what are the 
main drawbacks of web2py cron? Should I try to use that?

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Visiting One SQLFORM.grid triggers another SQLFORM.grid -- bug?

2015-04-22 Thread LoveWeb2py
Setting formname in SQLFORM.grid(db.table1, formname='table1') did the 
trick!

Thanks again, Niphlod!

On Wednesday, April 22, 2015 at 10:04:12 AM UTC-4, LoveWeb2py wrote:
>
> Thanks, Niphlod! Should I define that like this?
>
> In SQLFORM.grid(db.table1, formname="table1)
>
> or do it in the FORM which SQLFORM.grid links to
>
> On Wednesday, April 22, 2015 at 9:57:04 AM UTC-4, Niphlod wrote:
>>
>> use different formname(s) for each grid.
>>
>> On Wednesday, April 22, 2015 at 3:15:25 PM UTC+2, LoveWeb2py wrote:
>>>
>>> Hello,
>>>
>>> I have somewhat of a weird error and I'm not sure how to fix it.
>>>
>>> Let's say I have two controllers:
>>>
>>> def controller1():
>>>  grid1 = SQLFORM.grid(db.table1)
>>>  return locals()
>>>
>>> def controller2():
>>>  grid2 = SQLFORM.grid(db.table2)
>>>  return locals()
>>>
>>> The user visits controller1 and click edit on the SQLFORM.grid, leaves 
>>> the window idle
>>>
>>> Next the user visits controller2 to get information to populate into 
>>> controller1 by viewing an individual record in controller 2 from a 
>>> different table in a separate browser
>>>
>>> Finally the user goes back to controller1 and makes his updates. When he 
>>> clicks submit he gets redirected to controller2 and none of his updates in 
>>> controller1 happen.
>>>
>>> Is this anything that can be fixed or is this normal behavior? I'm 
>>> guessing it has something to do with the CSRF protection?
>>>
>>>
>>>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread 黄祥
thank you so much, anthony, the session is not counted anymore when refresh 
the login page.
i want to lock failed user login which tried 3 times, redirect to another 
pages for several times (5 sec in example below), after that time is 
fulfilled reset the counted login attempt. tried using variable but return 
an error (reference before assignment), tried using session (no error 
occured but the result is not expected (i think session has it's own expire 
time) ). how can i achieve it using web2py?
e.g.
"""
login_attempts = 1

def login_attempts(form):
#login_attempts = 1
if login_attempts >= 3 :
test = cache.ram('login_attempts', lambda: login_attempts, time_expire = 5)
if test:
redirect(URL('default', 'test') )
else:
login_attempts = 0
#response.flash = login_attempts
else :
login_attempts += 1
"""

def login_attempts(form):
session.login_attempts = (session.login_attempts or 0) + 1
if session.login_attempts >= 3 :
if cache.ram('login_attempts', lambda: session.login_attempts, time_expire 
= 5):
redirect(URL('default', 'test') )
else:
session.login_attempts = 0
#session.forget(response)

auth.settings.login_onfail.append(login_attempts)

thanks and best regards,
stifan

On Wednesday, April 22, 2015 at 8:51:57 PM UTC+7, Anthony wrote:
>
> You shouldn't be calling the callback function when setting the callback 
> -- just put the function itself in the list -- web2py will call it at the 
> appropriate point. Also, like the other Auth callback settings, 
> login_onfail is a list, so you should append to it.
>
> Instead of:
>
> auth.settings.login_onfail = login_attempts()
>
> it should be:
>
> auth.settings.login_onfail.append(login_attempts)
>
> Anthony
>
> On Wednesday, April 22, 2015 at 9:33:32 AM UTC-4, 黄祥 wrote:
>>
>> it seems that the refresh login page, is count as login_onfail and 
>> login_onvalidation in web2py default user login form.
>> e.g.
>> *models/db.py*
>> def login_attempts():
>> session.login_attempts = (session.login_attempts or 0) + 1
>> if session.login_attempts >= 3 :
>> #cache.ram('login_attempts', lambda: session.login_attempts, time_expire 
>> = 5)
>> response.flash = session.login_attempts
>>
>> #auth.settings.login_onfail = login_attempts()
>> auth.settings.login_onvalidation = [login_attempts()]
>>
>> *views/default/user.html add response toolbar*
>> {{=response.toolbar()}}
>>
>> 1. when i hit refresh https://127.0.0.1/test/default/user/login, the 
>> session is added by 1
>> 2. when i try to input the wrong login, the sessions added by 2 (1 added 
>> by failure, n 1 added by refreshing the login form, i guess)
>>
>> trying to use login_onfail and login_onvalidation got the same result.
>> is it normal behaviour, or i have the wrong steps?
>>
>> thanks and best regards,
>> stifan
>>
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: SQLFORM.grid order of fields on create or edit form

2015-04-22 Thread Kyle Flanagan
Thanks Niphlod, that did the trick. I did the same for createargs as well. 

Normally, I would just reorder the fields in the table def and go on with 
life, but in this case, I have a set of base fields that a handful of my 
tables share. I needed one of these base fields to be first and another to 
be last. 

Thanks again!


On Tuesday, April 21, 2015 at 2:48:32 PM UTC-5, Niphlod wrote:
>
>
>
> On Tuesday, April 21, 2015 at 9:36:40 PM UTC+2, Dave S wrote:
>>
>>
>>
>> On Tuesday, April 21, 2015 at 12:32:28 PM UTC-7, Niphlod wrote:
>>>
>>> I know that may sound as "not-really-a-reply", but can't you just switch 
>>> Field order in the table definition ?
>>>
>>
>> Perhaps it is a legacy table and he's stuck with the table field order.  
>> If so, a temporary table could be a work-around, but maybe there's a less 
>> complex way.
>>
>> /dps
>>
>
> Even with legacy tables, the field order doesn't matter. The ordering of 
> fields doesn't matter, the important thing is to map column names and the 
> correct type to the underlying model.
> However, here we go the "official" reply.
>
> @Kyle: there's a small "hiccup" with what you're proposing, because the 
> grid can show fields from any number of tables. The table you're going to 
> edit is ruled either as the leftmost appearing on the "query" , or 
> specifying its 'id' as field_id. You passing the table name is just a 
> restricted usecase scenario of the whole potential.
>
> That being said, the edit form is istantiated with the result of "merging" 
> two mappings: formargs and later editargs.
> 
> If in a 
>
> SQLFORM(db.ATable) 
>
> you can choose the order of displayed fields with 
>
> SQLFORM(db.ATable, fields=['b', 'a', 'c'])
>
> you can force the "edit" form of SQLFORM.grid with 
>
> SQLFORM.grid(db.ATable, editargs={'fields' : ['b', 'a', 'c']})
>
>
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread Alex Glaros
when solved, can you please post the entire solution in an easy-to-copy 
format?

thanks

Alex Glaros

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Ron Chatterjee
This is what I was looking for. 

https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ

But homehow the code didn't work for me even when I followed the example 
like it says. So, I am creating a stand alone version that works with 
MySQLdb.

 




On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>
> I have sqlite browser. I am guessing its the same like SQlite Manager 
> where someone can import, export csv or sql file. I don't have password in 
> that database and work externally to the python 
>
> *I guess one possibility will be:*
>
> import MySQLdb
>
> import sys
>
> try:
>
> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db = 
> 'my_dabasename')
>
> except Exception as e:
>
> sys.exit('we cant get into the db');
>
>  cursor = db.cursor()
>
> cursor.execute('SELECT *FROM table')
>
> results = cursor.fetchall()
>
> print results
>
>
> Once the table is fetched then use the insert_into_table option to create 
> db object.
>
>
> But I agree with Niphlod, import, export csv is probably the only way to 
> go around, if it works:-). And also agree with richard. sqlbroser does take 
> the storage object as input and can export csv table and then use that back 
> to create the database. I was just hoping to directly connect to my local 
> server (WAMP) where I have the mysql database defined. I was under the 
> impression,  db = 
> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False, 
> pool_size=20) is the way to go about it.
>
>
>
>
>
>
>
> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>>
>> And what would be the utility since you already have INSERT INTO TABLE... 
>> Someone can just use something like SQLite Manager (
>> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to 
>> import it... Once in SQLite DB (which anyway it should) he can use web2py 
>> csv export import if he want to migrate from SQLite to Postgres for 
>> instance...
>>
>> Richard
>>
>> On Tue, Apr 21, 2015 at 3:55 PM, Niphlod  wrote:
>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:

 I tried this:

 db = 
 DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False, 
 pool_size=20)

 It didn't work either. I guess someone needs to look at how to connect 
 to legacy database. 


>>> where is the password ?!
>>>
>>> BTW: I think there's a bit of misunderstandings going on in this thread. 
>>> There are two separate concept at play: schema (structure) AND data.
>>> Every script/extract_***_models.py can "inspect" an existing database 
>>> and figure out (with limitations) the model you should write to access that 
>>> database --> schema (or structure) translated to nifty 
>>> "db.define_table()"
>>>
>>> Exporting and importing a csv (compatible with what web2py generates) 
>>> instead - again, with limitations - is the way to transfer data around.
>>>
>>> If you have a long list of SQL statements in a file, those are NOT going 
>>> to work. 
>>> There's virtually nothing that reverse-engineers table definitions such 
>>> as "CREATE TABLE ." to a model file, nor something that turns "INSERT 
>>> INTO TABLE..." to a db.table.insert(), although it can be fun to create one 
>>> (with lots of headaches).
>>>
>>>  -- 
>>> 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 the Google 
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Richard Vézina
Hello Ron,

The more this thread goes the less I understand what you are trying to
acheive... Do you want to translate a SQLite DB into a web2py model? or
MySQL DB? If you do have a MySQL server instance your connection string
seems correct... But then you have to define the table you want to access
in this table or you only have DB connection active which give you notting
because the DAL don't know the DB structure...

Richard

On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee 
wrote:

> This is what I was looking for.
>
>
> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>
> But homehow the code didn't work for me even when I followed the example
> like it says. So, I am creating a stand alone version that works with
> MySQLdb.
>
>
>
>
>
>
> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>>
>> I have sqlite browser. I am guessing its the same like SQlite Manager
>> where someone can import, export csv or sql file. I don't have password in
>> that database and work externally to the python
>>
>> *I guess one possibility will be:*
>>
>> import MySQLdb
>>
>> import sys
>>
>> try:
>>
>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db =
>> 'my_dabasename')
>>
>> except Exception as e:
>>
>> sys.exit('we cant get into the db');
>>
>>  cursor = db.cursor()
>>
>> cursor.execute('SELECT *FROM table')
>>
>> results = cursor.fetchall()
>>
>> print results
>>
>>
>> Once the table is fetched then use the insert_into_table option to create
>> db object.
>>
>>
>> But I agree with Niphlod, import, export csv is probably the only way to
>> go around, if it works:-). And also agree with richard. sqlbroser does take
>> the storage object as input and can export csv table and then use that back
>> to create the database. I was just hoping to directly connect to my local
>> server (WAMP) where I have the mysql database defined. I was under the
>> impression,  db = 
>> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
>> pool_size=20) is the way to go about it.
>>
>>
>>
>>
>>
>>
>>
>> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>>>
>>> And what would be the utility since you already have INSERT INTO
>>> TABLE... Someone can just use something like SQLite Manager (
>>> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to
>>> import it... Once in SQLite DB (which anyway it should) he can use web2py
>>> csv export import if he want to migrate from SQLite to Postgres for
>>> instance...
>>>
>>> Richard
>>>
>>> On Tue, Apr 21, 2015 at 3:55 PM, Niphlod  wrote:
>>>


 On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:
>
> I tried this:
>
> db = 
> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
> pool_size=20)
>
> It didn't work either. I guess someone needs to look at how to connect
> to legacy database.
>
>
 where is the password ?!

 BTW: I think there's a bit of misunderstandings going on in this
 thread.
 There are two separate concept at play: schema (structure) AND data.
 Every script/extract_***_models.py can "inspect" an existing database
 and figure out (with limitations) the model you should write to access that
 database --> schema (or structure) translated to nifty
 "db.define_table()"

 Exporting and importing a csv (compatible with what web2py generates)
 instead - again, with limitations - is the way to transfer data around.

 If you have a long list of SQL statements in a file, those are NOT
 going to work.
 There's virtually nothing that reverse-engineers table definitions such
 as "CREATE TABLE ." to a model file, nor something that turns "INSERT
 INTO TABLE..." to a db.table.insert(), although it can be fun to create one
 (with lots of headaches).

  --
 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 the Google
 Groups "web2py-users" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>>  --
> 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 the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- ht

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Ron Chatterjee
Sorry, wasn't clear. Basically want to create a DAL (db.py) file from an 
existing site that I locally hosted (wAMP) which is php front end mysql 
backend. I exported out of my WAMP (phpmysqladmin) the tables and fields in 
SQL language. Then I tried to make DAL out of it. As you explained, thats 
not possible, Now I will try to take a stab at working with 
extract_mysql_models.py but it will probably will require some updates. If 
nothing works, I can use the MYSQL workbench to connect to the server to 
draw me the schema and then write the DAL from that. Hope it clear things 
up now. My bad.



On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:
>
> Hello Ron,
>
> The more this thread goes the less I understand what you are trying to 
> acheive... Do you want to translate a SQLite DB into a web2py model? or 
> MySQL DB? If you do have a MySQL server instance your connection string 
> seems correct... But then you have to define the table you want to access 
> in this table or you only have DB connection active which give you notting 
> because the DAL don't know the DB structure...
>
> Richard
>
> On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee  > wrote:
>
>> This is what I was looking for. 
>>
>>
>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>
>> But homehow the code didn't work for me even when I followed the example 
>> like it says. So, I am creating a stand alone version that works with 
>> MySQLdb.
>>
>>  
>>
>>
>>
>>
>> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>>>
>>> I have sqlite browser. I am guessing its the same like SQlite Manager 
>>> where someone can import, export csv or sql file. I don't have password in 
>>> that database and work externally to the python 
>>>
>>> *I guess one possibility will be:*
>>>
>>> import MySQLdb
>>>
>>> import sys
>>>
>>> try:
>>>
>>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db = 
>>> 'my_dabasename')
>>>
>>> except Exception as e:
>>>
>>> sys.exit('we cant get into the db');
>>>
>>>  cursor = db.cursor()
>>>
>>> cursor.execute('SELECT *FROM table')
>>>
>>> results = cursor.fetchall()
>>>
>>> print results
>>>
>>>
>>> Once the table is fetched then use the insert_into_table option to 
>>> create db object.
>>>
>>>
>>> But I agree with Niphlod, import, export csv is probably the only way to 
>>> go around, if it works:-). And also agree with richard. sqlbroser does take 
>>> the storage object as input and can export csv table and then use that back 
>>> to create the database. I was just hoping to directly connect to my local 
>>> server (WAMP) where I have the mysql database defined. I was under the 
>>> impression,  db = 
>>> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False, 
>>> pool_size=20) is the way to go about it.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:

 And what would be the utility since you already have INSERT INTO 
 TABLE... Someone can just use something like SQLite Manager (
 https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to 
 import it... Once in SQLite DB (which anyway it should) he can use web2py 
 csv export import if he want to migrate from SQLite to Postgres for 
 instance...

 Richard

 On Tue, Apr 21, 2015 at 3:55 PM, Niphlod  wrote:

>
>
> On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:
>>
>> I tried this:
>>
>> db = 
>> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
>>  
>> pool_size=20)
>>
>> It didn't work either. I guess someone needs to look at how to 
>> connect to legacy database. 
>>
>>
> where is the password ?!
>
> BTW: I think there's a bit of misunderstandings going on in this 
> thread. 
> There are two separate concept at play: schema (structure) AND data.
> Every script/extract_***_models.py can "inspect" an existing database 
> and figure out (with limitations) the model you should write to access 
> that 
> database --> schema (or structure) translated to nifty 
> "db.define_table()"
>
> Exporting and importing a csv (compatible with what web2py generates) 
> instead - again, with limitations - is the way to transfer data around.
>
> If you have a long list of SQL statements in a file, those are NOT 
> going to work. 
> There's virtually nothing that reverse-engineers table definitions 
> such as "CREATE TABLE ." to a model file, nor something that turns 
> "INSERT INTO TABLE..." to a db.table.insert(), although it can be fun to 
> create one (with lots of headaches).
>
>  -- 
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Richard Vézina
What do you exactly get out of extract_mysql_models.py applied over an SQL
dump of the schema (only no data inserts)?

Richard

On Wed, Apr 22, 2015 at 2:29 PM, Ron Chatterjee 
wrote:

> Sorry, wasn't clear. Basically want to create a DAL (db.py) file from an
> existing site that I locally hosted (wAMP) which is php front end mysql
> backend. I exported out of my WAMP (phpmysqladmin) the tables and fields in
> SQL language. Then I tried to make DAL out of it. As you explained, thats
> not possible, Now I will try to take a stab at working with
> extract_mysql_models.py but it will probably will require some updates. If
> nothing works, I can use the MYSQL workbench to connect to the server to
> draw me the schema and then write the DAL from that. Hope it clear things
> up now. My bad.
>
>
>
> On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:
>>
>> Hello Ron,
>>
>> The more this thread goes the less I understand what you are trying to
>> acheive... Do you want to translate a SQLite DB into a web2py model? or
>> MySQL DB? If you do have a MySQL server instance your connection string
>> seems correct... But then you have to define the table you want to access
>> in this table or you only have DB connection active which give you notting
>> because the DAL don't know the DB structure...
>>
>> Richard
>>
>> On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee 
>> wrote:
>>
>>> This is what I was looking for.
>>>
>>>
>>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>>
>>> But homehow the code didn't work for me even when I followed the example
>>> like it says. So, I am creating a stand alone version that works with
>>> MySQLdb.
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:

 I have sqlite browser. I am guessing its the same like SQlite Manager
 where someone can import, export csv or sql file. I don't have password in
 that database and work externally to the python

 *I guess one possibility will be:*

 import MySQLdb

 import sys

 try:

 db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db =
 'my_dabasename')

 except Exception as e:

 sys.exit('we cant get into the db');

  cursor = db.cursor()

 cursor.execute('SELECT *FROM table')

 results = cursor.fetchall()

 print results


 Once the table is fetched then use the insert_into_table option to
 create db object.


 But I agree with Niphlod, import, export csv is probably the only way
 to go around, if it works:-). And also agree with richard. sqlbroser does
 take the storage object as input and can export csv table and then use that
 back to create the database. I was just hoping to directly connect to my
 local server (WAMP) where I have the mysql database defined. I was under
 the impression,  db = 
 DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
 pool_size=20) is the way to go about it.







 On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>
> And what would be the utility since you already have INSERT INTO
> TABLE... Someone can just use something like SQLite Manager (
> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to
> import it... Once in SQLite DB (which anyway it should) he can use web2py
> csv export import if he want to migrate from SQLite to Postgres for
> instance...
>
> Richard
>
> On Tue, Apr 21, 2015 at 3:55 PM, Niphlod  wrote:
>
>>
>>
>> On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:
>>>
>>> I tried this:
>>>
>>> db = 
>>> DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
>>> pool_size=20)
>>>
>>> It didn't work either. I guess someone needs to look at how to
>>> connect to legacy database.
>>>
>>>
>> where is the password ?!
>>
>> BTW: I think there's a bit of misunderstandings going on in this
>> thread.
>> There are two separate concept at play: schema (structure) AND data.
>> Every script/extract_***_models.py can "inspect" an existing database
>> and figure out (with limitations) the model you should write to access 
>> that
>> database --> schema (or structure) translated to nifty
>> "db.define_table()"
>>
>> Exporting and importing a csv (compatible with what web2py generates)
>> instead - again, with limitations - is the way to transfer data around.
>>
>> If you have a long list of SQL statements in a file, those are NOT
>> going to work.
>> There's virtually nothing that reverse-engineers table definitions
>> such as "CREATE TABLE ." to a model file, nor something that turns
>> "INSERT INTO TABLE..." to a db.

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Ron Chatterjee
I used this version (the first one) and change to MySQLdb.
https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ

It gives me an error:

Basically, 

This worked

db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '',db = 
'name_of_my_database')

But this didn't.

extract_mysql_models.py --user 'root' --password '' --host '127.0.0.1' 
--database 'name_of_my_database' --dalname 'wikidb' --colcomments 
--singlemigrate > mywiki.py

Note, my password is empty.

The error I get is simply that it can't connect to the server. So, I am 
going through the code now. 







On Wednesday, April 22, 2015 at 2:49:41 PM UTC-4, Richard wrote:
>
> What do you exactly get out of extract_mysql_models.py applied over an SQL 
> dump of the schema (only no data inserts)?
>
> Richard
>
> On Wed, Apr 22, 2015 at 2:29 PM, Ron Chatterjee  > wrote:
>
>> Sorry, wasn't clear. Basically want to create a DAL (db.py) file from an 
>> existing site that I locally hosted (wAMP) which is php front end mysql 
>> backend. I exported out of my WAMP (phpmysqladmin) the tables and fields in 
>> SQL language. Then I tried to make DAL out of it. As you explained, thats 
>> not possible, Now I will try to take a stab at working with 
>> extract_mysql_models.py but it will probably will require some updates. If 
>> nothing works, I can use the MYSQL workbench to connect to the server to 
>> draw me the schema and then write the DAL from that. Hope it clear things 
>> up now. My bad.
>>
>>
>>
>> On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:
>>>
>>> Hello Ron,
>>>
>>> The more this thread goes the less I understand what you are trying to 
>>> acheive... Do you want to translate a SQLite DB into a web2py model? or 
>>> MySQL DB? If you do have a MySQL server instance your connection string 
>>> seems correct... But then you have to define the table you want to access 
>>> in this table or you only have DB connection active which give you notting 
>>> because the DAL don't know the DB structure...
>>>
>>> Richard
>>>
>>> On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee  
>>> wrote:
>>>
 This is what I was looking for. 


 https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ

 But homehow the code didn't work for me even when I followed the 
 example like it says. So, I am creating a stand alone version that works 
 with MySQLdb.

  




 On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>
> I have sqlite browser. I am guessing its the same like SQlite Manager 
> where someone can import, export csv or sql file. I don't have password 
> in 
> that database and work externally to the python 
>
> *I guess one possibility will be:*
>
> import MySQLdb
>
> import sys
>
> try:
>
> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db = 
> 'my_dabasename')
>
> except Exception as e:
>
> sys.exit('we cant get into the db');
>
>  cursor = db.cursor()
>
> cursor.execute('SELECT *FROM table')
>
> results = cursor.fetchall()
>
> print results
>
>
> Once the table is fetched then use the insert_into_table option to 
> create db object.
>
>
> But I agree with Niphlod, import, export csv is probably the only way 
> to go around, if it works:-). And also agree with richard. sqlbroser does 
> take the storage object as input and can export csv table and then use 
> that 
> back to create the database. I was just hoping to directly connect to my 
> local server (WAMP) where I have the mysql database defined. I was under 
> the impression,  db = DAL('mysql://
> root@127.0.0.1:8000/my_database_name',migrate_enabled=False, 
> pool_size=20) is the way to go about it.
>
>
>
>
>
>
>
> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>>
>> And what would be the utility since you already have INSERT INTO 
>> TABLE... Someone can just use something like SQLite Manager (
>> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to 
>> import it... Once in SQLite DB (which anyway it should) he can use 
>> web2py 
>> csv export import if he want to migrate from SQLite to Postgres for 
>> instance...
>>
>> Richard
>>
>> On Tue, Apr 21, 2015 at 3:55 PM, Niphlod  wrote:
>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 9:39:14 PM UTC+2, Ron Chatterjee wrote:

 I tried this:

 db = 
 DAL('mysql://root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
  
 pool_size=20)

 It didn't work either. I guess someone needs to look at how to 
 connect to legacy database. 


>>> where is 

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Richard Vézina
https://github.com/web2py/web2py/blob/master/scripts/extract_mysql_models.py

Ok, it is not working exactly how I thought it was... Do you have
myslqldump install?

Do you use Linux or Windows...

what if you do

python extract_mysql_models.py username:password@data_basename

On Wed, Apr 22, 2015 at 3:28 PM, Ron Chatterjee 
wrote:

> I used this version (the first one) and change to MySQLdb.
>
> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>
> It gives me an error:
>
> Basically,
>
> This worked
>
> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '',db =
> 'name_of_my_database')
>
> But this didn't.
>
> extract_mysql_models.py --user 'root' --password '' --host '127.0.0.1'
> --database 'name_of_my_database' --dalname 'wikidb' --colcomments
> --singlemigrate > mywiki.py
>
> Note, my password is empty.
>
> The error I get is simply that it can't connect to the server. So, I am
> going through the code now.
>
>
>
>
>
>
>
> On Wednesday, April 22, 2015 at 2:49:41 PM UTC-4, Richard wrote:
>>
>> What do you exactly get out of extract_mysql_models.py applied over an
>> SQL dump of the schema (only no data inserts)?
>>
>> Richard
>>
>> On Wed, Apr 22, 2015 at 2:29 PM, Ron Chatterjee 
>> wrote:
>>
>>> Sorry, wasn't clear. Basically want to create a DAL (db.py) file from an
>>> existing site that I locally hosted (wAMP) which is php front end mysql
>>> backend. I exported out of my WAMP (phpmysqladmin) the tables and fields in
>>> SQL language. Then I tried to make DAL out of it. As you explained, thats
>>> not possible, Now I will try to take a stab at working with
>>> extract_mysql_models.py but it will probably will require some updates. If
>>> nothing works, I can use the MYSQL workbench to connect to the server to
>>> draw me the schema and then write the DAL from that. Hope it clear things
>>> up now. My bad.
>>>
>>>
>>>
>>> On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:

 Hello Ron,

 The more this thread goes the less I understand what you are trying to
 acheive... Do you want to translate a SQLite DB into a web2py model? or
 MySQL DB? If you do have a MySQL server instance your connection string
 seems correct... But then you have to define the table you want to access
 in this table or you only have DB connection active which give you notting
 because the DAL don't know the DB structure...

 Richard

 On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee 
 wrote:

> This is what I was looking for.
>
>
> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>
> But homehow the code didn't work for me even when I followed the
> example like it says. So, I am creating a stand alone version that works
> with MySQLdb.
>
>
>
>
>
>
> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>>
>> I have sqlite browser. I am guessing its the same like SQlite Manager
>> where someone can import, export csv or sql file. I don't have password 
>> in
>> that database and work externally to the python
>>
>> *I guess one possibility will be:*
>>
>> import MySQLdb
>>
>> import sys
>>
>> try:
>>
>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db
>> = 'my_dabasename')
>>
>> except Exception as e:
>>
>> sys.exit('we cant get into the db');
>>
>>  cursor = db.cursor()
>>
>> cursor.execute('SELECT *FROM table')
>>
>> results = cursor.fetchall()
>>
>> print results
>>
>>
>> Once the table is fetched then use the insert_into_table option to
>> create db object.
>>
>>
>> But I agree with Niphlod, import, export csv is probably the only way
>> to go around, if it works:-). And also agree with richard. sqlbroser does
>> take the storage object as input and can export csv table and then use 
>> that
>> back to create the database. I was just hoping to directly connect to my
>> local server (WAMP) where I have the mysql database defined. I was under
>> the impression,  db = DAL('mysql://
>> root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
>> pool_size=20) is the way to go about it.
>>
>>
>>
>>
>>
>>
>>
>> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:
>>>
>>> And what would be the utility since you already have INSERT INTO
>>> TABLE... Someone can just use something like SQLite Manager (
>>> https://addons.mozilla.org/en-us/firefox/addon/sqlite-manager/) to
>>> import it... Once in SQLite DB (which anyway it should) he can use 
>>> web2py
>>> csv export import if he want to migrate from SQLite to Postgres for
>>> instance...
>>>
>>> Richard
>>>
>>> On Tue, Apr 21, 2015 at

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Richard Vézina
This regex : regex = re.compile('(.*?):(.*?)@(.*)')

Seems to parse the below command line call!!

Richard

On Wed, Apr 22, 2015 at 3:39 PM, Richard Vézina  wrote:

>
> https://github.com/web2py/web2py/blob/master/scripts/extract_mysql_models.py
>
> Ok, it is not working exactly how I thought it was... Do you have
> myslqldump install?
>
> Do you use Linux or Windows...
>
> what if you do
>
> python extract_mysql_models.py username:password@data_basename
>
> On Wed, Apr 22, 2015 at 3:28 PM, Ron Chatterjee 
> wrote:
>
>> I used this version (the first one) and change to MySQLdb.
>>
>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>
>> It gives me an error:
>>
>> Basically,
>>
>> This worked
>>
>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '',db =
>> 'name_of_my_database')
>>
>> But this didn't.
>>
>> extract_mysql_models.py --user 'root' --password '' --host '127.0.0.1'
>> --database 'name_of_my_database' --dalname 'wikidb' --colcomments
>> --singlemigrate > mywiki.py
>>
>> Note, my password is empty.
>>
>> The error I get is simply that it can't connect to the server. So, I am
>> going through the code now.
>>
>>
>>
>>
>>
>>
>>
>> On Wednesday, April 22, 2015 at 2:49:41 PM UTC-4, Richard wrote:
>>>
>>> What do you exactly get out of extract_mysql_models.py applied over an
>>> SQL dump of the schema (only no data inserts)?
>>>
>>> Richard
>>>
>>> On Wed, Apr 22, 2015 at 2:29 PM, Ron Chatterjee 
>>> wrote:
>>>
 Sorry, wasn't clear. Basically want to create a DAL (db.py) file from
 an existing site that I locally hosted (wAMP) which is php front end mysql
 backend. I exported out of my WAMP (phpmysqladmin) the tables and fields in
 SQL language. Then I tried to make DAL out of it. As you explained, thats
 not possible, Now I will try to take a stab at working with
 extract_mysql_models.py but it will probably will require some updates. If
 nothing works, I can use the MYSQL workbench to connect to the server to
 draw me the schema and then write the DAL from that. Hope it clear things
 up now. My bad.



 On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:
>
> Hello Ron,
>
> The more this thread goes the less I understand what you are trying to
> acheive... Do you want to translate a SQLite DB into a web2py model? or
> MySQL DB? If you do have a MySQL server instance your connection string
> seems correct... But then you have to define the table you want to access
> in this table or you only have DB connection active which give you notting
> because the DAL don't know the DB structure...
>
> Richard
>
> On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee 
> wrote:
>
>> This is what I was looking for.
>>
>>
>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>
>> But homehow the code didn't work for me even when I followed the
>> example like it says. So, I am creating a stand alone version that works
>> with MySQLdb.
>>
>>
>>
>>
>>
>>
>> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:
>>>
>>> I have sqlite browser. I am guessing its the same like SQlite
>>> Manager where someone can import, export csv or sql file. I don't have
>>> password in that database and work externally to the python
>>>
>>> *I guess one possibility will be:*
>>>
>>> import MySQLdb
>>>
>>> import sys
>>>
>>> try:
>>>
>>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = ' ',db
>>> = 'my_dabasename')
>>>
>>> except Exception as e:
>>>
>>> sys.exit('we cant get into the db');
>>>
>>>  cursor = db.cursor()
>>>
>>> cursor.execute('SELECT *FROM table')
>>>
>>> results = cursor.fetchall()
>>>
>>> print results
>>>
>>>
>>> Once the table is fetched then use the insert_into_table option to
>>> create db object.
>>>
>>>
>>> But I agree with Niphlod, import, export csv is probably the only
>>> way to go around, if it works:-). And also agree with richard. sqlbroser
>>> does take the storage object as input and can export csv table and then 
>>> use
>>> that back to create the database. I was just hoping to directly connect 
>>> to
>>> my local server (WAMP) where I have the mysql database defined. I was 
>>> under
>>> the impression,  db = DAL('mysql://
>>> root@127.0.0.1:8000/my_database_name',migrate_enabled=False,
>>> pool_size=20) is the way to go about it.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 4:07:02 PM UTC-4, Richard wrote:

 And what would be the utility since you already have INSERT INTO
 TABLE... Someone can just use something like SQLite 

Re: [web2py] creating DAL from SQL file

2015-04-22 Thread Richard Vézina
The version in the thread seems not have been included in web2py...

Try the one in gluon/scripts/

Richard

On Wed, Apr 22, 2015 at 3:41 PM, Richard Vézina  wrote:

> This regex : regex = re.compile('(.*?):(.*?)@(.*)')
>
> Seems to parse the below command line call!!
>
> Richard
>
> On Wed, Apr 22, 2015 at 3:39 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>>
>> https://github.com/web2py/web2py/blob/master/scripts/extract_mysql_models.py
>>
>> Ok, it is not working exactly how I thought it was... Do you have
>> myslqldump install?
>>
>> Do you use Linux or Windows...
>>
>> what if you do
>>
>> python extract_mysql_models.py username:password@data_basename
>>
>> On Wed, Apr 22, 2015 at 3:28 PM, Ron Chatterjee > > wrote:
>>
>>> I used this version (the first one) and change to MySQLdb.
>>>
>>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>>
>>> It gives me an error:
>>>
>>> Basically,
>>>
>>> This worked
>>>
>>> db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '',db =
>>> 'name_of_my_database')
>>>
>>> But this didn't.
>>>
>>> extract_mysql_models.py --user 'root' --password '' --host '127.0.0.1'
>>> --database 'name_of_my_database' --dalname 'wikidb' --colcomments
>>> --singlemigrate > mywiki.py
>>>
>>> Note, my password is empty.
>>>
>>> The error I get is simply that it can't connect to the server. So, I am
>>> going through the code now.
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Wednesday, April 22, 2015 at 2:49:41 PM UTC-4, Richard wrote:

 What do you exactly get out of extract_mysql_models.py applied over an
 SQL dump of the schema (only no data inserts)?

 Richard

 On Wed, Apr 22, 2015 at 2:29 PM, Ron Chatterjee 
 wrote:

> Sorry, wasn't clear. Basically want to create a DAL (db.py) file from
> an existing site that I locally hosted (wAMP) which is php front end mysql
> backend. I exported out of my WAMP (phpmysqladmin) the tables and fields 
> in
> SQL language. Then I tried to make DAL out of it. As you explained, thats
> not possible, Now I will try to take a stab at working with
> extract_mysql_models.py but it will probably will require some updates. If
> nothing works, I can use the MYSQL workbench to connect to the server to
> draw me the schema and then write the DAL from that. Hope it clear things
> up now. My bad.
>
>
>
> On Wednesday, April 22, 2015 at 2:04:49 PM UTC-4, Richard wrote:
>>
>> Hello Ron,
>>
>> The more this thread goes the less I understand what you are trying
>> to acheive... Do you want to translate a SQLite DB into a web2py model? 
>> or
>> MySQL DB? If you do have a MySQL server instance your connection string
>> seems correct... But then you have to define the table you want to access
>> in this table or you only have DB connection active which give you 
>> notting
>> because the DAL don't know the DB structure...
>>
>> Richard
>>
>> On Wed, Apr 22, 2015 at 1:30 PM, Ron Chatterjee > > wrote:
>>
>>> This is what I was looking for.
>>>
>>>
>>> https://groups.google.com/forum/#!searchin/web2py/extract_mysql_models.py/web2py/XPoTlzPG7lQ/ngSsMbd6zHAJ
>>>
>>> But homehow the code didn't work for me even when I followed the
>>> example like it says. So, I am creating a stand alone version that works
>>> with MySQLdb.
>>>
>>>
>>>
>>>
>>>
>>>
>>> On Tuesday, April 21, 2015 at 4:58:52 PM UTC-4, Ron Chatterjee wrote:

 I have sqlite browser. I am guessing its the same like SQlite
 Manager where someone can import, export csv or sql file. I don't have
 password in that database and work externally to the python

 *I guess one possibility will be:*

 import MySQLdb

 import sys

 try:

 db = MySQLdb.connect(host = 'localhost',user ='root',passwd = '
 ',db = 'my_dabasename')

 except Exception as e:

 sys.exit('we cant get into the db');

  cursor = db.cursor()

 cursor.execute('SELECT *FROM table')

 results = cursor.fetchall()

 print results


 Once the table is fetched then use the insert_into_table option to
 create db object.


 But I agree with Niphlod, import, export csv is probably the only
 way to go around, if it works:-). And also agree with richard. 
 sqlbroser
 does take the storage object as input and can export csv table and 
 then use
 that back to create the database. I was just hoping to directly 
 connect to
 my local server (WAMP) where I have the mysql database defined. I was 
 under
 the impression,  db = DAL('mysql://
>>

[web2py] create another comment field?

2015-04-22 Thread LoveWeb2py
I really enjoy using the comment="this is my comment". I have been using it 
to create info boxes. Is there a way I could create another variable field 
for example comment2="this is my additional comment?"

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] create another comment field?

2015-04-22 Thread Richard Vézina
what about comment='[comment1, comment2]'

And you process accordingly...

Richard

On Wed, Apr 22, 2015 at 4:17 PM, LoveWeb2py  wrote:

> I really enjoy using the comment="this is my comment". I have been using
> it to create info boxes. Is there a way I could create another variable
> field for example comment2="this is my additional comment?"
>
> --
> 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 the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: New error in trunk' s sqlhtml.py: AttributeError: 'SQLCustomType' object has no attribute 'represent'

2015-04-22 Thread Paolo Valleri
Hi, this it should have been fixed
Have you tried with the last trunk? Be sure to update pydal too.

Paolo

On Wednesday, April 22, 2015 at 1:00:04 PM UTC+2, Johann Spies wrote:
>
> This code work without a problem in
>  Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
>
> but not with the code from the trunk:
>
> def za_arts_by_journal_by_year():
>
> db.define_table('za_wos_papers_by_journal_by_year',
> Field('journal', type=citext),
> Field('pubyear', 'integer'),
> Field('articles', 'integer'),
> migrate = False,
> rname = 'isi.za_wos_papers_by_journal_by_year')
> grid = SQLFORM.grid(db.za_wos_papers_by_journal_by_year,
> 
> fields=[db.za_wos_papers_by_journal_by_year.journal,
> 
> db.za_wos_papers_by_journal_by_year.pubyear,
> 
> db.za_wos_papers_by_journal_by_year.articles],
> create = False,
> editable = False,
> details = False,
> deletable = False,
> searchable = False,
> maxtextlength= 200,
> paginate=120,
> 
> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
> grid.element('.web2py_counter',replace=None)
> 
> where "orderby" is on line 391.
>
> The error:
>
> Traceback (most recent call last):
>   File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
> exec ccode in environment
>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
> , 
> line 818, in 
>   File "/home/js/web2py/gluon/globals.py", line 393, in 
> self._caller = lambda f: f()
>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
> , 
> line 391, in za_arts_by_journal_by_year
> 
> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
>   File "/home/js/web2py/gluon/sqlhtml.py", line 2720, in grid
> elif isinstance(field.type, SQLCustomType) and 
> callable(field.type.represent):
> AttributeError: 'SQLCustomType' object has no attribute 'represent'
>
>
> I did know how to create an issue on the mercurial trunk but I am not sure 
> about the git repository.  What is the url again?
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] create another comment field?

2015-04-22 Thread LoveWeb2py
I guess that could work. I'll give that a shot. Thanks, Richard!

On Wednesday, April 22, 2015 at 4:30:25 PM UTC-4, Richard wrote:
>
> what about comment='[comment1, comment2]'
>
> And you process accordingly...
>
> Richard
>
> On Wed, Apr 22, 2015 at 4:17 PM, LoveWeb2py  > wrote:
>
>> I really enjoy using the comment="this is my comment". I have been using 
>> it to create info boxes. Is there a way I could create another variable 
>> field for example comment2="this is my additional comment?"
>>
>> -- 
>> 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 the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] create another comment field?

2015-04-22 Thread Richard Vézina
comment Field attribute can't be change... There no such comment2 in
backend... comment map SQL column comment

I do use comment for the same purpose of you, but if I was having to craft
a new app I would go away from this pratice and rethink it differently...
Maybe subclass of widget where I can add new html tags...

Let say you want have really informative form you may want info icon
popover cue on which info you should input, than you may want to inform
your user which field are required with an *, you may want also short
comment beside the field in some case + some bootstrap add-on stuff beside
you html input...

You may write some JS that manage this but this is extra browser processing
for every input...

Richard

On Wed, Apr 22, 2015 at 4:42 PM, LoveWeb2py  wrote:

> I guess that could work. I'll give that a shot. Thanks, Richard!
>
> On Wednesday, April 22, 2015 at 4:30:25 PM UTC-4, Richard wrote:
>>
>> what about comment='[comment1, comment2]'
>>
>> And you process accordingly...
>>
>> Richard
>>
>> On Wed, Apr 22, 2015 at 4:17 PM, LoveWeb2py  wrote:
>>
>>> I really enjoy using the comment="this is my comment". I have been using
>>> it to create info boxes. Is there a way I could create another variable
>>> field for example comment2="this is my additional comment?"
>>>
>>> --
>>> 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 the Google
>>> Groups "web2py-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to web2py+un...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>  --
> 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 the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: create another comment field?

2015-04-22 Thread Anthony
The comment attribute can be an HTML helper (which can contain any HTML 
markup, such as multiple DIVs) or raw HTML wrapped in the XML() helper.

Anthony

On Wednesday, April 22, 2015 at 4:17:26 PM UTC-4, LoveWeb2py wrote:
>
> I really enjoy using the comment="this is my comment". I have been using 
> it to create info boxes. Is there a way I could create another variable 
> field for example comment2="this is my additional comment?"
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] How to process SQLFORM.grid edit forms?

2015-04-22 Thread LoveWeb2py
I have a widget I'm using in my comment field creates a Modal pop up. 
However, I quickly realized I have no way to process the modal without the 
use of web2py forms

I've looked through the book and multiple post, but didn't see anything 
similar. Is there a way I could process the modal form from the editable 
form section of SQLFORM.grid?

If showing code will help I'd be happy to.

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread Anthony
You can't simply reset a global variable as you are doing in the first 
example, as it will be reset on every request. Also, I'm not sure what 
you're trying to achieve with the cache example, but that code won't force 
a redirect for 5 seconds (and you don't want to have just a single cache 
key -- you would need one per user). Anyway, you shouldn't rely on the 
session, as a malicious user could simply start new sessions to keep making 
attempts. Instead, you would have to keep track of the user ID and the 
number of attempts via some other means (e.g., the database or the cache).

Anthony

On Wednesday, April 22, 2015 at 11:20:37 AM UTC-4, 黄祥 wrote:
>
> thank you so much, anthony, the session is not counted anymore when 
> refresh the login page.
> i want to lock failed user login which tried 3 times, redirect to another 
> pages for several times (5 sec in example below), after that time is 
> fulfilled reset the counted login attempt. tried using variable but return 
> an error (reference before assignment), tried using session (no error 
> occured but the result is not expected (i think session has it's own expire 
> time) ). how can i achieve it using web2py?
> e.g.
> """
> login_attempts = 1
>
> def login_attempts(form):
> #login_attempts = 1
> if login_attempts >= 3 :
> test = cache.ram('login_attempts', lambda: login_attempts, time_expire = 5)
> if test:
> redirect(URL('default', 'test') )
> else:
> login_attempts = 0
> #response.flash = login_attempts
> else :
> login_attempts += 1
> """
>
> def login_attempts(form):
> session.login_attempts = (session.login_attempts or 0) + 1
> if session.login_attempts >= 3 :
> if cache.ram('login_attempts', lambda: session.login_attempts, time_expire 
> = 5):
> redirect(URL('default', 'test') )
> else:
> session.login_attempts = 0
> #session.forget(response)
>
> auth.settings.login_onfail.append(login_attempts)
>
> thanks and best regards,
> stifan
>
> On Wednesday, April 22, 2015 at 8:51:57 PM UTC+7, Anthony wrote:
>>
>> You shouldn't be calling the callback function when setting the callback 
>> -- just put the function itself in the list -- web2py will call it at the 
>> appropriate point. Also, like the other Auth callback settings, 
>> login_onfail is a list, so you should append to it.
>>
>> Instead of:
>>
>> auth.settings.login_onfail = login_attempts()
>>
>> it should be:
>>
>> auth.settings.login_onfail.append(login_attempts)
>>
>> Anthony
>>
>> On Wednesday, April 22, 2015 at 9:33:32 AM UTC-4, 黄祥 wrote:
>>>
>>> it seems that the refresh login page, is count as login_onfail and 
>>> login_onvalidation in web2py default user login form.
>>> e.g.
>>> *models/db.py*
>>> def login_attempts():
>>> session.login_attempts = (session.login_attempts or 0) + 1
>>> if session.login_attempts >= 3 :
>>> #cache.ram('login_attempts', lambda: session.login_attempts, time_expire 
>>> = 5)
>>> response.flash = session.login_attempts
>>>
>>> #auth.settings.login_onfail = login_attempts()
>>> auth.settings.login_onvalidation = [login_attempts()]
>>>
>>> *views/default/user.html add response toolbar*
>>> {{=response.toolbar()}}
>>>
>>> 1. when i hit refresh https://127.0.0.1/test/default/user/login, the 
>>> session is added by 1
>>> 2. when i try to input the wrong login, the sessions added by 2 (1 added 
>>> by failure, n 1 added by refreshing the login form, i guess)
>>>
>>> trying to use login_onfail and login_onvalidation got the same result.
>>> is it normal behaviour, or i have the wrong steps?
>>>
>>> thanks and best regards,
>>> stifan
>>>
>>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] AppConfig and Storage

2015-04-22 Thread www.diazluis.com
where we can read more about this new option.?
You could publish related link?

El martes, 7 de abril de 2015, 11:19:17 (UTC-4:30), Niphlod escribió:
>
>
>> Sorry for late intromission. 
>>
>> Is all of this documented in the book? If I got right, this can change 
>> the programer’s expectation about when the system parameters will be 
>> refreshed. 
>>
>
> that's why the scaffolding has reload=True, with a comment to remove that 
> parameter once in production.
>
>
>> Until now, it was refreshed on each request. Now, If I understood, it 
>> just occurs when the server is reloaded. 
>>
>
> Let's don't fall in shortcircuits: until now, there was no such thing as 
> appconfig.
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread 黄祥
pardon me, still not understood what do you mean with the cache. on my 
example above yet, i still not sure which one to use, yet your hints, quite 
clear about database. thank you anthony.
*e.g. work fine*
*models/db.py*
auth = Auth(db)

auth.settings.extra_fields['auth_user']= [
  Field('Attempts', 'integer') ]

auth.define_tables(username=True, signature=False)

def login_attempts(form):
username = request.vars.username
row = db((db.auth_user.username == username ) ).select().first()
if row is not None:
db(db.auth_user.id == row.id).update(Attempts = row.Attempts + 1)
db.auth_event.insert(time_stamp = request.now, 
 client_ip = request.client, 
 user_id = row.id, 
 origin = '%s/%s' % (request.controller, 
 request.function), 
 description = '%s login failed' % (row.username) )
if row.Attempts >= 3:
redirect(URL('default', 'test') )
else:
redirect(URL('default', 'user/login') )

auth.settings.login_onfail.append(login_attempts)

but when tried to combine with cache and banned ip it's not work (no errors 
occured but the result is not expected)
*e.g. same code like above just a modification on if conditional*
if row.Attempts >= 3:
#BAN_IP_TIME = 60 * 60 * 24 # 1 day
BAN_IP_TIME = 10
ban_key = request.client + 'ban'
if cache.ram(ban_key, lambda: False, BAN_IP_TIME):
raise HTTP(429, 'IP blocked')   


# maximum number of fast requests allowed before banned
MAX_REQUESTS = 3 
request_key = request.client + 'requests'
cache.ram(request_key, lambda: 0, 1)
if cache.ram.increment(request_key) > MAX_REQUESTS:
cache.ram(ban_key, lambda: True, BAN_IP_TIME)
redirect(URL('default', 'test') )

ref:
https://groups.google.com/forum/#!searchin/web2py/Hi$2C$20Is$20there$20a$20way$20to$20block$20ip$20address$20if$20there$20are$20more$20no$20of$20requests$20from$20the$20same$20ip$20address%7Csort:relevance/web2py/5OIz8Quu6KY/1JyItKwpsE8J

any idea how to achieve it using web2py?

thanks and best regards,
stifan

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread Anthony
Why are you bothering with the cache given that you're already tracking 
login attempts in the auth_user table?

On Wednesday, April 22, 2015 at 9:52:34 PM UTC-4, 黄祥 wrote:
>
> pardon me, still not understood what do you mean with the cache. on my 
> example above yet, i still not sure which one to use, yet your hints, quite 
> clear about database. thank you anthony.
> *e.g. work fine*
> *models/db.py*
> auth = Auth(db)
>
> auth.settings.extra_fields['auth_user']= [
>   Field('Attempts', 'integer') ]
>
> auth.define_tables(username=True, signature=False)
>
> def login_attempts(form):
> username = request.vars.username
> row = db((db.auth_user.username == username ) ).select().first()
> if row is not None:
> db(db.auth_user.id == row.id).update(Attempts = row.Attempts + 1)
> db.auth_event.insert(time_stamp = request.now, 
>  client_ip = request.client, 
>  user_id = row.id, 
>  origin = '%s/%s' % (request.controller, 
>  request.function), 
>  description = '%s login failed' % (row.username) )
> if row.Attempts >= 3:
> redirect(URL('default', 'test') )
> else:
> redirect(URL('default', 'user/login') )
>
> auth.settings.login_onfail.append(login_attempts)
>
> but when tried to combine with cache and banned ip it's not work (no 
> errors occured but the result is not expected)
> *e.g. same code like above just a modification on if conditional*
> if row.Attempts >= 3:
> #BAN_IP_TIME = 60 * 60 * 24 # 1 day
> BAN_IP_TIME = 10
> ban_key = request.client + 'ban'
> if cache.ram(ban_key, lambda: False, BAN_IP_TIME):
> raise HTTP(429, 'IP blocked') 
>   
>
> # maximum number of fast requests allowed before banned
> MAX_REQUESTS = 3 
> request_key = request.client + 'requests'
> cache.ram(request_key, lambda: 0, 1)
> if cache.ram.increment(request_key) > MAX_REQUESTS:
> cache.ram(ban_key, lambda: True, BAN_IP_TIME)
> redirect(URL('default', 'test') )
>
> ref:
>
> https://groups.google.com/forum/#!searchin/web2py/Hi$2C$20Is$20there$20a$20way$20to$20block$20ip$20address$20if$20there$20are$20more$20no$20of$20requests$20from$20the$20same$20ip$20address%7Csort:relevance/web2py/5OIz8Quu6KY/1JyItKwpsE8J
>
> any idea how to achieve it using web2py?
>
> thanks and best regards,
> stifan
>

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Re: Failed login attempt lockout

2015-04-22 Thread 黄祥
the idea is taken from wordpress plugin 'limit login attempts' that i want 
to achieve using web2py.
first, create record in database table, when user login failed.
after that, banned the ip address user for several time (e.g. 1 min) if the 
user attempt login is reached the limit (e.g. 3 times) during the banned 
period, user tried to access got redirect to another page. after the banned 
time is expired, the database reset the attempts record in database to 0, 
so that user can't be access the login page.

how to achieve it using web2py?

thanks and best regards,
stifan

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Debugging auth permissions

2015-04-22 Thread Chris Guest
Here is a block of code that I added to the views/default/user.html 
template of my application in order to debug a permission issue.

I am posting it here the hope that it is useful to others.


{{  
if request.args(0)=='not_authorized':
groups = db(db.auth_membership.user_id == 
auth.user.id).select(db.auth_membership.group_id)
group_ids = [group.group_id for group in groups]
group_details = 
db(db.auth_group.id.belongs(group_ids)).select(db.auth_group.id, 
db.auth_group.role)

rows = db.executesql('SELECT group_id, name, table_name, record_id FROM 
auth_permission ORDER BY group_id', as_dict=True)

}}
User groups:

{{for group in group_details:}}
{{=group['id']}}: {{=group['role']}}

{{for row in rows:
if row['group_id']!= group['id']: continue}}
{{=row['name']}} {{=row['table_name']}}
{{pass}}

{{pass}}

{{  
pass
}}

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: New error in trunk' s sqlhtml.py: AttributeError: 'SQLCustomType' object has no attribute 'represent'

2015-04-22 Thread Johann Spies
Git pull says my code is up-to-date.

Isn't pydal to be part of web2py?  How do I update that separately?

Regards.
Johann

On 22 April 2015 at 22:31, Paolo Valleri  wrote:

> Hi, this it should have been fixed
> Have you tried with the last trunk? Be sure to update pydal too.
>
> Paolo
>
>
> On Wednesday, April 22, 2015 at 1:00:04 PM UTC+2, Johann Spies wrote:
>>
>> This code work without a problem in
>>  Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
>>
>> but not with the code from the trunk:
>>
>> def za_arts_by_journal_by_year():
>>
>> db.define_table('za_wos_papers_by_journal_by_year',
>> Field('journal', type=citext),
>> Field('pubyear', 'integer'),
>> Field('articles', 'integer'),
>> migrate = False,
>> rname = 'isi.za_wos_papers_by_journal_by_year')
>> grid = SQLFORM.grid(db.za_wos_papers_by_journal_by_year,
>>
>> fields=[db.za_wos_papers_by_journal_by_year.journal,
>>
>> db.za_wos_papers_by_journal_by_year.pubyear,
>>
>> db.za_wos_papers_by_journal_by_year.articles],
>> create = False,
>> editable = False,
>> details = False,
>> deletable = False,
>> searchable = False,
>> maxtextlength= 200,
>> paginate=120,
>>
>> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
>> grid.element('.web2py_counter',replace=None)
>>
>> where "orderby" is on line 391.
>>
>> The error:
>>
>> Traceback (most recent call last):
>>   File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
>> exec ccode in environment
>>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
>> ,
>>  line 818, in 
>>   File "/home/js/web2py/gluon/globals.py", line 393, in 
>> self._caller = lambda f: f()
>>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
>> ,
>>  line 391, in za_arts_by_journal_by_year
>> 
>> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
>>   File "/home/js/web2py/gluon/sqlhtml.py", line 2720, in grid
>> elif isinstance(field.type, SQLCustomType) and 
>> callable(field.type.represent):
>> AttributeError: 'SQLCustomType' object has no attribute 'represent'
>>
>>
>> I did know how to create an issue on the mercurial trunk but I am not
>> sure about the git repository.  What is the url again?
>>
>> Regards
>> Johann
>> --
>> Because experiencing your loyal love is better than life itself,
>> my lips will praise you.  (Psalm 63:3)
>>
>  --
> 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 the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: New error in trunk' s sqlhtml.py: AttributeError: 'SQLCustomType' object has no attribute 'represent'

2015-04-22 Thread Johann Spies
Apologies for my previous email.  I have read the README again and saw I
had to do a "git submodule update --init --recursive". Now it is working.

Where are the days when I could just do a "hg pull; hg update". :)

Regards
Johann

On 23 April 2015 at 08:47, Johann Spies  wrote:

> Git pull says my code is up-to-date.
>
> Isn't pydal to be part of web2py?  How do I update that separately?
>
> Regards.
> Johann
>
> On 22 April 2015 at 22:31, Paolo Valleri  wrote:
>
>> Hi, this it should have been fixed
>> Have you tried with the last trunk? Be sure to update pydal too.
>>
>> Paolo
>>
>>
>> On Wednesday, April 22, 2015 at 1:00:04 PM UTC+2, Johann Spies wrote:
>>>
>>> This code work without a problem in
>>>  Version 2.9.12-stable+timestamp.2015.01.17.06.11.03
>>>
>>> but not with the code from the trunk:
>>>
>>> def za_arts_by_journal_by_year():
>>>
>>> db.define_table('za_wos_papers_by_journal_by_year',
>>> Field('journal', type=citext),
>>> Field('pubyear', 'integer'),
>>> Field('articles', 'integer'),
>>> migrate = False,
>>> rname = 'isi.za_wos_papers_by_journal_by_year')
>>> grid = SQLFORM.grid(db.za_wos_papers_by_journal_by_year,
>>>
>>> fields=[db.za_wos_papers_by_journal_by_year.journal,
>>>
>>> db.za_wos_papers_by_journal_by_year.pubyear,
>>>
>>> db.za_wos_papers_by_journal_by_year.articles],
>>> create = False,
>>> editable = False,
>>> details = False,
>>> deletable = False,
>>> searchable = False,
>>> maxtextlength= 200,
>>> paginate=120,
>>>
>>> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
>>> grid.element('.web2py_counter',replace=None)
>>>
>>> where "orderby" is on line 391.
>>>
>>> The error:
>>>
>>> Traceback (most recent call last):
>>>   File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
>>> exec ccode in environment
>>>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
>>> ,
>>>  line 818, in 
>>>   File "/home/js/web2py/gluon/globals.py", line 393, in 
>>> self._caller = lambda f: f()
>>>   File "/home/js/web2py/applications/nkb/controllers/wos_indicators.py" 
>>> ,
>>>  line 391, in za_arts_by_journal_by_year
>>> 
>>> orderby=~db.za_wos_papers_by_journal_by_year.pubyear|~db.za_wos_papers_by_journal_by_year.articles)
>>>   File "/home/js/web2py/gluon/sqlhtml.py", line 2720, in grid
>>> elif isinstance(field.type, SQLCustomType) and 
>>> callable(field.type.represent):
>>> AttributeError: 'SQLCustomType' object has no attribute 'represent'
>>>
>>>
>>> I did know how to create an issue on the mercurial trunk but I am not
>>> sure about the git repository.  What is the url again?
>>>
>>> Regards
>>> Johann
>>> --
>>> Because experiencing your loyal love is better than life itself,
>>> my lips will praise you.  (Psalm 63:3)
>>>
>>  --
>> 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 the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Because experiencing your loyal love is better than life itself,
> my lips will praise you.  (Psalm 63:3)
>



-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)

-- 
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 the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.