the field : Field('Abstract', type = 'text' ),
Le samedi 5 décembre 2015 05:02:13 UTC+1, Laurent Lc a écrit :
>
> Traceback (most recent call last):
> File "C:\Users\chambon\Documents\web2py\gluon\restricted.py", line 227, in
> restricted
> exec ccode in environment
> File "C:/Users/chambon/Documents/web2py/applications/NEURO/models/db.py"
> <http://localhost:8080/admin/default/edit/NEURO/models/db.py>, line 92, in
> <module>
> custom_auth_table.abstract.requires=COUNT_TEXT()
> File
> "C:\Users\chambon\Documents\web2py\gluon\packages\dal\pydal\helpers\classes.py",
> line 348, in __getattr__
> raise AttributeError
> AttributeError
>
> Thank you
>
>
>
> Le samedi 5 décembre 2015 02:42:18 UTC+1, Dave S a écrit :
>>
>>
>>
>> On Friday, December 4, 2015 at 2:19:33 PM UTC-8, Anthony wrote:
>>>
>>> Please show the traceback.
>>>
>>
>> And if you're defining the field, maybe show us the field definition?
>> I'm suspecting "value" isn't a string (and is missing the split()
>> attribute), but the tb may show something different.
>>
>> /dps
>>
>>
>>> On Friday, December 4, 2015 at 4:30:28 PM UTC-5, Laurent Lc wrote:
>>>>
>>>> Hello,
>>>>
>>>> i try to create my own validator : the goal is to count the number of
>>>> words
>>>> "app/module/customvalidators.py"
>>>> class COUNT_TEXT(Validator):
>>>> def __call__(self, value):
>>>> size = 25
>>>> error = None
>>>> try:
>>>> if len(value.split()) > size:
>>>> error="too much words"
>>>> except:
>>>> error = "Error counting"
>>>> return (value, error)
>>>>
>>>> "db.py"
>>>> from customvalidators import COUNT_TEXT
>>>> ..
>>>> ..
>>>> custom_auth_table.abstract.requires=COUNT_TEXT() # this line does not
>>>> run and create an error <type 'exceptions.AttributeError'>
>>>>
>>>> Could you help me please
>>>>
>>>> thanks in advance
>>>>
>>>>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.