I tried adding this line to the script:
import sys; sys.path.append('./')
and running from web2py/ as
python applications/myapp/modules/script.py
It worked
On Aug 31, 8:01 pm, Matthew <[email protected]> wrote:
> I am relatively new Web2py and very new to doctests. I'm attempting
> to test a new Validator, but the Traceback tells me it cannot even
> find the gluon.validators module.
>
> I have the web2py folder on my PYTHONPATH. Here is my file
> "validators.py" in ~/dev/source/web2py/applications/myapp/modules/
>
> from gluon.validators import IS_NOT_EMPTY
>
> class IS_NOT_WHITESPACE(IS_NOT_EMPTY):
> """
> Example::
> INPUT(_type='text', _name='name', requires=IS_NOT_WHITESPACE
> ())
>
> IS_NOT_WHITESPACE inherits from the IS_NOT_EMPTY validator. It
> trims the
> argument, a string, of whitespace before validating:
>
> >>> validators.IS_NOT_WHITESPACE(' ')
> (' ', 'cannot be empty!')
>
> """
> def __init__(self, error_message='cannot be empty!'):
> super(self, error_message)
>
> if __name__=='__main__':
> import doctest
> doctest.testmod()
>
> Any help is greatly appreciated. Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---