[web2py] Re: run-time test if DAL field allows None, null, or empty

2017-03-07 Thread lucas
maybe this can be added to the Fields object as a property in the future. 
 thanx Anthony.   Lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to 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] Query auth_user over first and last names in one query

2017-03-07 Thread Jim S
Hi

I have a search form where the user types in generic search text.  I want 
to be able to return to them a list of matching users.

Sample Data

  First   Last
- --  --
1 Jim Sanders
2 BillVan Der Wall
3 JohnSt James
4 Peter   Williams
5 Jim Hensen
6 JohnAdams
7 William Tell
8 AdamJohnson
 

Based on the data entered in the search box, these records should be 
returned

  
  Search Text  Rows Returned
-  --
1 Jim  1, 5
2 John 3, 6, 8
3 Adam 6, 8
4 Bill 2
5 Jim Sanders  1
6 Adam John8
7 John St James3
 

I can't seem to come up with a query or anything to make this happen.  With 
SQL I might to this:

'SELECT * FROM auth_user WHERE first_name LIKE \'%s*\' OR last_name LIKE 
\'%s*\' OR concat(first_name, ' ', last_name) LIKE \'%s*\'' % (search_text, 
search_text, search_text)

But, I want to build this as a query for SQLFORM.grid.  

Anyone have any ideas?

-Jim

-- 
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: run-time test if DAL field allows None, null, or empty

2017-03-07 Thread Anthony
Maybe something like this:

def allows_none(field):
from pydal._globals import DEFAULT
requires = field.requires if field.requires and field.requires != 
DEFAULT else []
requires = requires if isinstance(requires, list) else [requires]
return not any(validator(None)[1] != None for validator in requires)

Then simply check via:

allows_none(db.mytable.myfield)

Note, the above only checks validators -- if you also want to check for the 
"notnull" or "required" attributes, you can add those checks to the 
function. It also only checks for the specific value None -- you could 
extend it to check for empty strings (and possibly empty lists in the case 
of list:-type fields) as well.

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] KeyError ticket when I request a CSV/TSV in a grid with a Virtual Field

2017-03-07 Thread Marcelo Huerta
Running 2.14.6-stable+timestamp.2016.05.10.00.21.47 on Ubuntu and Windows 
7, python 2.7

When I try to generate a CSV or TSV from a grid with a Virtual Field, I get 
a ticket with a KeyError.

Traceback (most recent call last):
  File "F:\Prog\web2py\gluon\restricted.py", line 227, in restricted
exec ccode in environment
  File "F:\Prog\web2py\applications\axxoneval\controllers/default.py", line 
447, in 
  File "F:\Prog\web2py\gluon\globals.py", line 417, in 
self._caller = lambda f: f()
  File "F:\Prog\web2py\gluon\tools.py", line 4250, in f
return action(*a, **b)
  File "F:\Prog\web2py\applications\axxoneval\controllers/default.py", line 
199, in listar_evaluaciones
csv = True, create = False, editable = False, deletable = True, 
searchable=True, details=False,
  File "F:\Prog\web2py\gluon\sqlhtml.py", line 2752, in grid
value = row[str(field)]
  File "F:\Prog\web2py\gluon\packages\dal\pydal\objects.py", line 76, in 
__getitem__
raise KeyError
KeyError

Is this a known problem?

-- 
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] eclipse+pydev breakpoint not work with the latest cloned web2py

2017-03-07 Thread Yibing Liu
My computer is win7 x64. I am using eclipse(4.6.2) ,pydev(5.5.0), 
python(2.7.13) and the web2py latest cloned from the github. Compared with 
the 2.14.6 stable version web2py, the latest cloned web2py has many 
additonal files which I guess may be used for compiling and debugging. 
However when I debug my application which based on the latest cloned 
web2py, the breakpoint I set in my controller/default/index not stop. Only 
the breakpoint in the web2py.py can work. This is very confusing. So I 
change the web2py to the 2.14.6 stable version and the breakpoint is ok. 
What should I do with the latest cloned web2py to make the breakpoint work 
under the eclipse+pydev?

-- 
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] run-time test if DAL field allows None, null, or empty

2017-03-07 Thread lucas
ok everyone, what is the method to test if a field under a table allows for 
None, or requires a real value.  like

isinstance(table name[fieldname].requires, IS_EMPTY_OR)

returns True if allows None

but it doesn't always return True when it should.  like when the field is 
only:

Field('name', length=25)

so, I'm looking for a universal solution no matter how the field is defined.

thank you in advanced, Lucas

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to 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: {Disarmed} Re: Re: [web2py] problem with ldap authentication

2017-03-07 Thread Richard Vézina
Hello Carlos,

You can try to make simple bind with python ldap lib first, make sure user,
base_dn is good, you will get more feedback then with ldap_auth

