[web2py] Again: relation "auth_user" already exists

2019-10-14 Thread Johann Spies
I want all my auth_tables in a specific schema in PostgreSQL:  wos_2019_1.

I have created a model like this:

db.define_table('auth_user',
Field('id','id',
  represent=lambda id:SPAN(id,' 
',A('view',_href=URL('auth_user_read',args=id,
Field('username', type='string',
  label='Username'),
Field('first_name', type='string',
  label='First Name'),
Field('last_name', type='string',
  label='Last Name'),
Field('email', type='string',
  label='Email'),
Field('password', type='password',
  readable=False,
  label='Password'),
Field('created_on','datetime',default=datetime.datetime.today(),
  label='Created On',writable=False,readable=False),
Field('modified_on','datetime',default=datetime.datetime.today(),
  label='Modified On',writable=False,readable=False,
  update=datetime.datetime.today()),
Field('registration_key',default='',
  writable=False,readable=False),
Field('reset_password_key',default='',
  writable=False,readable=False),
Field('registration_id', length=64, default=lambda:str(uuid.uuid4()),
  writable=False,readable=False),
format='%(username)s')

db.auth_user._rname = 'wos_2019_1.auth_user'
db.auth_user.first_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.auth_user.last_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key)
db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username)
db.auth_user.registration_id.requires = IS_NOT_IN_DB(db, 
db.auth_user.registration_id)
db.auth_user.email.requires = 
(IS_EMAIL(error_message=auth.messages.invalid_email),
   IS_NOT_IN_DB(db, db.auth_user.email))


# auth.settings.extra_fields['auth_user'] = []
auth.define_tables(username=True, signature=True, migrate = True)

# e-pos van Anthony op web2py-lys 
lt = db._LAZY_TABLES
[lt[t][2].update(rname='wos_2019_1.%s' % t) for t in db.tables if 
t.startswith('auth')]

But still I get:

> Traceback (most recent call last):
>   File "/home/js/py4web/py4web/core.py", line 677, in import_apps
> module_name, init).load_module()
>   File "", line 407, in 
> _check_name_wrapper
>   File "", line 907, in load_module
>   File "", line 732, in load_module
>   File "", line 265, in _load_module_shim
>   File "", line 696, in _load
>   File "", line 677, in _load_unlocked
>   File "", line 728, in exec_module
>   File "", line 219, in _call_with_frames_removed
>   File "apps/wos_2019_1/__init__.py", line 2, in 
> from . models import db
>   File "apps/wos_2019_1/models.py", line 50, in 
> db.auth_user._rname = 'wos_2019_1.auth_user'
>   File "/usr/local/lib/python3.7/dist-packages/pydal/base.py", line 675, in 
> __getattr__
> return self.lazy_define_table(tablename, *fields, **kwargs)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/base.py", line 627, in 
> lazy_define_table
> polymodel=polymodel)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/adapters/base.py", line 
> 798, in create_table
> return self.migrator.create_table(*args, **kwargs)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/migrator.py", line 282, 
> in create_table
> self.adapter.create_sequence_and_triggers(query, table)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/adapters/base.py", line 
> 881, in create_sequence_and_triggers
> self.execute(query)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/adapters/__init__.py", 
> line 67, in wrap
> return f(*args, **kwargs)
>   File "/usr/local/lib/python3.7/dist-packages/pydal/adapters/base.py", line 
> 413, in execute
> rv = self.cursor.execute(command, *args[1:], **kwargs)
> psycopg2.errors.DuplicateTable: relation "auth_user" already exists
>
>
In the past the recipe used above did work with web2py.  

How do I convince py4web to put those tables where I want it?

I have checked: there are no auth_* tables in the wos_2019_1-schema.

Regards
Johann

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/263d5eb2-94ac-4acc-9fb4-cc36e7793075%40googlegroups.com.


Re: [web2py] Composite key in web2py

2019-08-19 Thread Johann Spies
On Tue, 20 Aug 2019 at 07:00, Deep Shah  wrote:

> Hi All,
> I am migrating table from existing table which has primary key with two
> fields.
> After migrating the table i created SQLFORM.grid and used selectable to
> process the selected tuples.
> selectable = [('Approve Selected names', lambda ids: approve_name(ids))]
>
> Its giving the following error.
>  'Table' object has no attribute '_id'
>
> How do i solve this error keeping both field as key
>
>
Just add an id-column as a serial field.  It is not necessary for it to be
the primary key. If you need to use the primary key for references, use
executesql.

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGZ55DQUWDk%2BcCik5GQTXnoN-yHg94zN-69D73T-ANdbm2L8mg%40mail.gmail.com.


Re: [web2py] Re: please help testing web3py

2019-07-18 Thread Johann Spies
On Wed, 17 Jul 2019 at 22:21, Nico Zanferrari  wrote:

> Hi Johann,
>
> you can copy the whole _documentation folder from github under the apps
> folder of web3py (C:\Users\nico\myapps in my case on Win10). Then, after
> running web3py, you can reach it on http://127.0.0.1:8000/_documentation
> , which is automatically redirected to
> http://127.0.0.1:8000/_documentation/static/index.html.
>
>
Thanks Nico.

Regards
Johann

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGZ55DTVy_Wf7AV%3D%2Bs02qiX7ZwzsuL3J4EzwJuGzjQgm1BcRng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: please help testing web3py

2019-07-16 Thread Johann Spies
On Sun, 14 Jul 2019 at 05:48, Massimo Di Pierro 
wrote:

>
> I posted some preliminary documentation
> https://github.com/web2py/web3py/tree/master/apps/_documentation
>
>
>
I do not see a Makefile to convert the .mm-files to html-documentation. How
do I read the documentation?

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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CAGZ55DS7VO7Sm7RY5MwBwfMKi8bt9zyjNhuc3nGd4u%2BK1DJLpw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: Python3 and gluon/xmlrpc.py

2018-08-14 Thread Johann Spies
Thanks Leonel.

-- 
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] Python3 and gluon/xmlrpc.py

2018-08-14 Thread Johann Spies
On Debian I have:

apt-file search /usr/lib/python2.7/SimpleXMLRPCServer.py
libpython2.7-stdlib: /usr/lib/python2.7/SimpleXMLRPCServer.py

But there is no such file for python3.  Therefore this line(10) fails
on python3:

from SimpleXMLRPCServer import SimpleXMLRPCDispatcher

I suspect this is a bug as far as python3 is concerned.

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] LDAP authentication questions

2018-03-22 Thread Johann Spies
On 15 March 2018 at 16:21, Richard Vézina  wrote:

> ...
> Good luck

Thank you Richard.  Your comments helped me to a clearer understanding
of the problem and possible solutions.

Regards
Johann

-- 
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] LDAP authentication questions

2018-03-15 Thread Johann Spies
I am trying out ldap authentication after I have last used it in 2006.

My ldap knowledge is minimal.

After reading the documentation in the book and in ldap_auth.py I
have a few questions about authentication and ldap.

Background: Only a few users (probably not more than 5 or 6) will use
this app as logged in users.

All of them (or maybe except one or two) will not be staff members of
our university.  Staff members and students can be authenticated
against the Active Directory (AD) of the university.  The others not.

We will only allow specific people to authenticate.  Registration of
users will not be available through the user webinterface.

As I understand the documentation web2py will work through the list
(auth.settings.login_methods) trying the next method if the previous
authentication method fails.

I do not have any admin-function as far as the AD is concerned.  So
I can do nothing there that have an effect on our authentication
except query the AD through LDAP.


In the model:

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods.append(ldap_auth(
mode='ad', server='ouradserver',
base_dn='ou=Users,dc=stb,dc=sun,dc=ac,dc=za,O=SU',
manage_user=True,
user_firstname_attrib='cn:1',
user_lastname_attrib='cn:2',
user_mail_attrib='mail'))

My auth.settings.login_methods:
[,
 .ldap_auth_aux>]



Now my questions:



1. Is it possible to combine the normal auth and ldap methods in such
a way that staff members authenticate against AD and the others
against the local auth-table?

2. How do I manage the user registration if the answer on 1 is "Yes".

3. I have tested the system with myself as user on both the local and
the AD.  If my local password is different from that on the AD, I can
login with the local password.  That should not be.  How do I get it
that if the username is local and on the AD the last will override the
first?

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] Bug in ldap library for python3?

2018-03-14 Thread Johann Spies
Thanks Richard for your attention.

I have checked my setup again and saw that I had the debian-package
python3-ldap3 and not python3-ldap.

I have installed  python3-ldap and now it works - at least so far for importing:

from gluon.contrib.login_methods.ldap_auth import ldap_auth

Regards
Johann