Depending of the ldap server implementation that you try to reach you may
fall on ldap_auth issue as not all part of the ldap_auth is well testing I
guess, there is comment in the code saying that, so...

Do you connect to Active Directory? open_ldap... Is the LDAP server
properly configure if you use to put open_ldap in place by yourself for
instance, are you able to use LDAP for authentication with other software
solution??

Richard

On Tue, Mar 7, 2017 at 11:50 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> No, the ldap server is not protected by ssl.
>
> Greetings.
>
>
> El 07/03/17 a las 11:42, Richard Vézina escribió:
>
> Is your ldap server protected by ssl? If so you have to think to change
> port...
>
> Richard
>
> On Tue, Mar 7, 2017 at 10:32 AM, Carlos Cesar Caballero Díaz <
> carlos.caball...@cfg.jovenclub.cu> wrote:
>
>> Hi, I am trying to include ldap authentication to my app, and for this, i
>> am using this code:
>>
>> auth.settings.login_methods.append(ldap_auth(
>> mode='uid',
>> server='10.6.xx.xx',
>> base_dn='dc=comp',
>> filterstr='&(objectClass=inetOrgPerson)',
>> logging_level='debug'))
>>
>> (note: The Original server and base_dn values are changed in this
>> example. I also have tried with and without the filterstr option)
>>
>> But I can't login with any ldap user, and the logs only say:
>>
>> DEBUG:web2py.auth.ldap_auth:mode: [uid] manage_user: [False]
>> custom_scope: [subtree] manage_groups: [False]
>> INFO:web2py.auth.ldap_auth:[10.6.28.93] Initialize ldap connection
>>
>> I Debug the ladp_auth module, and for some reason it hangs on the line
>> 314 ( con.simple_bind_s(dn, password)) without throw any error.
>>
>> If it helps, I also have tried this code and works as expected returning
>> the ldap user data:
>>
>> import ldap
>> ldap_server="10.6.xx.xx"
>> username = "auser"
>> base_dn = "dc=comp"
>>
>> query = "(uid=%s)" % username
>> con = ldap.initialize('ldap://'+ldap_server)
>>
>> result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, query)
>> print result
>>
>>
>> Any help or idea?
>>
>> Greetings.
>>
>>
>> --
>> 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 *MailScanner ha detectado un intento de fraude
>> en la siguiente página web "groups.google.com". No confíe en esta página
>> web:* *MailScanner ha detectado un intento de fraude en la siguiente
>> p�gina web "groups.google.com". No conf�e en esta p�gina web:*
>> 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 *MailScanner ha detectado un intento de fraude en
> la siguiente página web "groups.google.com". No confíe en esta página web:* 
> *MailScanner
> ha detectado un intento de fraude en la siguiente p�gina web
> "groups.google.com". No conf�e en esta p�gina web:*
> 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: user-created documentation

2017-03-07 Thread Alex Glaros
thanks Marlysson, 

other than someone having already done something like this, this is about 
as good as answer I can expect, considering such a vague question :-)

Alex

-- 
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.


{Disarmed} Re: Re: [web2py] problem with ldap authentication

2017-03-07 Thread Carlos Cesar Caballero Díaz

No, the ldap server is not protected by ssl.

Greetings.


El 07/03/17 a las 11:42, Richard Vézina escribió:
Is your ldap server protected by ssl? If so you have to think to 
change port...


Richard

On Tue, Mar 7, 2017 at 10:32 AM, Carlos Cesar Caballero Díaz 
> wrote:


Hi, I am trying to include ldap authentication to my app, and for
this, i am using this code:

auth.settings.login_methods.append(ldap_auth(
mode='uid',
server='10.6.xx.xx',
base_dn='dc=comp',
filterstr='&(objectClass=inetOrgPerson)',
logging_level='debug'))

(note: The Original server and base_dn values are changed in this
example. I also have tried with and without the filterstr option)

But I can't login with any ldap user, and the logs only say:

DEBUG:web2py.auth.ldap_auth:mode: [uid] manage_user: [False]
custom_scope: [subtree] manage_groups: [False]
INFO:web2py.auth.ldap_auth:[10.6.28.93] Initialize ldap connection

I Debug the ladp_auth module, and for some reason it hangs on the
line 314 ( con.simple_bind_s(dn, password)) without throw any error.

If it helps, I also have tried this code and works as expected
returning the ldap user data:

import ldap
ldap_server="10.6.xx.xx"
username = "auser"
base_dn = "dc=comp"

query = "(uid=%s)" % username
con = ldap.initialize('ldap://'+ldap_server)

result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, query)
print result


Any help or idea?

Greetings.


-- 
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 *MailScanner ha detectado un intento de
fraude en la siguiente p�gina web "groups.google.com". /No/ conf�e
en esta p�gina web:* 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 *MailScanner ha detectado un intento de fraude 
en la siguiente p�gina web "groups.google.com". /No/ conf�e en esta 
p�gina web:* 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] problem with ldap authentication

2017-03-07 Thread Richard Vézina
Is your ldap server protected by ssl? If so you have to think to change
port...

Richard

On Tue, Mar 7, 2017 at 10:32 AM, Carlos Cesar Caballero Díaz <
carlos.caball...@cfg.jovenclub.cu> wrote:

> Hi, I am trying to include ldap authentication to my app, and for this, i
> am using this code:
>
> auth.settings.login_methods.append(ldap_auth(
> mode='uid',
> server='10.6.xx.xx',
> base_dn='dc=comp',
> filterstr='&(objectClass=inetOrgPerson)',
> logging_level='debug'))
>
> (note: The Original server and base_dn values are changed in this example.
> I also have tried with and without the filterstr option)
>
> But I can't login with any ldap user, and the logs only say:
>
> DEBUG:web2py.auth.ldap_auth:mode: [uid] manage_user: [False]
> custom_scope: [subtree] manage_groups: [False]
> INFO:web2py.auth.ldap_auth:[10.6.28.93] Initialize ldap connection
>
> I Debug the ladp_auth module, and for some reason it hangs on the line 314
> ( con.simple_bind_s(dn, password)) without throw any error.
>
> If it helps, I also have tried this code and works as expected returning
> the ldap user data:
>
> import ldap
> ldap_server="10.6.xx.xx"
> username = "auser"
> base_dn = "dc=comp"
>
> query = "(uid=%s)" % username
> con = ldap.initialize('ldap://'+ldap_server)
>
> result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, query)
> print result
>
>
> Any help or idea?
>
> Greetings.
>
>
> --
> 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: limitby question

2017-03-07 Thread Richard Vézina
Thanks for exploring this Anthony,

Yes, I guess having .limit() and .offset() would make it easier to use
constant limit value like 10 records and just manipulate the offset...

I was just at first thinking that limitby=(limit, offset) or
limitby=(offset, limit), I mean I intuitivelly want it to be like that,
even if I had use limitby in the past, I use it for get last record for
instance and never think about it much, I did just find how I can get the
last result, and I was find with that, but now I am trying to feed an
infinite scroll select html input and were needing to ajax get 10-20
records at a time to do so, and I at first was confused by limitby until I
step back...

What confuse me the most at first was that my limitby parameters was
alterated when I pass (10, 0) for instance to get the first 10 record
(think limit, offset here) and get select with limit -10 and offset 10 or
something like that...

Anyway thanks for being so helpful.

Richard

On Tue, Mar 7, 2017 at 10:29 AM, Anthony  wrote:

> For what it's worth, the Django ORM uses Python array slicing syntax
> (i.e., [start:stop]) to implement limit/offset, and SQLAlchemy uses
> .slice(start, stop) (though it also offers separate .limit() and .offset()
> methods). I don't think it is common to have a single argument of the form
> (limit, offset).
>
> Anthony
>
>
> On Tuesday, March 7, 2017 at 10:22:25 AM UTC-5, Anthony wrote:
>>
>> On Tuesday, March 7, 2017 at 9:20:53 AM UTC-5, Richard wrote:
>>>
>>> Yes sorry it was more of a complaint than a question
>>>
>>> :)
>>>
>>> I was disturbed by the fact that I can't leave the limit constant, like
>>> 10 rows, and only manipulate the offset as I would do in sql...
>>>
>>
>> It sounds like you want something like:
>>
>> LIMIT = 10
>> offset = request.vars.offset
>> rows = db(query).select(..., limitby=(LIMIT, offset))
>>
>> But that isn't really much simpler than the actual DAL API, which is:
>>
>> rows = db(query).select(..., limitby=(offset, offset + LIMIT))
>>
>> What is the big difficulty with the above?
>>
>> I'm not sure why the DAL uses (min, max) rather than (limit, offset), but
>> I suspect the reason is that (min, max) is clearer when combining both
>> values into a single parameter using a tuple. With a single tuple of
>> values, it is natural for the first to be the min and the second the max,
>> but the ordering of limit and offset would be somewhat arbitrary and open
>> to confusion. If we wanted the API to accept a limit and an offset, it
>> would probably be more clear to make those separate arguments.
>>
>> Anyway, if it really bothers you, you can define a simple function:
>>
>> def mylim(limit, offset):
>> return (offset, offset + limit)
>>
>> and use:
>>
>> limitby=mylim(limit, offset)
>>
>> 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.
>

-- 
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: Python web2py console

2017-03-07 Thread Paul Ellis
Hey Marlysson,

This command doesn't work. But thanks for your time to try to help.

Anthony has told me the correct command is:

web2py.exe -S your_application -M

Cheers