On 13 March 2018 at 19:05, Richard Vézina  wrote:
> It might not be an issue with auth_ldap.py
>
> On Tue, Mar 13, 2018 at 12:29 PM, Richard Vézina
>  wrote:
>>
>> It works fine...
>>
>> On Tue, Mar 13, 2018 at 12:28 PM, Richard Vézina
>>  wrote:
>>>
>>> I try with a module of mine using ldap and had issues with ldapS
>>> connection...
>>>
>>> I had to follow this :
>>>
>>> https://github.com/python-ldap/python-ldap/issues/55
>>>
>>> l = ldap.initialize("ldaps://{s}:{p}".format(s=server, p=636))
>>> l.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
>>> # l.set_option(ldap.OPT_X_TLS_CACERTFILE, 'path/to/ca.pem')  # Wasn't
>>> required...
>>> l.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, ldap. OPT_X_TLS_NEVER)
>>> l.set_option(ldap.OPT_X_TLS_NEWCTX, 0)
>>>
>>> Then it connected properly under python3 only...
>>>
>>> Will make some test in python2 if the back port of the above cause any
>>> issue...
>>>
>>> Richard
>>>
>>>
>>> On Tue, Mar 13, 2018 at 11:58 AM, Richard Vézina
>>>  wrote:
>>>>
>>>> Please try this :
>>>>
>>>> sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
>>>> # setuptools should be there... I was miss leading...
>>>> sudo pip3 install python-ldap
>>>>
>>>> Please provide progress as if auth_ldap.py works properly with python3
>>>> once you install python-ldap properly under python3.
>>>>
>>>> Thanks
>>>>
>>>> Richard
>>>>
>>>>
>>>> On Tue, Mar 13, 2018 at 11:39 AM, Richard Vézina
>>>>  wrote:
>>>>>
>>>>> I open this issue :
>>>>>
>>>>> https://github.com/python-ldap/python-ldap/issues/181
>>>>>
>>>>> On Tue, Mar 13, 2018 at 11:03 AM, Richard Vézina
>>>>>  wrote:
>>>>>>
>>>>>> python3-ldap -> ldap3
>>>>>> (https://pypi.python.org/pypi/python3-ldap/0.9.8.4/) is not the same 
>>>>>> thing
>>>>>> as python-ldap...
>>>>>>
>>>>>> It seems that python-ldap support python 3 :
>>>>>>
>>>>>> https://github.com/python-ldap/python-ldap
>>>>>>
>>>>>> Saddly enough, I hadn't successfully install python-ldap under python3
>>>>>> with pip3... It fails over importing setuptools issue... Setuptools is
>>>>>> installed, so I wonder what going on...
>>>>>>
>>>>>> It seems to be working with python 3.4+ :
>>>>>> https://www.python-ldap.org/en/latest/installing.html#build-prerequisites
>>>>>>
>>>>>> If you have ubuntu you can try on your side :
>>>>>>
>>>>>> sudo pip3 install -U setuptools
>>>>>> sudo pip3 install python-ldap
>>>>>>
>>>>>>
>>>>>> It would be nice if python-ldap just works under python3 as we
>>>>>> wouldn't have to touch ldap_auth.py as python-ldap should have keep the 
>>>>>> same
>>>>>> API under python3...
>>>>>>
>>>>>> Though ldap3 seems to offer interresting progres, but I didn't try it.
>>>>>>
>>>>>> Please keep posting here your progress.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Richard
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, Mar 13, 2018 at 8:32 AM, Johann Spies 
>>>>>> wrote:
>>>>>>>
>>>>>>> Version 2.16.1
>>>>>>>
>>>>>>> In python (2.7) I can do:
>>>>>>>
>>>>>>> python web2py.py -S welcome
>>>>>>> ..
>>>>>>>
>>>>>>> In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth
>>>>>>>
>>>>>>> In [2]:
>>>

[web2py] Bug in ldap library for python3?

2018-03-13 Thread Johann Spies
Version 2.16.1

In python (2.7) I can do:

python web2py.py -S welcome
..

In [1]: from gluon.contrib.login_methods.ldap_auth import ldap_auth

In [2]:

But not when I use python3 (and I have python3-ldap installed).


```
/home/js/web2py/gluon/custom_import.py in custom_importer(name,
globals, locals, fromlist, level)
109 import_tb = None
110
--> 111 return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
112
113

/home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
 12 except Exception as e:
 13 logging.error('missing ldap, try "easy_install python-ldap"')
---> 14 raise e
 15
 16

/home/js/web2py/gluon/contrib/login_methods/ldap_auth.py in ()
  7 import logging
  8 try:
> 9 import ldap
 10 import ldap.filter
 11 ldap.set_option(ldap.OPT_REFERRALS, 0)

/home/js/web2py/gluon/custom_import.py in custom_importer(name,
globals, locals, fromlist, level)
102 return NATIVE_IMPORTER(name, globals, locals,
fromlist, level)
103 except (ImportError, KeyError) as e3:
--> 104 raise ImportError(e1, import_tb)  # there an
import error in the module
105 except Exception as e2:
106 raise  # there is an error in the module

ImportError: (ImportError("Cannot import module
'applications.welcome.modules.ldap'",), )

```

It seems to me like a bug?

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] 'DAL' object has no attribute 'db'

2018-02-07 Thread Johann Spies
Apologies for waisting your time.  The new day has opened my eyes.  I
had a db.db.sometable (result of a manual copy and paste)  later on in
the function which caused this db-problem.

There is still another problem but I will first try and out what is
going on here.

Thanks for your attention to help me.

Johann

On 8 February 2018 at 08:03, Johann Spies  wrote:
> On 7 February 2018 at 22:14, Dave S  wrote:
>>
>>
>> I thought web2py always ran the model files before calling the controller
>> function,
>> part of the overhead of each call (and the reason for lazy tables and tables
>> defined in modules).
>>
>> Johann, is this function in the file named in the traceback,
>> controllers/indicators.py?
>
> Yes.  It is early morning now.  I will experiment further and try and
> find what is going on.
>
> 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] 'DAL' object has no attribute 'db'

2018-02-07 Thread Johann Spies
On 7 February 2018 at 22:14, Dave S  wrote:
>
>
> I thought web2py always ran the model files before calling the controller
> function,
> part of the overhead of each call (and the reason for lazy tables and tables
> defined in modules).
>
> Johann, is this function in the file named in the traceback,
> controllers/indicators.py?

Yes.  It is early morning now.  I will experiment further and try and
find what is going on.

Regards.
Johann

-- 
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] 'DAL' object has no attribute 'db'

2018-02-07 Thread Johann Spies
No.

Regards
Johann

On 7 February 2018 at 16:10, Richard Vézina  wrote:
> Do you make a module function call without passing the db to it??
>
> Richard
>
> On Wed, Feb 7, 2018 at 8:42 AM, Johann Spies  wrote:
>>
>> Version 2.16.1-stable+timestamp.2017.11.14.05.54.25
>>
>>
>> Traceback (most recent call last):
>>   File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
>> exec(ccode, environment)
>> AttributeError: 'DAL' object has no attribute 'db'
>>
>> During handling of the above exception, another exception occurred:
>>
>> Traceback (most recent call last):
>>   File "/home/js/web2py/gluon/restricted.py", line 141, in __init__
>> self.traceback = traceback.format_exc()
>> AttributeError: 'NoneType' object has no attribute 'strip'
>>
>> In file: /home/js/web2py/applications/wos_2017_2/controllers/indicators.py
>>
>>
>>  at 0x7fe51e5436f0, file
>> "/home/js/web2py/applications/wos_2017_2/controllers/indicators.py",
>> line 2>
>>
>> It happens when I call this function:
>>
>> # -*- coding: utf-8 -*-
>> import datetime
>> @auth.requires_login()
>> def za_arts_and_reviews():
>> """
>> some documentation about views declared in the background.
>>
>> """
>> db.define_table('za_arts_reviews',
>> Field('pubyear', 'integer'),
>> Field('zitems', 'integer', rname='items'),
>> migrate=False,
>> rname='wos_2017_2.za_arts_and_reviews_by_year_v')
>>
>> ...
>>
>> Why this error?
>>
>> 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.
>
>
> --
> 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.


[web2py] 'DAL' object has no attribute 'db'

2018-02-07 Thread Johann Spies
Version 2.16.1-stable+timestamp.2017.11.14.05.54.25


Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
AttributeError: 'DAL' object has no attribute 'db'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 141, in __init__
self.traceback = traceback.format_exc()
AttributeError: 'NoneType' object has no attribute 'strip'

In file: /home/js/web2py/applications/wos_2017_2/controllers/indicators.py


 at 0x7fe51e5436f0, file
"/home/js/web2py/applications/wos_2017_2/controllers/indicators.py",
line 2>

It happens when I call this function:

# -*- coding: utf-8 -*-
import datetime
@auth.requires_login()
def za_arts_and_reviews():
"""
some documentation about views declared in the background.

"""
db.define_table('za_arts_reviews',
Field('pubyear', 'integer'),
Field('zitems', 'integer', rname='items'),
migrate=False,
rname='wos_2017_2.za_arts_and_reviews_by_year_v')

...

Why this error?

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] Re: Script to create models from legacy PostgreSQL tables

2018-02-05 Thread Johann Spies
On 4 February 2018 at 07:43, Massimo Di Pierro
 wrote:
> How does it compare with this?
>
> https://github.com/web2py/web2py/blob/master/scripts/extract_pgsql_models.py
>
>
> If better, can you merge and make a PR?


Thanks Massimo.  I did not know (or forgot) about that script.

I have tested it now.

I will not try and merge the two scripts. I think the two scripts
serve different purposes.
The one you mentioned was not able to create models from one of my
bigger databases because of problems with types:

Traceback (most recent call last):
  File "/home/js/web2py/scripts/extract_pgsql_models.py", line 286, in 
define_db(cnn, db, host, port, user, passwd)
  File "/home/js/web2py/scripts/extract_pgsql_models.py", line 270, in define_db
define_table(conn, table)
  File "/home/js/web2py/scripts/extract_pgsql_models.py", line 248, in
define_table
fdef = define_field(conn, table, field, pks)
  File "/home/js/web2py/scripts/extract_pgsql_models.py", line 132, in
define_field
raise RuntimeError("Data Type not supported: %s " % str(field))
RuntimeError: Data Type not supported: {'data_type': 'timestamp with
time zone', 'numeric_precision_radix': None, 'is_nullable': 'YES',
'character_maximum_length': None, 'column_default': None,
'numeric_precision': None, 'numeric_scale': None, 'column_name':
'last_login'}


Mine was designed to create legacy tables' models leaving out
particulars like field length and primary keys
which the database handles. Also my script is able to handle
collisions between field (and table) names with the
reserved words in web2py and PostgreSQL-types like uuid, citext, a
boolean that is not a character type and tsvectors.

I have for example a database with many schemas and hundreds of
tables.  I will only use web2py for one schema.

I use web2py mostly as a web interface to existing databases and
minimize my use of DAL.  I prefer direct SQL.

DAL is useful for interactions with forms and grids.  But to
manipulate and select data I mostly use executesql.

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] Script to create models from legacy PostgreSQL tables

2018-02-01 Thread Johann Spies
I have written a script which I use to create models for an existing database.

Maybe it will be useful for others.

Comments are welcome.

https://github.com/johannspies/pg_to_web2py_model

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] auth actions_disabled in 2.16.1

2018-01-30 Thread Johann Spies
It seems that the menu option is hard coded in the default layout.html.

Regards
Johann