On Mon, Mar 6, 2017 at 3:46 PM, Marlysson Silva 
wrote:

> python web2py.exe -S your_application -M
>
> Em segunda-feira, 6 de março de 2017 11:14:53 UTC-3, Paul Ellis escreveu:
>>
>> Yes. I want an interactive shell with my application loaded.
>>
>> I know I can run a 'Test' page with output to the console, but it would
>> be much easier (and I know possible) if I could use an interactive shell.
>>
>> I have seen Massimo using it in his videos. But I can' t get the command
>> to work.
>>
>> On Mon, Mar 6, 2017 at 2:36 PM, Marlysson Silva 
>> wrote:
>>
>>> Try just double click in web2py.exe , it open a server in a screen.
>>>
>>> Or are you trying accessing models of application via shell?
>>>
>>> Em segunda-feira, 6 de março de 2017 09:14:34 UTC-3, Paul Ellis escreveu:
>>>
 Hello,

 I know this question has been asked before, but didn't solve the
 problem for me.

 I am using Windows 10 and web2py binary and have replaced web2py.py
 with web2py.exe in the command python web2py.py -s [applicaiton] -m and am
 getting this error:

 python web2py.exe -s [application] -m
 SyntaxError: Non-ASCII character '\x90' in file web2py.exe on line 1,
 but no encoding declared; see http://python.org/dev/peps/pep-0263/ for
 details

 I have also tried:
 python web2py.exe

 e:\web2py\py web2py.exe
 this gives a traceback, but the same error:
 Traceback (most recent call last):
   File "", line 6, in 
   File "__main__.py", line 126, in 
   File "__main__py__.py", line 60, in 
   File "web2py.exe", line 1
 SyntaxError: Non-ASCII character '\x90' in file web2py.exe on line 1,
 but no encoding declared; see http://python.org/dev/peps/pep-0263/ for
 details

 What am I doing wrong?

 Cheers

>>> --
>>> 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 a topic in the
>>> Google Groups "web2py-users" group.
>>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>>> pic/web2py/T1OH6haDHHM/unsubscribe.
>>> To unsubscribe from this group and all its topics, 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/T1OH6haDHHM/unsubscribe.
> To unsubscribe from this group and all its topics, 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: Python web2py console

2017-03-07 Thread Paul Ellis
Thank you. That works.

I used the binary in the beginning, simply because I was so new and it
seemed the simplest way forwards.

Maybe it's time to switch to the source version.

On Mon, Mar 6, 2017 at 4:51 PM, Anthony  wrote:

> If using the Windows binary, the .exe file includes the Python
> interpreter, so you don't run it using your system's installed Python.
> Instead, it would be:
>
> web2py.exe -S application -M
>
> Also, note that S and M are capitalized.
>
> Anyway, the point of the binary .exe file is for systems that do not have
> Python installed. If you have Python installed, it would be preferable to
> just use the source version of web2py -- don't bother with the .exe version.
>
> Anthony
>
>
> On Monday, March 6, 2017 at 7:14:34 AM UTC-5, Paul Ellis wrote:
>>
>> Hello,
>>
>> I know this question has been asked before, but didn't solve the problem
>> for me.
>>
>> I am using Windows 10 and web2py binary and have replaced web2py.py with
>> web2py.exe in the command python web2py.py -s [applicaiton] -m and am
>> getting this error:
>>
>> python web2py.exe -s [application] -m
>> SyntaxError: Non-ASCII character '\x90' in file web2py.exe on line 1, but
>> no encoding declared; see http://python.org/dev/peps/pep-0263/ for
>> details
>>
>> I have also tried:
>> python web2py.exe
>>
>> e:\web2py\py web2py.exe
>> this gives a traceback, but the same error:
>> Traceback (most recent call last):
>>   File "", line 6, in 
>>   File "__main__.py", line 126, in 
>>   File "__main__py__.py", line 60, in 
>>   File "web2py.exe", line 1
>> SyntaxError: Non-ASCII character '\x90' in file web2py.exe on line 1, but
>> no encoding declared; see http://python.org/dev/peps/pep-0263/ for
>> details
>>
>> What am I doing wrong?
>>
>> Cheers
>>
> --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/web2py/T1OH6haDHHM/unsubscribe.
> To unsubscribe from this group and all its topics, 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] problem with ldap authentication

2017-03-07 Thread Carlos Cesar Caballero Díaz
Hi, I am trying to include ldap authentication to my app, and for this, 
i am using this code:


auth.settings.login_methods.append(ldap_auth(
mode='uid',
server='10.6.xx.xx',
base_dn='dc=comp',
filterstr='&(objectClass=inetOrgPerson)',
logging_level='debug'))

(note: The Original server and base_dn values are changed in this 
example. I also have tried with and without the filterstr option)


But I can't login with any ldap user, and the logs only say:

DEBUG:web2py.auth.ldap_auth:mode: [uid] manage_user: [False] 
custom_scope: [subtree] manage_groups: [False]

INFO:web2py.auth.ldap_auth:[10.6.28.93] Initialize ldap connection

I Debug the ladp_auth module, and for some reason it hangs on the line 
314 ( con.simple_bind_s(dn, password)) without throw any error.


If it helps, I also have tried this code and works as expected returning 
the ldap user data:


import ldap
ldap_server="10.6.xx.xx"
username = "auser"
base_dn = "dc=comp"

query = "(uid=%s)" % username
con = ldap.initialize('ldap://'+ldap_server)

result = con.search_s(base_dn, ldap.SCOPE_SUBTREE, query)
print result


Any help or idea?

Greetings.


--
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: limitby question

2017-03-07 Thread Anthony
For what it's worth, the Django ORM uses Python array slicing syntax (i.e., 
[start:stop]) to implement limit/offset, and SQLAlchemy uses .slice(start, 
stop) (though it also offers separate .limit() and .offset() methods). I 
don't think it is common to have a single argument of the form (limit, 
offset).

Anthony

On Tuesday, March 7, 2017 at 10:22:25 AM UTC-5, Anthony wrote:
>
> On Tuesday, March 7, 2017 at 9:20:53 AM UTC-5, Richard wrote:
>>
>> Yes sorry it was more of a complaint than a question
>>
>> :)
>>
>> I was disturbed by the fact that I can't leave the limit constant, like 
>> 10 rows, and only manipulate the offset as I would do in sql...
>>
>
> It sounds like you want something like:
>
> LIMIT = 10
> offset = request.vars.offset
> rows = db(query).select(..., limitby=(LIMIT, offset))
>
> But that isn't really much simpler than the actual DAL API, which is:
>
> rows = db(query).select(..., limitby=(offset, offset + LIMIT))
>
> What is the big difficulty with the above?
>
> I'm not sure why the DAL uses (min, max) rather than (limit, offset), but 
> I suspect the reason is that (min, max) is clearer when combining both 
> values into a single parameter using a tuple. With a single tuple of 
> values, it is natural for the first to be the min and the second the max, 
> but the ordering of limit and offset would be somewhat arbitrary and open 
> to confusion. If we wanted the API to accept a limit and an offset, it 
> would probably be more clear to make those separate arguments.
>
> Anyway, if it really bothers you, you can define a simple function:
>
> def mylim(limit, offset):
> return (offset, offset + limit)
>
> and use:
>
> limitby=mylim(limit, offset)
>
> 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.


Re: [web2py] Re: limitby question

2017-03-07 Thread Anthony
On Tuesday, March 7, 2017 at 9:20:53 AM UTC-5, Richard wrote:
>
> Yes sorry it was more of a complaint than a question
>
> :)
>
> I was disturbed by the fact that I can't leave the limit constant, like 10 
> rows, and only manipulate the offset as I would do in sql...
>

It sounds like you want something like:

LIMIT = 10
offset = request.vars.offset
rows = db(query).select(..., limitby=(LIMIT, offset))

But that isn't really much simpler than the actual DAL API, which is:

rows = db(query).select(..., limitby=(offset, offset + LIMIT))

What is the big difficulty with the above?

I'm not sure why the DAL uses (min, max) rather than (limit, offset), but I 
suspect the reason is that (min, max) is clearer when combining both values 
into a single parameter using a tuple. With a single tuple of values, it is 
natural for the first to be the min and the second the max, but the 
ordering of limit and offset would be somewhat arbitrary and open to 
confusion. If we wanted the API to accept a limit and an offset, it would 
probably be more clear to make those separate arguments.

Anyway, if it really bothers you, you can define a simple function:

def mylim(limit, offset):
return (offset, offset + limit)

and use:

limitby=mylim(limit, offset)

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.


{Disarmed} Re: [web2py] Re: ajax_trap=False behavior on ajax loaded component

2017-03-07 Thread Carlos Cesar Caballero Díaz

Many thanks Anthony, it just works.

Greetings.

El 06/03/17 a las 20:55, Anthony escribió:

|

[web2py] Re: pythonanywhere configuration domain web2py application

2017-03-07 Thread Alessio Varalta
Thanks work

On Tuesday, 7 March 2017 13:24:18 UTC+1, Jim S wrote:
>
> Host should be www.asdbluestars-bz.it.
>
> -Jim
>
> On Tuesday, March 7, 2017 at 4:23:10 AM UTC-6, Alessio Varalta wrote:
>>
>> Thanks, for the reply. Yes, I make this operation now on pythonanywhere I 
>> go to Web tab and rename to www.asdbluestars-bz.it 
>> 
>>   
>>
>>
>> 
>>
>>
>> after this operation I have new field 
>>
>> DNS setup:
>>
>> How to point your domain at your website. 
>>
>>
>> CNAME:
>>
>> value_cname
>>
>>
>> My problem now is on aruba. I go to manage dns and record cname section 
>> where I have two field Host and name Cname but I don't know of compile 
>> these fieldsName Cname is webapp-xx.pythonanywhere.com but host?
>>
>>
>>
>> 
>>
>>   
>>
>> On Tuesday, 7 March 2017 04:09:24 UTC+1, Jim S wrote:
>>>
>>> Login to your pythonanywhere account.  Click on the Web tab.
>>>
>>> Click on your web app on the left.
>>>
>>> It should show you something like this:
>>>
>>> DNS setup:
>>> How to point your domain at your website.
>>>
>>>
>>> CNAME: webapp-xx.pythonanywhere.com
>>>
>>> where xx is a 6 digit number.
>>>
>>> Go to you DNS setup with your registrar and create a CNAME record 
>>> pointing your domain, www.asdbluestars-bz.it to the cname entry from 
>>> pythonanywhere.
>>>
>>> Make sense?
>>>
>>> -Jim
>>>
>>>
>>>
>>> On Monday, March 6, 2017 at 4:22:26 PM UTC-6, Alessio Varalta wrote:

 Hi, I have buy a domain on aruba and paid account on pythonanywhere.

 My domain is www.asdbluestars-bz.it
 My application run on https://alessiovic.pythonanywhere.com/bluestars/
 So I rename in Web of pythonanywhere the application like 
 www.asdbluestars-bz.it and after i see a new field

 Dns setup How to point your domain at your website. CNAME cname_value

 But now? I go to aruba and in manage domain and in Record CName 
 section.

 Now i can add new cname and i have two field 

 Host
 Cname

 I suppose host is Cname cname_value of pythonanywhere and cname is 
 www.asdbluestars-bz.it

 :

>>>

-- 
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: limitby question

2017-03-07 Thread Richard Vézina
Yes sorry it was more of a complaint than a question

:)

I was disturbed by the fact that I can't leave the limit constant, like 10
rows, and only manipulate the offset as I would do in sql... Then I reread
the book and understand min, max, but I am not sure I see the advantage...
And I found confusing that limitby is more an offset parameter then a
limit... I am not aware of all different backend implementation of paging
and limitby may make more sens in the big picture... And I guess it make
sens to have a particular method limitby which is not a perfect map of sql
limit and offset...

If I got time, I will have look if we can some how have a limit and offset
methods also, that would translate litteraly into their sql counter part to
make it more intuitive and send a PR to the pyDAL and will see if it get
included.

Richard

On Mon, Mar 6, 2017 at 9:32 PM, Dave S  wrote:

>
>
> On Monday, March 6, 2017 at 5:50:05 PM UTC-8, Anthony wrote:
>>
>> What is your question? If you want to do an offset, you need two numbers
>> -- either the two endpoints of the interval or one endpoint plus the size
>> of the interval. Whichever pair of numbers you have, it is a single
>> arithmetic operation to get the alternative pair. It might help if you
>> explain what two numbers you would prefer to work with and where you are
>> getting them.
>>
>> Anthony
>>
>
> Is the issue perhaps cognitive dissonance caused by "min" and "max" being
> different from Richard's concept of "offset"?  I can see that if you're
> used to applying min and max to the* values*, you might be disturbed by
> applying them to the *indices*.
>
> /dps
>
>
>> On Monday, March 6, 2017 at 4:11:52 PM UTC-5, Richard wrote:
>>>
>>> Hello,
>>>
>>> I may not understanding something... I am desapointed that I can't
>>> simply manipulate offset of the sql... Or should I just manipulate the
>>> limit...
>>>
>>> I mean if I do repetitively thise query in sql :
>>>
>>> select * form table order by desc limit 10 offset 0
>>> select * form table order by desc limit 10 offset 10
>>> select * form table order by desc limit 10 offset 20
>>> select * form table order by desc limit 10 offset 30
>>>
>>> I will get progressively all the records from the table 10 at a time...
>>>
>>> But I can't simply do it with this query :
>>>
>>> rows = db((db.table.id > 0)
>>>   ).select(db.table.id, db.table.represent_field,
>>>orderby=~db.table.id,
>>>limitby=(10, offset if offset else 0))
>>>
>>> Reading the book there seems to have planty of backend that don't
>>> support paging with limit and offset properly...
>>>
>>> But still I find it frustrasting to have to struggle with the DAL and
>>> have to provide min and max for the offset to a limitby function which
>>> isn't a limit but an offset in reallity...
>>>
>>> I solve it with this :
>>>
>>> offset = request.vars.limit_by
>>> if offset not in ('None', '', None) and offset.isdigit():
>>> offset = int(offset)
>>> min = offset - 10
>>> max = offset
>>> else:
>>> offset = None
>>> min = 0
>>> max = 10
>>>
>>> rows = db((db.table.id > 0)
>>>   ).select(db.table.id, db.table.represent_field,
>>>orderby=~db.table.id,
>>>limitby=(min, max))
>>>
>>>
>>> Richard
>>>
>>>
>>> --
> 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: Custom form errors?