On 30 January 2018 at 12:24, Johann Spies  wrote:
> On 2 January 2018 at 20:37, 黄祥  wrote:
>> web2py latest version auth actions_disabled doesn't work anymore
>> models/db.py
>> #auth.settings.actions_disabled =
>> configuration.take('auth.actions_disabled')
>> auth.settings.actions_disabled = ['profile', 'register']
>>
>> result
>> the url to sign up is exist, when clicked the sign up it return 404 NOT
>> FOUND
>>
>> is there any way to make it work again like in previous version?
>
> I can confirm this behaviour.
>
> I would prefer the option to register not to appear under "Login"  in
> the navbar.
>
> "Sign up"  appears and when clicked throws a HTTP 404 error.
>
> I could not see what in the code of gluon/tools.py is causing this.
>
> It seems that this code does not get involved in the process (line
> 2009 of tools.py):
>
> if 'register' not in self.settings.actions_disabled:
> items.append({'name': T('Sign Up'), 'href': href('register'),
>   'icon': 'icon-user'})
>
>
> Regards
> Johann
> --
> 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.


Re: [web2py] auth actions_disabled in 2.16.1

2018-01-30 Thread Johann Spies
On 2 January 2018 at 20:37, 黄祥  wrote:
> web2py latest version auth actions_disabled doesn't work anymore
> models/db.py
> #auth.settings.actions_disabled =
> configuration.take('auth.actions_disabled')
> auth.settings.actions_disabled = ['profile', 'register']
>
> result
> the url to sign up is exist, when clicked the sign up it return 404 NOT
> FOUND
>
> is there any way to make it work again like in previous version?

I can confirm this behaviour.

I would prefer the option to register not to appear under "Login"  in
the navbar.

"Sign up"  appears and when clicked throws a HTTP 404 error.

I could not see what in the code of gluon/tools.py is causing this.

It seems that this code does not get involved in the process (line
2009 of tools.py):

if 'register' not in self.settings.actions_disabled:
items.append({'name': T('Sign Up'), 'href': href('register'),
  'icon': 'icon-user'})


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] Re: exportclasses for Grid: a bug?

2017-08-02 Thread Johann Spies
On 2 August 2017 at 17:35, Anthony  wrote:
> The post you linked to is incorrect -- if you specify exportclasses, the
> allowable values are False, an export class, or a tuple containing an export
> class and its label. You cannot use values of True, and there is no need to
> use True values because any built-in export class will automatically be
> included unless explicitly set to False via exportclasses.
>

Thanks Anthony.  It will help if this can be documented clearly in the
book with an illustration on how to use it.

Regards
Johann

-- 
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] exportclasses for Grid: a bug?

2017-08-02 Thread Johann Spies
Web2py Version 2.15.2-stable+timestamp.2017.07.19.12.18.41

I found a clearer explanation than I could get in the Book on how to
pass exportclasses to a grid:

http://rootpy.com/Export-in-SQLFORM-grid/

and it worked as far as the buttons are concerned.

But then the export does not work.

Here is code that can reproduce it:

With this code, all the forms of export works except tsv and
tsv_with_hidden_cols:
Model:

db.define_table("xx",
Field("x1"),
Field("x2"))

Controller:

def index():
  grid = SQLFORM.grid(db.xx,csv = True)
return dict(grid = grid)

Error for tsv-export:
Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 64, in 
  File "/home/js/web2py/gluon/globals.py", line 409, in 
self._caller = lambda f: f()
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 13, in index
grid = SQLFORM.grid(db.xx,csv = True)
  File "/home/js/web2py/gluon/sqlhtml.py", line 2594, in grid
raise HTTP(200, oExp.export(), **response.headers)
  File "/home/js/web2py/gluon/sqlhtml.py", line 3615, in export
records = self.represented()
  File "/home/js/web2py/gluon/sqlhtml.py", line 3566, in represented
field = self.rows.db[t][f]
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 663,
in __getitem__
return self.__getattr__(str(key))
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 670,
in __getattr__
return BasicStorage.__getattribute__(self, key)
AttributeError: 'DAL' object has no attribute '"xx"'

And with the following code nothing the csv, tsv and html buttens shows
and when clicked nothing works:

def index():
export_classes = dict(csv=True, json=False, html=True,
  tsv=True, xml=False, csv_with_hidden_cols=False,
  tsv_with_hidden_cols=False)
grid = SQLFORM.grid(db.xx,  exportclasses = export_classes)
return dict(grid = grid)

Traceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 219, in restricted
exec(ccode, environment)
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 64, in 
  File "/home/js/web2py/gluon/globals.py", line 409, in 
self._caller = lambda f: f()
  File "/home/js/web2py/applications/toets/controllers/default.py",
line 22, in index
exportclasses = export_classes)
  File "/home/js/web2py/gluon/sqlhtml.py", line 2587, in grid
oExp = clazz(rows)
TypeError: 'bool' object is not callable

Why the error?
A bug?

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] now web2py related but this is free now ...

2017-05-31 Thread Johann Spies
+1  Thank you very much.

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: Can't import plugin module

2017-04-11 Thread Johann Spies


On Wednesday, 21 December 2016 15:45:12 UTC+2, Anthony wrote:
>
> There is no __init__.py file in your /modules folder, nor in the app 
> folder (should also be one in the /applications folder).
>
> Anthony
>
> On Wednesday, December 21, 2016 at 8:29:25 AM UTC-5, Jurgis Pralgauskis 
> wrote:
>>
>> Hi, 
>>
>> I am trying to make plugin, but ran into 
>>
>>
>>
>> Version 2.14.6-stable+timestamp.2016.05.09.19.18.48 Traceback 
>>
>> 1.
>> 2.
>> 3.
>> 4.
>> 5.
>> 6.
>> 7.
>> 8.
>>
>> Traceback (most recent call last):
>>   File "/home/jurgis/dev/web2py_git/gluon/restricted.py", line 216, in 
>> restricted
>> exec(ccode, environment)
>>   File 
>> "/home/jurgis/dev/web2py_git/applications/app/controllers/plugin_joins_builder.py:index",
>>  line 3, in 
>>   File "/home/jurgis/dev/web2py_git/gluon/custom_import.py", line 104, in 
>> custom_importer
>> raise ImportError(e1, import_tb)  # there an import error in the module
>> ImportError: (ImportError('No module named 
>> modules.plugin_joins_builder.joins_builder',), > 0x7f70f0098a70>)
>>
>>
>>
I get the same error (and have had this problem numerous times before). 
This is frustrating.

The contents of the modules directory:
$ ls
__init__.py  __init__.pyc  pretty.py  pretty.pyc

I have tried:

from pretty import *

and

from applications.wos_2016_1.modules.pretty import *

with no success.

This is on localhost and I have restarted web2py with every change.

Regards
Johann

 

-- 
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: 502 Bad Gateway - no tmp/web2py.socket file

2016-11-24 Thread Johann Spies
On 23 November 2016 at 14:36, Richard Brown  wrote:

> Thanks, the answer is 'yes' to all of these checks - web2py.ini file
> attached. I did find out how to see if the uwsgi process is running and it
> does appear to be:
>
>  $ ps aux | grep "uwsgi"
> richard   1044  0.0  0.1   4276  1824 pts/0S+   10:54   0:00 grep
> --color=auto uwsgi
>
>
> No it seems it is not running.  Your result showed the grep of uwsgi.

Try

ps aux | grep [u]wsgi

This will not show your grep command.

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] Re: Moving auth_user and related tables to another schema

2016-06-20 Thread Johann Spies
On 15 June 2016 at 17:54, Anthony  wrote:

> It's a bit of a hack and I haven't tried it so not sure it will work, but
> maybe something like this:
>
> db._lazy_tables = True
> auth.define_tables()
> lt = db._LAZY_TABLES
> [lt[t][2].update(rname='myschema.%s' % t) for t in db.tables if t.
> startswith('auth')]
> db._lazy_tables = False
>
> The idea is to use lazy table definitions. In that case, for each table,
> there is a tuple in db._LAZY_TABLES, the third element of which is a
> dictionary of the arguments to define the table. The above code loops
> through the Auth tables and updates the arguments of each to include
> "rname" with the schema name prepended to the table name. The full table
> definition won't happen until the first time the table is accessed, at
> which point, the "rname" will be set accordingly.
>
> Of course, the first and last lines are not necessary if you already have
> DAL(..., lazy_tables=True).
>

Thank you Anthony.  This is very useful!

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] Moving auth_user and related tables to another schema

2016-06-15 Thread Johann Spies
Thanks Richard,
On 13 June 2016 at 16:21, Richard Vézina 
wrote:

As far as I know web2py only support public schema, though as you mention I
> think can support other schema with rname... You mention to use it that
> way, it not working with auth if you create custom auth table model
> definition?
>

Yes, tests have shown that I will have to redefine all the auth_related
tables to do that.  I was hoping there was a central setting to convince
web2py to do it.

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] Moving auth_user and related tables to another schema

2016-06-13 Thread Johann Spies
We use PostgreSQL and make use of schemas for most of our work and use the
"rname"  option to do that in normal table definition.

I have looked through the source code of tools.py and cannot see where it
can be done to let the auth-related tables be created in a different schema
than 'public'.

How should I do it?

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] Invalid view even created it before

2016-04-25 Thread Johann Spies
Hallo André

On 25 April 2016 at 11:49, Morganti  wrote:


> Hello,
>
> I am started to learn web2py some weeks ago. After created some
> controllers and models using the generic view. I tried to deploy to
> PythonAnywhere to test it and, of course, I know or use disable generic
> only localhost or create the specific views. First I tried to disable the
> localhost generic view and ok, everything as expect. But, when I create a
> view, using quick examples, one view for one form sqlformat, I am getting
> the error:
>
> invalid view (default/novo_cliente.html)
>
> Do I need to do anything more?
>
>
>
Create a view for controller novo_cliente: default/novo_cliente.html

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] Re: Importing CSV file

2016-03-01 Thread Johann Spies
On 26 February 2016 at 16:21, Joe  wrote:

> Hello Anthony, Thanks for your reply.
> I exported the CSV after adding some records, as you suggested, and I see
> no difference in the format. I tried to change the format several times but
> I can't import it. I either get the None records or an error depending on
> how I tried to modify the format.
>

The following process works normally for me:

export an empty table using the admin-interface.

Open the exported file as well as the csv-file in a spreadsheet  (localc in
my case).

Copy the second csv-file into the the exported started with column 1 row 2.

Make sure the data columns and headers correspond to that of the exported
one.
Delete the row containing the second file's headers.
Save it as CSV-file and then import it.

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] Re: nginx/uwsgi problem on Debian

2016-01-21 Thread Johann Spies
On 20 January 2016 at 16:35, Richard Vézina 
wrote:

>
> Which user is regular "web" user under debian, www-data?
>
>
Yes.

Thanks it is working now.

Regards
Johann

-- 
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] nginx/uwsgi problem on Debian

2016-01-20 Thread Johann Spies
The combination uwsgi/nginx has been recommended often on this list.

After an upgrade from wheezy to jessy the nginx, uswgi-combination does not
play nicely together.  We have also tried to move the socket to tmp, but
that did not change anything in as far as the refused connection is
concerned.

Any idea why this problem is there? And how to solve it?

The socket:
ls -la /var/uwsgi/app/web2py/socket
srwxrwxrwx 1 www-data www-data 0 Jan 20 14:40 /var/uwsgi/app/web2py/socket

The logs:

$ tail -n 1 /var/log/nginx/error.log
2016/01/20 14:33:27 [error] 4103#0: *8 connect() to
unix:///var/uwsgi/app/web2py/socket failed (111: Connection refused) while
connecting to upstream, client: 146.232.117.197, server: crest2, request:
"GET / HTTP/1.1", upstream: "uwsgi://unix:///var/uwsgi/app/web2py/socket:",
host: "crest2.sun.ac.za"


$ tail emperor.log -n 5
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /var/uwsgi/app/web2py/socket fd 3
bind(): Permission denied [core/socket.c line 227]
Wed Jan 20 14:40:45 2016 - [emperor] curse the uwsgi instance web2py.xml
(pid: 4957)
Wed Jan 20 14:40:45 2016 - [emperor] removed uwsgi instance web2py.xml

The configurations:

server {
listen  80;
server_name $hostname;
uwsgi_read_timeout 2400;
location ~* /(\w+)/static(?:/_[\d]+\.[\d]+\.[\d]+)?/(.*)$ {
alias /home/www-data/web2py/applications/$1/static/$2;
expires max;
}
 location / {
uwsgi_pass  unix:///var/uwsgi/app/web2py/socket;
include uwsgi_params;
uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

}
}


server {
listen 443 default_server ssl;
server_name $hostname;
ssl_certificate /etc/nginx/ssl/web2py.crt;
ssl_certificate_key /etc/nginx/ssl/web2py.key;
ssl_prefer_server_ciphers on;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
ssl_ciphers
ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA:DHE-DSS-AES256-SHA:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA;
ssl_protocols TLSv1.2;
keepalive_timeout70;
location ~* /(\w+)/static(?:/_[\d]+.[\d]+.[\d]+)?/(.*)$ {
alias /home/www-data/web2py/applications/$1/static/$2;
expires max;
}
location / {
uwsgi_pass
unix:///var/uwsgi/app/web2py/socket;

uwsgi_buffer_size   128k;
uwsgi_buffers   8 256k;
uwsgi_busy_buffers_size   256k;
include
uwsgi_params;

uwsgi_param UWSGI_SCHEME $scheme;
uwsgi_param SERVER_SOFTWAREnginx/$nginx_version;

}
}

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] FEATURE REQUEST: Case Insensitive Field types

2015-12-07 Thread Johann Spies
On 2 December 2015 at 09:59, Encompass solutions 
wrote:

> I am not sure this exists yet, but it would be nice to take a string field
> (or anything string like) and make it case insensitive.  That way I don't
> have to worry the j...@example.com is the same as j...@example.com
> What do you guys think?
>
>
If you use PostgreSQL as backend you can  activate the extension 'citext'
and then in web2py do something like this:

citext = SQLCustomType(
type ='text',
native='citext' )

and in your model:

db.define_table('words',
Field('word', citext))

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] How to use fancytree?

2015-11-30 Thread Johann Spies
On 1 December 2015 at 04:08, Henk huisman  wrote:

>
> This is the code I tried:
>
>
>  "text/javascript">
> 

Re: [web2py] Re: web2py / pydal returning id 1 in postgres

2015-11-26 Thread Johann Spies
What is the output of \d+ 

in psql?

What does your model in web2py for that model look like?

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] Re: A MCV-related question: global search form

2015-11-23 Thread Johann Spies
Thanks Leonel and Ian.

Just in case it might help someone else, this is the code in layout.html
that works for me:


  {{if response.menu:}}
  {{=MENU(response.menu, _class='nav
navbar-nav',li_class='dropdown',ul_class='dropdown-menu')}}
  {{pass}}
  
{{='auth' in globals() and
auth.navbar('Welcome',mode='dropdown') or ''}}
  
  
  
  
  
   #suggestions { position: relative; }
   .suggestions { background: lightblue; border: solid 1px #55A6C8;
}
   .suggestions DIV { padding: 2px 4px 2px 4px; }
  


  

  
 



Advanced search


  


  



and at the bottom of the file in a 

Re: [web2py] web2py / pydal returning id 1 in postgres

2015-11-23 Thread Johann Spies
Which database backend do you use and what does the table definition look
like in that backend?

Regards
Johann

On 23 November 2015 at 04:58, Mark Graves  wrote:

> Are there any caveats to know about running applications in shell mode
> (e.g. transactions / returning id)?
>
> I'm running a middleware migration script to migrate someone off an old
> database to a new one.
>
> When I run a db.table.validate_and_insert() it keeps returning me id 1.
> This is yielding a duplicate key error understandably.
>
> It's like pydal and postgres are coming out of sync.
>
> Theres only one connection to the database, but the sequence is not being
> updated.
>
> Any thoughts?
>
>
> --
> 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: exporting to csv

2015-11-18 Thread Johann Spies
On 18 November 2015 at 03:51, lucas  wrote:

nice job, any idea how to make it a tab delimited file instead of comma?
> lucas
>
> From the book:

Both export_to_csv_file and import_from_csv_file accept keyword arguments
that tell the csv parser the format to save/load the files:

   - delimiter: delimiter to separate values (default ',')
   - quotechar: character to use to quote string values (default to double
   quotes)
   - quoting: quote system (default csv.QUOTE_MINIMAL)

Here is some example usage:

>>> import csv
>>> rows = db(query).select()
>>> rows.export_to_csv_file(open('/tmp/test.txt', 'w'),
delimiter='|',
quotechar='"',
quoting=csv.QUOTE_NONNUMERIC)

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] A MCV-related question: global search form

2015-11-18 Thread Johann Spies
As I understand Web2py forms in views are managed by controllers.

I want to use a search form in the menubar like the  attached image.

[image: Inline images 1]

This form is presented by layout.html.

I want the form to be an auto-complete widget with sql-lookups in the
background.

So from where do I control that form?  From a model?

The form must be available from all parts of the app. I do not want to add
code in every controller to manage it.

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] Setting up database table with date.

2015-10-21 Thread Johann Spies
On 20 October 2015 at 14:16, Garry Smith  wrote:

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

Which database do you use and how is the date format specified in that
database?

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] Re: PostgreSQL

2015-10-21 Thread Johann Spies
Also look at this:
http://www.dbta.com/Editorial/Trends-and-Applications/Best-Database-Overall%C2%AD-105362.aspx

Regards
Johann

-- 
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] Type Cast Field On The Fly

2015-10-21 Thread Johann Spies
On 20 October 2015 at 20:03, Benson Myrtil  wrote:

> Hey guys,
>
> I have a quick question. Does the DAL support type casting on the fly? I
> am working with a legacy mssql 2008 database that I cannot alter. Within
> this database it has a field of integers but the field type is string. When
> I try to run the sum() function on that field I get  'gluon.contrib.pypyodbc.ProgrammingError'>((u'42000', u'[42000]
> [FreeTDS][SQL Server]Operand data type char is invalid for sum operator.'))
>
>
Try sum(int(db.sometable.somevalue))

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] 'module' object has no attribute 'startswith'

2015-09-03 Thread Johann Spies
We have an app working with a database on another server through an
ssh-tunnel.

The app is working.  But the admin app which worked previously suddenly
throws an error when one try to we tries the "database administration"
button - but only for this app.

The traceback is this:

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/wos_2015_3/views/appadmin.html"
,
line 93, in 
{{tablename=request.args[1]}}
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 899,
in __getitem__
return self.__getattr__(str(key))
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 905,
in __getattr__
return self.lazy_define_table(tablename, *fields, **args)
  File "/home/js/web2py/gluon/packages/dal/pydal/base.py", line 845,
in lazy_define_table
field.represent = auto_represent(field)
  File "/home/js/web2py/gluon/packages/dal/pydal/helpers/methods.py",
line 286, in auto_represent
if field.db and field.type.startswith('reference') and \
AttributeError: 'module' object has no attribute 'startswith'


How do I debug this?

migrate = False for all the tables with fake_migrate on for the
auth_related tables.

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] Re: Backup/Restore problem with web2py, postgres

2015-09-02 Thread Johann Spies
On 20 March 2011 at 07:05, Massimo Di Pierro 
wrote:

> ask web2py to repair it
>
> auth.define_tables(fake_migrate=True)
>
>
Installing an app on a second computer we tried this to overcome the
message: auth_user already exists.

It is not working.

How should this be done?  The database is on a central server and more than
one developer will work on the app.

Regards.
Johann

-- 
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] Grid query

2015-09-01 Thread Johann Spies
On 31 August 2015 at 15:17, Manuele Pesenti 
wrote:

> Il 31/08/15 09:54, Manuele Pesenti ha scritto:
> > to brutally by-pass the exception you can try something like...
> >
> > papers = db.wos_papers_by_dt.count.sum()
> > setitem(papers, "tablename", "wos_papers_by_dt")
> I apologize... I mean setattr not setitem.
>

Thanks.  More and more I am using pure sql to get things done, create views
and materialized views and just use Web2py to "show" the results.  I find
myself spending too much time to figure out how to do some more complicated
queries in DAL.  It is just easier to do whatever I want in SQL.

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] Grid query