2017-03-07 Thread Anthony


> I tried putting the functions you mentioned in the process and validate 
> method in the "user" function, but still no luck.
>

If you're talking about the default user() function, then you should have 
something like form=auth(), in which case, you cannot use the .process() or 
.validate() method, as auth() already handles that. If you want to add 
callbacks to the auth() form processing, you must do so via the various 
auth.settings options.

In any case, though, you can still access the errors as usual, as auth() 
returns a processed SQLFORM object:

form = auth()
errors = form.errors

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: Custom form errors?

2017-03-07 Thread Anthony
On Tuesday, March 7, 2017 at 1:34:31 AM UTC-5, LoveWeb2py wrote:
>
> If I'm reading this correctly: 
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors
>

I was just pointing that out to show how to access the errors -- you can 
certainly do so in the controller.

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: pythonanywhere configuration domain web2py application

2017-03-07 Thread Jim S
Host should be www.asdbluestars-bz.it.

-Jim

On Tuesday, March 7, 2017 at 4:23:10 AM UTC-6, Alessio Varalta wrote:
>
> Thanks, for the reply. Yes, I make this operation now on pythonanywhere I 
> go to Web tab and rename to www.asdbluestars-bz.it 
> 
>   
>
>
> 
>
>
> after this operation I have new field 
>
> DNS setup:
>
> How to point your domain at your website. 
>
>
> CNAME:
>
> value_cname
>
>
> My problem now is on aruba. I go to manage dns and record cname section 
> where I have two field Host and name Cname but I don't know of compile 
> these fieldsName Cname is webapp-xx.pythonanywhere.com but host?
>
>
>
> 
>
>   
>
> On Tuesday, 7 March 2017 04:09:24 UTC+1, Jim S wrote:
>>
>> Login to your pythonanywhere account.  Click on the Web tab.
>>
>> Click on your web app on the left.
>>
>> It should show you something like this:
>>
>> DNS setup:
>> How to point your domain at your website.
>>
>>
>> CNAME: webapp-xx.pythonanywhere.com
>>
>> where xx is a 6 digit number.
>>
>> Go to you DNS setup with your registrar and create a CNAME record 
>> pointing your domain, www.asdbluestars-bz.it to the cname entry from 
>> pythonanywhere.
>>
>> Make sense?
>>
>> -Jim
>>
>>
>>
>> On Monday, March 6, 2017 at 4:22:26 PM UTC-6, Alessio Varalta wrote:
>>>
>>> Hi, I have buy a domain on aruba and paid account on pythonanywhere.
>>>
>>> My domain is www.asdbluestars-bz.it
>>> My application run on https://alessiovic.pythonanywhere.com/bluestars/
>>> So I rename in Web of pythonanywhere the application like 
>>> www.asdbluestars-bz.it and after i see a new field
>>>
>>> Dns setup How to point your domain at your website. CNAME cname_value
>>>
>>> But now? I go to aruba and in manage domain and in Record CName section.
>>>
>>> Now i can add new cname and i have two field 
>>>
>>> Host
>>> Cname
>>>
>>> I suppose host is Cname cname_value of pythonanywhere and cname is 
>>> www.asdbluestars-bz.it
>>>
>>> :
>>>
>>

-- 
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: user-created documentation

2017-03-07 Thread Marlysson Silva
As a google docs collaborative?

Em terça-feira, 7 de março de 2017 04:33:45 UTC-3, Alex Glaros escreveu:
>
> I built a quick and dirty user-created documentation system where for each 
> topic, there is 1:M stakeholder-perspective content.
>
> Am asking the group if there might be a little less-dirty, less quick 
> method.
>
> Here is what currently exists:
>
> Example, for inventory system documentation there is for each topic, 
> documentation for these stakeholders:
> 1. business side documentation
> 2. programmer documentation
> 3. database administration documentation
> 4. architecture documentation
>
> It works okay with text fields containing the documentation. E.g.,
>
> TOPIC_TABLE
> 1. title (how to enter inventory data)
>
> STAKEHOLDER_TABLE
> 1. topic_ID  (1)
> 2. stakeholder_type_ID (database administrator)
> 3. content (text field, displayed with "pre" tag)
>
> The goal is to promote collaboration between business side, tech side by 
> having the content for a topic laid out by stakeholder perspective, side-by 
> side.
>
> Just wondering if there are any ideas to improve this without requiring 
> users to learn Sphinx or more complicated methods.
>
> 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.