2015-08-27 Thread Johann Spies
In SQL I can do

select doctype, sum(count) number
from wos.za_publications
where pubyear > 1979
group by doctype;

In the web2py shell I can do:

db.define_table('wos_papers_by_dt',
Field('pubyear', 'integer'),
Field('doctype'),
Field('count', 'integer'),
migrate = False,
rname = 'wos.za_publications')

papers = db.wos_papers_by_dt.count.sum()
query = db.wos_papers_by_dt.pubyear > 1979
l = db(query).select(db.wos_papers_by_dt.doctype,papers, groupby =
db.wos_papers_by_dt.doctype)


for i in
l:

print i['_extra']['SUM(wos.za_publications.count)'],
i['wos_papers_by_dt']['doctype']

which produces a similar result.

Why is it not working when, using the same model and logic I get an error
when I try to put the result in a grid?

za_arts = SQLFORM.grid(query,
   fields=[db.wos_papers_by_dt.doctype, papers],
   groupby = db.wos_papers_by_dt.doctype,
   headers = headers,
   create = False,
   editable = False,
   details = False,
   deletable = False,
   searchable = False
   )

raceback (most recent call last):
  File "/home/js/web2py/gluon/restricted.py", line 227, in restricted
exec ccode in environment
  File "/home/js/web2py/applications/wos_2015_3/controllers/wos_indicators.py"
,
line 169, in 
  File "/home/js/web2py/gluon/globals.py", line 412, in 
self._caller = lambda f: f()
  File "/home/js/web2py/applications/wos_2015_3/controllers/wos_indicators.py"
,
line 49, in za_arts_by_doctype
searchable = False
  File "/home/js/web2py/gluon/sqlhtml.py", line 2183, in grid
columns = [f for f in fields if f.tablename in tablenames]
AttributeError: 'Expression' object has no attribute 'tablename'


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] Re: ldap import problem

2015-08-26 Thread Johann Spies
Thanks Massimo.  After installing python-ldap the problem was solved.  I
did not realise that the package in gluon/contrib was dependent on external
stuff.

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] Re: ldap import problem

2015-08-24 Thread Johann Spies
On 24 August 2015 at 16:20, Massimo Di Pierro 
wrote:

So the problem is that it cannot import ldal. Do you know it works from the
> normal python shell?
>
> >>> import ldap
>
> Does it work from the web2py shell?
>


No, I cannot import ldap. I also tried it from another app (welcome) this
time:


In [1]: import ldap
---
ImportError   Traceback (most recent call last)
/home/js/web2py/applications/welcome/models/menu.py in ()
> 1 import ldap

/home/js/web2py/gluon/custom_import.pyc in custom_importer(name, globals,
locals, fromlist, level)
 87 result = result or
sys.modules[modules_prefix+'.'+itemname]
 88 except KeyError, e:
---> 89 raise ImportError, 'Cannot import
module %s' % str(e)
 90 modules_prefix += "." + itemname
 91 return result

ImportError: Cannot import module 'applications.welcome.modules.ldap'

and the same with ldap_auth:

import ldap_auth
---
ImportError   Traceback (most recent call last)
/home/js/web2py/applications/welcome/models/menu.py in ()
> 1 import ldap_auth

/home/js/web2py/gluon/custom_import.pyc in custom_importer(name, globals,
locals, fromlist, level)
 87 result = result or
sys.modules[modules_prefix+'.'+itemname]
 88 except KeyError, e:
---> 89 raise ImportError, 'Cannot import
module %s' % str(e)
 90 modules_prefix += "." + itemname
 91 return result

ImportError: Cannot import module 'applications.welcome.modules.ldap_auth'



Regards
Johann

-- 
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] Getting cannot import name table_field after upgrading to 2.12.3

2015-08-24 Thread Johann Spies
I had similar problems which convinced me to to stop using solidtable.

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] Re: ldap import problem

2015-08-24 Thread Johann Spies
Thanks Richard and Massimo for your replies.

Version 2.12.3-stable+timestamp.2015.08.18.19.14.07


Massimo, there is nothing in modules - only __init__.py

This is a new app.

Regards
Johann

-- 
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] display only 20 entries in a table

2015-08-20 Thread Johann Spies
You can either use SQLFORM.grid or use a technique explained in the book.
Search the book for 'pagination' and look in the results under "Other
recipes".

Regards
Johann

On 20 August 2015 at 14:34, Iancic Bogdan  wrote:

> I want the user to see all the results, but they are too many to be shown
> on a single page. That's why i would like to share them on different pages
>
> On Thursday, August 20, 2015 at 2:30:47 PM UTC+2, Johann Spies wrote:
>>
>> Why do not limit your query to 10 or 20 items?
>>
>> Regards
>> Johann
>>
>> On 20 August 2015 at 12:30, Iancic Bogdan  wrote:
>>
>>> I have a lot of entries in the table that I want to display, and as i
>>> already have other things on the same page, i want to make this table show
>>> only 10-20 entries per page. How can I add that?
>>>
>>> Here is the code I wrote in view:
>>>
>>> {{if prints:}}
>>> {{=T('Print history:')}}
>>> {{i=0}}
>>> 
>>> 
>>> #
>>> {{=T('Component name')}}
>>> {{=T('Component code')}}
>>> {{=T('Number of components')}}
>>> {{=T('Printing date')}}
>>> 
>>> 
>>> {{for design in prints:}}
>>> {{=i+1}}
>>> {{=design.fk_printhistory_componentcatalog.component_name}}{{=design.fk_printhistory_componentcatalog.component_code}}{{=design.no_of_components}}{{=design.time_stamp}}
>>> {{i=i+1}}
>>> {{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+un...@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.
>



-- 
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] display only 20 entries in a table

2015-08-20 Thread Johann Spies
Why do not limit your query to 10 or 20 items?

Regards
Johann

On 20 August 2015 at 12:30, Iancic Bogdan  wrote:

> I have a lot of entries in the table that I want to display, and as i
> already have other things on the same page, i want to make this table show
> only 10-20 entries per page. How can I add that?
>
> Here is the code I wrote in view:
>
> {{if prints:}}
> {{=T('Print history:')}}
> {{i=0}}
> 
> 
> #
> {{=T('Component name')}}
> {{=T('Component code')}}
> {{=T('Number of components')}}
> {{=T('Printing date')}}
> 
> 
> {{for design in prints:}}
> {{=i+1}}
> {{=design.fk_printhistory_componentcatalog.component_name}}{{=design.fk_printhistory_componentcatalog.component_code}}{{=design.no_of_components}}{{=design.time_stamp}}
> {{i=i+1}}
> {{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.
>



-- 
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] ldap import problem

2015-08-20 Thread Johann Spies
Why does this happen?  The import process seems to try and import the ldap
module from the modules directory and not from gluon/contrib/login_methods.

File "/home/js/web2py/applications/wos_2015_3/models/db.py"
,
line 11, in 
from gluon.contrib.login_methods.ldap_auth import ldap_auth
  File "/home/js/web2py/gluon/custom_import.py", line 108, in custom_importer
return NATIVE_IMPORTER(name, globals, locals, fromlist, level)
  File "/home/js/web2py/gluon/contrib/login_methods/ldap_auth.py",
line 14, in 
raise e
ImportError: Cannot import module 'applications.wos_2015_3.modules.ldap'


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] Re: rname for a reserved name?

2015-08-19 Thread Johann Spies
Thanks Nophlod.

Johann

-- 
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] rname for a reserved name?

2015-08-19 Thread Johann Spies
I am trying to create a model for an existing table which contains the
field 'state' which is according to web2py a reserved word.

This does not work:

  Field('province', rname='state', citext),
SyntaxError: non-keyword arg after keyword arg


I could not find a lot of documentation either in the book or the source
code on how to use rname for an alternative fieldname.  I use it regularly
to enable me to use schemas in PostgreSQL.

BTW, citext in the above field definition is not the problem:

citext = SQLCustomType(
type ='text',
native='citext' )

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] Pass html in label of SQLFORM.factory Field without it by sanitized

2015-07-16 Thread Johann Spies
Hello Thomas,

It seems that the css for label anyhow uses a strong font so
 would not have any visible effect. This is just to
illustrate how you can pass html in a form element:

label=XML('I consent for  to provide my contact information to ___.
I confirm that my house DOES NOT have aluminium siding. *'),

BTW "receive"  might be better than "receive". :)

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] Re: How to insert data in data base by xml file

2015-07-06 Thread Johann Spies
On 3 July 2015 at 23:43, Anthony  wrote:

> All of the effort will be in parsing the XML, so you should check the
> documentation of the various XML libraries and ask questions in their
> forums (or on Stack Overflow). The details will depend on the structure of
> your XML. Ultimately, you want to loop over the records in the XML, and for
> each record, build a dictionary where the keys are the DAL table field
> names and the values are the record values you want to insert. Once you
> have such a dictionary, the DAL insert for a single record is simple:
>
> db.mytable.insert(**record_dictionary)
>

Another approach is to import the XML-data directly into a PostgreSQL table
with and id (primary key) field and another field with the type XML.  This
can be queried using XPATH-like syntax in PostgreSQL (from web2py using
exexutesql) and if you want to import that into 'normal' tables, this can
be done within PostgreSQL using the above-mentioned xpath-based queries.

Both ways have a learning curve if you are not used to parsing XML-data.

Regards
Johann

-- 
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] We have released Censusgical,Census data visualization prototype for Myanmar.

2015-06-23 Thread Johann Spies
Impressive!

On 23 June 2015 at 13:49, Michele Comitini 
wrote:

> +1
>
> 2015-06-23 13:48 GMT+02:00 Phyo Arkar :
>
>> We have plan to release it opensource soon.
>>
>> On Tue, Jun 23, 2015 at 5:56 PM, Kiran Subbaraman <
>> subbaraman.ki...@gmail.com> wrote:
>>
>>>  Very nice stuff. Thanks for sharing.
>>> Do you have the code available on github, or any other open-source
>>> respository?
>>>
>>> 
>>> Kiran Subbaramanhttp://subbaraman.wordpress.com/about/
>>>
>>> On Tue, 23-06-2015 3:44 PM, Phyo Arkar wrote:
>>>
>>> Myanmar have released Census data in 30 years ,and we built a
>>> visualization for it .
>>> Powered by web2py, qooxdoo , d3js and uwsgi!
>>>
>>>  http://www.censusgical.com:8800/Censusgical
>>>   --
>>> 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.
>>>
>>
>>  --
>> 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.
>