[web2py] Re: pythonanywhere configuration domain web2py application

2017-03-07 Thread Alessio Varalta
Yes, I make this operation now on pythonanywhere I go to Web tab and rename 
to www.asdbluestars-bz.it 

  




after this operation I have new field 

DNS setup:

How to point your domain at your website. 


CNAME:

value_cname


My problem now is on aruba where I have two field Host and name Cname but I 
don't know of compile these fieldsName Cname is webapp-xx.
pythonanywhere.com but host?




  

On Tuesday, 7 March 2017 04:09:24 UTC+1, Jim S wrote:
>
> Login to your pythonanywhere account.  Click on the Web tab.
>
> Click on your web app on the left.
>
> It should show you something like this:
>
> DNS setup:
> How to point your domain at your website.
>
>
> CNAME: webapp-xx.pythonanywhere.com
>
> where xx is a 6 digit number.
>
> Go to you DNS setup with your registrar and create a CNAME record pointing 
> your domain, www.asdbluestars-bz.it to the cname entry from 
> pythonanywhere.
>
> Make sense?
>
> -Jim
>
>
>
> On Monday, March 6, 2017 at 4:22:26 PM UTC-6, Alessio Varalta wrote:
>>
>> Hi, I have buy a domain on aruba and paid account on pythonanywhere.
>>
>> My domain is www.asdbluestars-bz.it
>> My application run on https://alessiovic.pythonanywhere.com/bluestars/
>> So I rename in Web of pythonanywhere the application like 
>> www.asdbluestars-bz.it and after i see a new field
>>
>> Dns setup How to point your domain at your website. CNAME cname_value
>>
>> But now? I go to aruba and in manage domain and in Record CName section.
>>
>> Now i can add new cname and i have two field 
>>
>> Host
>> Cname
>>
>> I suppose host is Cname cname_value of pythonanywhere and cname is 
>> www.asdbluestars-bz.it
>>
>> :
>>
>

-- 
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: Custom form errors?

2017-03-07 Thread Dave S


On Monday, March 6, 2017 at 10:34:31 PM UTC-8, LoveWeb2py wrote:
>
> If I'm reading this correctly: 
> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors
>
> It looks like everything is now handled in the view and NOT the 
> controller, so I'd need to do all of my checks in the view. Does that sound 
> right?
>
>
The accept() is still in the controller.  The display of errors can be 
moved to the view.

/dps
 

> On Tuesday, March 7, 2017 at 1:31:32 AM UTC-5, LoveWeb2py wrote:
>>
>> Thank you, Anthony, but I'm using a custom form via the "user" 
>> controller. 
>>
>> Here is my code
>>
>>  {{=form.custom.begin}}
>> 
>>
>>   
>>
>> {{form.custom.widget.username.update(_placeholder="Username")}}
>>{{=form.custom.widget.username}}
>>   
>>
>>
>>
>>   
>>   
>>
>> {{form.custom.widget.password.update(_placeholder="Password")}}
>>{{=form.custom.widget.password}}
>>
>>
>>
>>
>>   
>>  
>> 
>> Remember me
>> 
>>  
>>
>>  
>> Forgot 
>> password?
>>  
>>   
>>
>>
>>
>>   
>>{{=form.custom.submit}}
>>  
>>   
>>
>>
>>
>>   Or
>>   
>>  
>> 
>> Facebook Sign in
>> 
>>  
>>  
>> 
>> Twitter Sign in
>> 
>>  
>>   
>>   Don't have an account? > href="{{=URL('default','register')}}">Create New
>>
>> 
>>{{=form.custom.end}}
>>
>>
>> I tried putting the functions you mentioned in the process and validate 
>> method in the "user" function, but still no luck.
>>
>> On Tuesday, March 7, 2017 at 12:39:18 AM UTC-5, Anthony wrote:
>>>
>>> See 
>>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#The-process-and-validate-methods
>>>  
>>> and 
>>> http://web2py.com/books/default/chapter/29/07/forms-and-validators#Hide-errors
>>> .
>>>
>>> After processing, errors are stored in form.errors (to get the error for 
>>> a given field, use form.errors[fieldname]).
>>>
>>> Anthony
>>>
>>> On Tuesday, March 7, 2017 at 12:06:45 AM UTC-5, LoveWeb2py wrote:

 Hello,

 I have some custom login forms and I'm something like this:


 {{=form.custom.begin}}Image name: 
 {{=form.custom.widget.name}}Image file: 
 {{=form.custom.widget.file}}Click here to upload: 
 {{=form.custom.submit}}{{=form.custom.end}}

 How can I check for errors here?

 I'm lost at where form gets checked. For example, if the user types an 
 invalid password or username, I'd like to generate a custom message with 
 response.flash or something to that nature.



-- 
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.