-- 
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] Invalid password reset

2015-06-10 Thread Johann Spies
What would cause this error message if a user receives a link from web2py
to reset his password and when he clicks on it he gets the error : "invalid
password reset"?

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] Re: Web2py adding additional and not wanted orderby

2015-06-02 Thread Johann Spies
On 1 June 2015 at 20:22, Anthony  wrote:

> Thanks Anthony.  Correct.  I do not want it in all cases. After reading up
>> on it I came accross this link (
>> http://chrisdone.com/posts/postgresql-pagination) where the author
>> illustrates just how slow PostgreSQL's "OFFSET" can be which is probably
>> part of my problem in this case.  I will just have to develop alternative
>> methods to work with cases where one queries millions of rows.  One of my
>> tables has more than 500 million records.
>>
>
> The difference between your two cases wasn't whether OFFSET was used (both
> involved pagination) but rather whether the "id" field was used for
> sorting. Does the difference between the two queries go away if you remove
> the OFFSET?
>
>
Apologies for my unclear "in this case".  I actually meant the situation of
working with such large datasets.  No in the case of the original question
I was not moving away of OFFSET 0.

Thanks for your attention.

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] Re: Web2py adding additional and not wanted orderby

2015-06-01 Thread Johann Spies
On 1 June 2015 at 13:38, Anthony  wrote:

> Just to be clear, the old behavior was a bug (and a particular problem
> when the user sorted on a column within the grid, which overrides the
> original orderby). Pagination is a fundamental feature of the grid, so it
> ought to "just work." Note, we cannot leave it up to the developer to
> explicitly specify the proper set of orderby fields because of the issue
> with user-initiated sorting in the UI (which overrides the default ordering
> specified by the developer).
>
> You have a special case in which you are willing to risk pagination errors
> in order to boost speed. While that might be a reasonable trade-off in your
> particular case, it is not necessarily appropriate default behavior.
> However, we should certainly document the new behavior and the
> auto_pagination option.
>
> If you'd like, you can do something like the following in a model:
>
> import functools
> mygrid = functools.partial(SQLFORM.grid, auto_pagination=False)
>
> and then use mygrid in place of SQLFORM.grid in your code (though I
> suspect in most cases you would still prefer the default behavior in order
> to guarantee proper pagination when speed is not an issue).
>

Thanks Anthony.  Correct.  I do not want it in all cases. After reading up
on it I came accross this link (
http://chrisdone.com/posts/postgresql-pagination) where the author
illustrates just how slow PostgreSQL's "OFFSET" can be which is probably
part of my problem in this case.  I will just have to develop alternative
methods to work with cases where one queries millions of rows.  One of my
tables has more than 500 million records.

Regards
Johann

-- 
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: Web2py adding additional and not wanted orderby

2015-06-01 Thread Johann Spies
Thank you for the "sermon"  :)


Regards
Johann

-- 
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: Web2py adding additional and not wanted orderby

2015-06-01 Thread Johann Spies
After reading the discussion Anthony referred to, I would like to state
that I prefer the behaviour of the DAL/Grid query to result in the same
outcome as if I would have done with a raw query in PostgreSQL. I test my
queries in PG before I implement them in web2py because I work with fairly
large datasets. PostgreSQL's  pgsql does not use the id-field for
pagination if I specify an 'ORDER BY' and that is the way I prefer Web2py's
grid to work and as I understand it that is what 'autopagination = False'
does.

Thanks for all the hard work and thinking that goes into the coding.

Regards
Johann

-- 
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: Web2py adding additional and not wanted orderby

2015-06-01 Thread Johann Spies
On 28 May 2015 at 15:28, Anthony  wrote:

>
> On Thursday, May 28, 2015 at 6:33:25 AM UTC-4, Johann Spies wrote:
>
Does the db.isi_alt_names.code field contain unique values? If not, I don't
> think your pagination is guaranteed to work (i.e., you could get back
> different orderings within matching values of "code" on each select).
>
>
No. That field does not have a unique constraint.  The pagination is not
that important in this case.  The speed of the query and the first few
pages would be the most important factor.  And that is handled well enough
by the setup without web2py adding another ordering element.

Thanks for your replies.  I will go and read the discussion you referred to.

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] Re: Web2py adding additional and not wanted orderby

2015-05-28 Thread Johann Spies
On 28 May 2015 at 12:42, Niphlod  wrote:

auto_pagination = False.
>

When did this become part of Web2py?  I do not find it in the Changelog.
It works in the latest version but no in 2.9.5.

Regards
Johann

-- 
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: Web2py adding additional and not wanted orderby

2015-05-28 Thread Johann Spies
On 28 May 2015 at 12:42, Niphlod  wrote:

auto_pagination = False.
>
> That being said, mind that without ordering, pagination is inherently
> incorrect
>
>
Thanks.  Will that not respect my orderby = ~db.isi_alt_names.code?  I just
do not want the extra ordering added.

Maybe one can patch the code to only add ordering if there is no other
specified by the user.

Regards

Johann

-- 
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: Web2py adding additional and not wanted orderby

2015-05-28 Thread Johann Spies
Apologies for the unfinished message.  The Gmail interface in the browser
and I am not really friends.

The problem with the abovementioned query is that it adds a lot of load to
the server as there are 130+ million records in the rresearch table and
about as much in the isi_alt_names table making the query very slow.
Without the 'rresearch.id' in the orderby-section the query runs for about
200 ms and with it the sorting and merging of the sort results of the two
tables takes about 7 minutes.

How can I prevent web2py from adding the additional orderby field?

Regards.
Johann



On 28 May 2015 at 12:28, Johann Spies  wrote:

> The following code:
>
> query = ((db.rresearch.id == db.isi_alt_names.rsc_id)&
>   (db.rresearch.nu.upper().like(request.vars.country +
> '%')))
>
> data = SQLFORM.grid(query, searchable = False, links = links, fields =
> fields,
>  editable = False, deletable = False, details =
> False,
>  maxtextlength = 60,
>  create = False,
>  cache_count = count,
>  orderby = ~db.isi_alt_names.code)
>
> produces the following query:
>
> SELECT  rresearch.nf, rresearch.nu, isi_alt_names.code,
> isi_alt_names.institution, isi_alt_names.id, rresearch.id FROM rresearch, 
> isi_alt_names WHERE (rresearch.id = isi_alt_names.rsc_id) ORDER BY 
> isi_alt_names.code DESC, rresearch.id LIMIT 20 OFFSET 0;
>
>
> --
> 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.


[web2py] Web2py adding additional and not wanted orderby

2015-05-28 Thread Johann Spies
The following code:

query = ((db.rresearch.id == db.isi_alt_names.rsc_id)&
  (db.rresearch.nu.upper().like(request.vars.country +
'%')))

data = SQLFORM.grid(query, searchable = False, links = links, fields =
fields,
 editable = False, deletable = False, details =
False,
 maxtextlength = 60,
 create = False,
 cache_count = count,
 orderby = ~db.isi_alt_names.code)

produces the following query:

SELECT  rresearch.nf, rresearch.nu, isi_alt_names.code,
isi_alt_names.institution, isi_alt_names.id, rresearch.id FROM
rresearch, isi_alt_names WHERE (rresearch.id = isi_alt_names.rsc_id)
ORDER BY isi_alt_names.code DESC, rresearch.id LIMIT 20 OFFSET 0;


-- 
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] Specifying which fields are searchable with Smartgrid

2015-05-28 Thread Johann Spies
Try:

search_options = [] #see gluon/sqlhtml. where it is defined as

search_options = search_options or {
'string': ['=', '!=', '<', '>', '<=', '>=', 'starts with',
'contains', 'in', 'not in'],
'text': ['=', '!=', '<', '>', '<=', '>=', 'starts with',
'contains', 'in', 'not in'],
'date': ['=', '!=', '<', '>', '<=', '>='],
'time': ['=', '!=', '<', '>', '<=', '>='],
'datetime': ['=', '!=', '<', '>', '<=', '>='],
'integer': ['=', '!=', '<', '>', '<=', '>=', 'in', 'not in'],
'double': ['=', '!=', '<', '>', '<=', '>='],
'id': ['=', '!=', '<', '>', '<=', '>=', 'in', 'not in'],
'reference': ['=', '!='],
'boolean': ['=', '!=']}

fields = [fields you want to be searched]
 and then in your grid definition:

   form = SQLFORM.grid(db,
search_widget = lambda fields:
SQLFORM.search_menu(fields, search_options),
)

Regards
Johann

On 24 May 2015 at 12:19, Peter Gibson  wrote:

> The default search widget gives option to search on every field on the
> table.  How do I restrict it to just a couple of fields (title,
> description).
>
> --
> 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] Reportlab, Platypus and tables

2015-05-28 Thread Johann Spies
Sorry I ommitted one import:

import os

-- 
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] Reportlab, Platypus and tables

2015-05-28 Thread Johann Spies
On 28 May 2015 at 07:40, Jason (spot) Brower  wrote:

> Pdf reporting can take a lot of work. Is this for a single page report or
> many pages. How are formated? And do you have an examole report in pdf
> format?
>
>
I have used it once and it works.  Here is the code as example:

In the controller:

from reportlab.platypus import *
from reportlab.lib.styles import getSampleStyleSheet
from reportlab.rl_config import defaultPageSize
from reportlab.lib.units import inch, mm
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib import colors
from cgi import escape
from reportlab.lib.pagesizes import inch, A4, landscape
from reportlab.pdfgen import canvas

def doccenter_pdf():
#import pdb
#pdb.set_trace()

query = request.vars.query
data = db(query).select(db.doccenter.doc_nr,
db.doccenter_location.location,
db.doccenter.author, db.doccenter.title,
db.doccenter.institution,
db.doccenter.reference, db.doccenter.source,
db.doccenter.publication_date,
db.doccenter.keywords,
db.doccenter.anual_report,
db.doccenter_category.category,
orderby = db.doccenter.publication_date |
db.doccenter.author)

title = T('Doccenter search result')
styles = getSampleStyleSheet()
tmpfilename = os.path.join(request.folder, 'private', str(uuid4()))


normalStyle = styles['Normal']

cols = [('doccenter', 'doc_nr'),
('doccenter_location', 'location') ,
('doccenter', 'author') ,
('doccenter', 'title'),
('doccenter', 'institution'),
('doccenter', 'reference'),
('doccenter', 'source'),
('doccenter', 'publication_date'),
('doccenter', 'keywords'),
('doccenter', 'anual_report'),
('doccenter_category', 'category')]

hds = ['doc_nr', 'location', 'author', 'title', 'institution',
   'reference', 'source', 'date',
'keywords', 'anual_report', 'category']


headings = [Paragraph('''
%s ''' % '
'.join(c.split('_')).capitalize(),
  styles["BodyText"]) for c in hds]

lst = [headings]
for item in data:

rec = []
for ikey in cols:
#import pdb; pdb.set_trace()
rec.append(par_from_item(item[ikey[0]][ikey[1]], styles))

lst.append(rec)


elements = []
elements.append(Paragraph(escape(title), styles['Title']))


# First the top row, with all the text centered and in Times-Bold,
# and one line above, one line below.
ts = [('ALIGN', (1, 1), (-1, -1), 'CENTER'),
  ('LINEABOVE', (0, 0), (-1, 0), 1, colors.purple),
  ('LINEBELOW', (0, 0), (-1, 0), 1, colors.purple),
  ('FONT', (0, 0), (-1, 0), 'Times-Bold'),

  # The bottom row has one line above, and three lines below of
  # various colors and spacing.
  ('LINEABOVE', (0, -1), (-1, -1), 1, colors.purple),
  ('LINEBELOW', (0, -1), (-1, -1), 0.5, colors.purple,
   1, None, None, 4, 1),
  ('LINEBELOW', (0, -1), (-1, -1), 1, colors.red),
  ('FONT', (0, -1), (-1, -1), 'Times-Bold')]

#  Alternate row background
for i, _ in enumerate(lst):
if odd(i):
ts.append(("BACKGROUND", (0, i), (-1, i), colors.cyan))
t = Table(lst, style = ts)
# Adjust column width
t._argW[3] = 1.8 * inch
t._argW[5] = 1.0 * inch
t._argW[0] = 1.0 * inch

t.setStyle(TableStyle())

elements.append(t)

doc = SimpleDocTemplate(tmpfilename, pagesize = landscape(A4))
doc.build(elements, canvasmaker = NumberedCanvas)
pdf = open(tmpfilename, "rb").read()
os.unlink(tmpfilename)
response.headers['Content-Type'] = 'application/pdf'
return pdf

As you can see there was a lot of work and experimenting involved.

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] wsgi / apache error

2015-05-28 Thread Johann Spies
Thanks Marko and Niphlod.

I do not think it is a permissions problem in the app somewhere.   I did
not have a cache/ directory but then I do not use cache.disk.

The issue Niphlod refers to seems to be related.  I could see no solution
there though :(

My problem is not (as suggested in some message in that thread) that the
message appears in the log.  The problem is that it breaks the app on that
point. The user cannot continue with the task.

On our other server the same code works with the same code and data. The
only difference as far as software goes is that we use nginx/uwsgi on the
other server.

Regards
Johann

On 27 May 2015 at 21:57, Niphlod  wrote:

> I suspect instead it's due to
> https://code.google.com/p/modwsgi/issues/detail?id=29&can=1
>
>
> for reference (i.e. even if I don't think it's the issue at hand) web2py
> just needs to write:
> - to the cache/ folder (if you're using cache.disk)
> - the session/ folder (if you're using the default file-storage backend
> and not, e.g., memcache or redis)
> - the uploads/ folder (if you're using "upload" Fields)
>
>
>  --
> 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.


[web2py] wsgi / apache error

2015-05-27 Thread Johann Spies
Most parts of the app work on our server running apache2.4 and wsgi but on
after a query which takes some time I get this in the apache error log and
504 Gateway Timeout on my browser:

[Wed May 27 14:20:46.617759 2015] [wsgi:error] [pid 18286:tid
140225013630720] [remote x.x.x.x:10678] mod_wsgi (pid=18286): Exception
occurred processing WSGI script '/home/www-data/web2py/wsgihandler.py'.
[Wed May 27 14:20:46.617850 2015] [wsgi:error] [pid 18286:tid
140225013630720] [remote x.x.x.x:10678] IOError: failed to write data

Now my question: where did wsgi try to write data?

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] SQLFORM.grid multiple left joins and where clause

2015-05-11 Thread Johann Spies
On 10 May 2015 at 04:26, A36_Marty  wrote:

>
> fields = db.auth_user.first_name, db.auth_group.role
>

Make that

fields = [db.auth_user.first_name, db.auth_group.role]

fields should be a list.


query = (db.auth_user)&(db.auth_group.id == PARENT_GROUP_ID)  #get query
not supported error by the grid

You did have the variable 'query' defined two times. Is the second one
supposed to replace the first one.


And you did not show where you get PARENT_GROUP_ID from.

*2) How to custom-format a column based on field values?*
>
> In the above grid example, if an auth_group.role of "Parent" is returned,
> how can show something like a check mark (or any like boolean yes/no flag)
> and nothing for anything other auth_group.role values?
>
>
You can write a function to use with field.represent and use that.

Here is an example of what I have used in the past.

def get_url(url, record):
if url:
address = A('click here to see pdf', _target = "_blank",
_href = "some_prefix'%s'" % url)
else:
address = ''
return address


And in the model:

Field("url", represent = lambda x, record:
get_url(x,record)),

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] delete session value that store query as_list()

2015-05-04 Thread Johann Spies
On 1 May 2015 at 10:44, 黄祥  wrote:


>
> the problem is if i just use one all value that store in session detail is
> not deleted all, always remain i=1, so that i must take two steps for that.
> is it the correct way to handle it in web2py?
>
>
I see Session() is as Storage object and with a storage object you can do:

  >>> o = Storage(a=1)
>>> print o.a
1

>>> o['a']
1

>>> o.a = 2
>>> print o['a']
2

>>> del o.a
>>> print o.a
None


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] parenthesis in SQLFORM.grid search

2015-04-30 Thread Johann Spies
Will it not be easier to encapsulate your complex query in a database view
and run the grid on the view?

e.g.  in the controller:
db.execute(create view xx as complexquery)

db.define_table('xx',
Field1(),
Field2...



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] 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" 
>>> <http://localhost:8000/admin/default/edit/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" 
>>> <http://localhost:8000/admin/default/edit/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.


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" 
>> <http://localhost:8000/admin/default/edit/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" 
>> <http://localhost:8000/admin/default/edit/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.


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


Re: [web2py] Re: web2py Complete Reference Manual

2015-04-21 Thread Johann Spies
Maybe
https://colflash.cdm.depaul.edu/colflashweb/COLFlashPlayer.aspx?ID=183272

On 9 April 2015 at 01:00, Carlos Zenteno  wrote:

>
>
> @Ron:  There is a video somewhere, where Anthony talks about the inner
> works of web2py.
> Let me see if I can find it, unless someone nice, beats me to post 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.
>



-- 
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: Cloning SQLlite into PostgreSQL

2015-04-08 Thread Johann Spies
> For a new application it's not a problem, but someone have an experience
> about converting tables from standard ID to GUID?
>
>
Firstly: backup :)

I have done some conversions in the past. If I remember correctly, I added
an extra column (say 'uuid'), filled it with unique values, created foreign
keys (using the id-based system to identify the correct links) and then
test to see whether everything is linked as it should be.

After double checking, remove the id-based references.

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] Re: Cloning SQLlite into PostgreSQL

2015-04-08 Thread Johann Spies
On 2 April 2015 at 13:00, Gael Princivalle 
wrote:

> Hi Philip.
>
> Using UUIDs make the db slower right?
>

Why? On huge databases the indexing will be slower but queries should not
be slower than systems not using uuid.

> http://simononsoftware.com/how-to-store-uuids-in-postgresql/
> And you can't store a record like that:
> my_record = db.my_table(1)
>

Why not? You can do it.  You just use the uuid's when referencing a record
in foreign keys.

When you do that, you cannot use

Field('thisfield', 'reference othertable.otherfield' )

but you can do

IS_IN_DB(...)

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] Re: web2py Complete Reference Manual

2015-04-07 Thread Johann Spies
On 4 April 2015 at 13:57, José Ricardo Borba  wrote:

> We left summer few weeks ago. It's late?
> ;-)
>

As a South African, I enjoyed your remark! :)

Regards
Johann

-- 
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: Cloning SQLlite into PostgreSQL

2015-04-01 Thread Johann Spies
On 31 March 2015 at 20:19, Gael Princivalle 
wrote:

> Thanks Ron but:with CSV export:
> auth_user_iduser
> 3 John
> 7 Sally
>
> And then you import your CSV file you will have:
> auth_user_iduser
> 1 John
> 2 Sally
>
> And so all relations between tables will be broken.
> Someone have a solution?
>
>
Search the book for
CSV (all tables at once)


and you wil see that if you export the whole database to csv and import it
through web2py, the integrity of the references will be preserved.

Regards
Johann

-- 
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: Rendering null values in SQLFORM.grid

2015-03-30 Thread Johann Spies
You should be able to use field.represent to do that.  If the value is
None, then show something else like ''.

Regards
Johann

On 30 March 2015 at 14:54, JorgeH  wrote:

> I am dealing with the same issue these days. Client told me to remove all
> those 'None' fields.
>
>
>
>
> On Monday, March 30, 2015 at 7:36:51 AM UTC-5, Mirek Zvolský wrote:
>>
>> >> null value is not an empty string
>>
>> That's true.
>> However we make applications for customers and they aren't interested to
>> see a technical value 'None', but the language translated value (something
>> like T(None)) or symbol for None content.
>> So I think it would be better if we have parameter how to represent None
>> values elsewhere.
>> Mi
>>
>>
>>
>>
>> Dne pondělí 10. června 2013 17:32:33 UTC+2 Niphlod napsal(a):
>>>
>>> The second one you said (i.e. altering the default repr for None
>>> values). From a "theoretical" standpoint, a null value is not an empty
>>> string. If your app doesn't care for the difference, set a default='' on
>>> the interested fields.
>>>
>>> Il giorno lunedì 10 giugno 2013 15:42:21 UTC+2, Lamps902 ha scritto:

 If there's a NULL value in my postgresql DB, SQLFORM.grid renders it as
 "None". Is it there something that can be done globally for an SQLFORM.grid
 that would simply make it display all NULL values as an empty string (i.e.
 not display anything in the grid for NULLs), or does that have to be
 determined individually for every field by setting the respective field's 
 *represent
 *parameter? Thanks.

>>>  --
> 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] Executesql SQLFORM.grid

2015-03-16 Thread Johann Spies
What I do is to create a view or "create table as (select...)" and then
define a table in the controller to correspond to the view or table and
then use the grid to show the data in the view/table.  If your query is one
that will be repeated a lot of times you can make use of "materialized
views"  in PostgreSQL 9.4.

Regards
Johann

-- 
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] Select categories that are in use

2015-03-16 Thread Johann Spies
Good to know.  Thanks.

Johann

-- 
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] Select categories that are in use

2015-03-16 Thread Johann Spies
On 10 March 2015 at 13:44, Niphlod  wrote:

> 2 queries ? no
>
> subselect - way, 1 query.
>
>
And you think using a subselect makes it one query?

I had a mistake in my query: orderby should be groupby  - which is more
efficient (at least on PostgreSQL than using "distinct").

A query explain on your query shows:

[image: Inline images 1]

Thinking a subselect makes it one query is an illusion.

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] cannot perform INSERT RETURNING on VIEW

2015-03-16 Thread Johann Spies
On 10 March 2015 at 01:51, Val K  wrote:


> It's no problem while INSERT into TABLE, but not  for VIEW
> "If you want to support RETURNING queries on the view, you need to make
> the rules include RETURNING clauses that compute the view rows. This is
> usually pretty trivial for views on a single table, but it's a bit tedious
> for join views
> "
> RETURNING from join view looks like this:
>

In this case I would just use raw sql and not DAL' s insert.

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] Select categories that are in use

2015-03-10 Thread Johann Spies
Try this (untested)


categories_used = [x.category for x in
db().select(db.news.category,orderby=db.news.category))]

categories = db(db.news_categories.id.belongs(categories_used).select(
db.news_categories.name)

Johann

On 9 March 2015 at 18:53, Gael Princivalle 
wrote:

>
>  Hello all.
>
> I've got some news categories:
> db.define_table('news_categories',
> Field('name', type='string', requires=IS_NOT_EMPTY(),
> label='Nome'),
> format = '%(name)s')
>
> And some news:
> db.define_table('news',
> Field('title', type='string', requires=IS_NOT_EMPTY()),
> Field('body', type='text''),
> Field('category', 'reference news_categories', requires =
> IS_IN_DB(db, db.news_categories.id,'%(name)s'),
>   represent=lambda id, r: db.news_categories[id].name))
>
> How can I select only the news_categories that have almost one news of
> that category ?
> Now I've got all categories.
> categories=db().select(db.news_categories.ALL)
>
> Thanks.
>
>  --
> 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: Global search form example

2015-03-09 Thread Johann Spies
On 9 March 2015 at 20:08, Ron Chatterjee  wrote:

> SQLFORM.build_query[(db.table.field)]
>
> Passing a list ([]) into that will give you a text in that field. and then
> you can use a form input to do the display like the book on page 84 on the
> book. Damn I am getting good at this!
>

Which book are you talking about.  Although I can see SQLFORM.build_query
in the code (sqlhtml.py), I could find no reference to it in the online
book.

Also finding page 84 on the online book is a bit difficult ... :)

Regards
Johann

-- 
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] SQLFORM Validation and Password Hashes

2015-03-09 Thread Johann Spies
On 10 March 2015 at 06:53, horridohobbyist 
wrote:

I use SQLFORM to add records to a table. However, one of the fields is a
> password which requires=[IS_STRONG(upper=2),CRYPT(salt=False)].
>
> I would like to use SQLFORM to update records in the table, but I run into
> a problem:  the password field contains the hash of the password, which
> will not pass validation. So even if I don't change the password field,
> SQLFORM insists that I enter something that can be validated.
>
> If I can't use SQLFORM, then I will have to build my own form and do
> everything from scratch, essentially mimicking SQLFORM. That seems to me to
> be a lot of unnecessary work.
>
> Is there an easy workaround?
>
> (Yeah, I'm still a web2py newbie.)
>

Showing your code will help people on this list to help you.

Regards
Johann

-- 
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: Bootstrap is really killing web2py

2015-03-09 Thread Johann Spies
Try createing a new app from the admin interface and replace it's bootstrap
css-files (in static/css) and js-files (in static/js) with bootstrap3 files
and see what you get.

Regards
Johann

On 5 March 2015 at 07:16, Moiz Nagpurwala  wrote:

> Hello,
>
> I'm using latest relaease of web2py on my local machine. (
> 2.9.12-stable+timestamp.2015.02.15.23.04.25 (Running on Rocket 1.2.6,
> Python 2.7.9))
> Unable to install the w2p file provided for BS 3.
>
> Please help.
>
> --
> 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: Trunk unusable after this morning's git pull

2015-02-10 Thread Johann Spies
On 9 February 2015 at 20:51, Massimo Di Pierro 
wrote:

> Can you try:
>
> python web2py.py -S welcome
> >>> from gluon.dal import _default_validators
>
> what error do you get?
>

I had to get web2py working so I just unpacked a web2py_src.zip over the
existing installation.

Today I did a new "git clone" and then got the same pydal message when I
tried to run web2py.  After
git_submodule... as suggested by the error mesage web2py did run calling
the welcome app:

In [2]: from gluon.dal import _default_validators
  File "", line 1
from gluon.dal import _default_validators
   ^
SyntaxError: invalid syntax



> Do you have a file called gluon/dal.py?
>
> No

But I see the following difference between the newly cloned version and the
one I unpacked from the zipfile:

In the latter dal is under gluon/dal/
and in the one from git: gluon/packages/dal/


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] Trunk unusable after this morning's git pull

2015-02-08 Thread Johann Spies
After "git pull" this morning  I could not start web2py:
---
RuntimeError: web2py depends on pydal, which apparently you have not
installed.
Probably you cloned the repository using git without '--recursive'
To fix this, please run (from inside your web2py folder):

git submodule init && git submodule update
--
After "git submodule init && git submodule update":
--
Traceback (most recent call last):
  File "web2py.py", line 18, in 
import gluon.widget
  File "/home/js/web2py/gluon/__init__.py", line 37, in 
from sqlhtml import SQLFORM, SQLTABLE
  File "/home/js/web2py/gluon/sqlhtml.py", line 34, in 
from gluon.dal import _default_validators
ImportError: cannot import name _default_validators


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] syntax for making var appear in view

2014-12-01 Thread Johann Spies
On 1 December 2014 at 09:23, Alex Glaros  wrote:

Question one:
>
> This is in controller:
> vars=dict(Alex=99)
>
> This is in view:
> Alex = {{ =response.get_vars.Alex}} 
>
> error is:  'NoneType' object has no attribute 'Alex'.  I assume this is
> not the way to get a var to show up in view.  What is correct syntax?
>
> Try
 Alex = {{=Alex}} 



Regards
Johann

-- 
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] update_or_insert error

2014-12-01 Thread Johann Spies
On 28 November 2014 at 07:26, T.R.Rajkumar  wrote:

> When I do update_or_insert into a table in postgresql I get the following
> error. My code is below.
>  ('ERROR', '42601',
> 'syntax error at or near "<"')
>
What does the  generated query look like?

Regards
Johann

-- 
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: multiple select plugin and list reference

2014-11-30 Thread Johann Spies
On 28 November 2014 at 13:13, Kevin Bethke  wrote:

>
> How do I open up the console to check for javascript errors?
>
>
If you use Firefox, open Firebug (you may have to install it) in the
developer menu.  Chrome also have a menu item for developer tools and so
Opera.

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] PostgreSQL migrate / fake_migrate_all failure with relation does not exists

2014-11-30 Thread Johann Spies
>
> My migrations suddenly failed with
>


> Error:
>  ('ERROR', '42P01',
> 'relation "wiki_page" does not exist')
>
>

If the relation does exist in Postgresql (which is why you want to
migrate), try and move the related file in //databases/ for that table
to another destination (say /var/tmp) and try again.

If the relation does not exist in Postgresql and you want the app not to be
able to create tables freely, change the migrate to True (and fake_migrate
to False), run the app once, and change migrate and fake_migrate to their
previous status.

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] Hardcoded Drop Down Menu In Form

2014-11-25 Thread Johann Spies
On 26 November 2014 at 01:47, Pablo Cruise  wrote:

> I'm a novice Web2py programmer and I've searched the net but can't figure
> this out.
>


I've seen many example using SQLFORM but I don't have a need for these
> fields to be saved or retrieved to/from a database.
>
>
Why don't you use SQLFORM.factory?

A quote from the web2py-book:


*There are cases when you want to generate forms as if you had a database
table but you do not want the database table. You simply want to take
advantage of the SQLFORM capability to generate a nice looking CSS-friendly
form and perhaps perform file upload and renaming.*

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] Re: Another import problem

2014-11-17 Thread Johann Spies
Solved:  __init__.py was also missing in the top directory of the app.

Thanks for your help.

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] Mercurial?

2014-11-16 Thread Johann Spies
According to https://code.google.com/p/web2py/source/checkout the Mercurial
repository should still  be valid, but it differs from the git repository
e.g. the file gluon/dal/adaptors/postgres.py does not appear in the
mercurial repository while the problem has been corrected in the git
repository:  postgre.py => postgres.py.

If the mercurial repository is no longer to be trusted, then I suppose the
information on the abovementioned link should be updated.

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.


  1   2   3   4   5   6   7   8   9   10   >