Re: [web2py] Re: Custom Auth module

2018-11-08 Thread Ben Duncan
Great!

The second part about defining (not recommend) is what I need
However, I will be interfacing with external applications and predefined
tables,
so that should work out just fine.

I can add the rest of the "Auth" tables to my external definitions
(Postgres)

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Thu, Nov 8, 2018 at 3:35 PM 黄祥  wrote:

> ref:
>
> http://web2py.com/books/default/chapter/29/09/access-control#Customizing-Auth
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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] Custom Auth module

2018-11-08 Thread Ben Duncan
I need to have a custom authentication module - mainly pointing to
and using my own  auth_user and auth_group tables

Which modules from the base (welcome) do I need to change or what
documentation do i need to read up on on how to do this ...

Thanks

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
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] Issues using pydal

2018-11-05 Thread Ben Duncan
Ok, thanks ... JUST figured that out 
Is there any OTHER classes I need to include or just those 2 ?

Thanks ...

*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division


On Mon, Nov 5, 2018 at 11:52 AM Roberto Perdomo 
wrote:

> You forgot import Field:
>
> from dal import DAL, Field
>
> El lun., 5 de nov. de 2018 5:25 p. m., Ben Duncan 
> escribió:
>
>> I put together this simple test case to get familiar with DAL (using
>> Pydal)
>>
>> Connection stuff works, but I get this message
>> [postgres@su-postgres-ben-3 mec_layouts]$ ./pydalgetrec.py
>> postgres://postgres:postgres@localhost:7103/ac03303_live
>> postgres
>> Traceback (most recent call last):
>>   File "./pydalgetrec.py", line 20, in 
>> Field('company_number', type='integer'),
>> NameError: name 'Field' is not defined
>>
>> Source is :
>>
>> 
>> #!/usr/bin/env python
>> # -*- coding: utf-8 -*-
>> # test
>> ###
>> # Something ...
>> 
>>
>>
>> import os, sys, string, copy, time
>> import getopt
>> from types import *
>>
>> from pydal import DAL
>>
>> db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live",
>> pool_size=10, migrate_enabled=False, fake_migrate_all=True )
>> print db._uri
>> print db._dbname
>>
>> db.define_table('company',
>> Field('company_number', type='integer'),
>> Field('company_name', type='string', length=255),
>> Field('address_1', type='string', length=255),
>> Field('address_2', type='string', length=255),
>> Field('city', type='string', length=255),
>> Field('state', type='string', length=20),
>> Field('zip', type='string', length=10),
>> Field('country', type='string', length=255),
>> primarykey=['company_number'],
>> migrate=False)
>>
>> sys.exit(0);
>> 
>>
>>
>> Any ideas on what is going on?
>>
>> thanks ..
>>
>>
>>
>> *Ben Duncan*
>> DBA / Chief Software Architect
>> Mississippi State Supreme Court
>> Electronic Filing Division
>>
>> --
>> 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.


[web2py] Issues using pydal

2018-11-05 Thread Ben Duncan
I put together this simple test case to get familiar with DAL (using Pydal)

Connection stuff works, but I get this message
[postgres@su-postgres-ben-3 mec_layouts]$ ./pydalgetrec.py
postgres://postgres:postgres@localhost:7103/ac03303_live
postgres
Traceback (most recent call last):
  File "./pydalgetrec.py", line 20, in 
Field('company_number', type='integer'),
NameError: name 'Field' is not defined

Source is :

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# test
###
# Something ...



import os, sys, string, copy, time
import getopt
from types import *

from pydal import DAL

db = DAL("postgres://postgres:postgres@localhost:7103/ac03303_live",
pool_size=10, migrate_enabled=False, fake_migrate_all=True )
print db._uri
print db._dbname

db.define_table('company',
Field('company_number', type='integer'),
Field('company_name', type='string', length=255),
Field('address_1', type='string', length=255),
Field('address_2', type='string', length=255),
Field('city', type='string', length=255),
Field('state', type='string', length=20),
Field('zip', type='string', length=10),
Field('country', type='string', length=255),
primarykey=['company_number'],
migrate=False)

sys.exit(0);



Any ideas on what is going on?

thanks ..



*Ben Duncan*
DBA / Chief Software Architect
Mississippi State Supreme Court
Electronic Filing Division

-- 
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: off topic: pg_dump syntax for pythonanywhere

2018-11-05 Thread Ben Duncan
It depends on whether or not you on the local host as postgres or not, some
of the parameters.
This is what I use when logged on the the local postgres server:
For everything in the cluster:

pg_dumpall -h 127.0.0.1 -p ${DEST_PORT} -f /backup/pgdump.sql

For just a pg_dump:
pg_dump -c -f /backup/pgdump.sql ${PGDATABASENAME}

There are myriad ways to do pg_dump - local host, server to server
...etc..

IF you can tell me exactly what you are trying to do, I can help ...

Ben Duncan
DBA / Chief Software Architect
Ms State Supreme Court


On Sun, Nov 4, 2018 at 7:25 PM Alex Glaros  wrote:

> Alexandra, I have not used it recently and only have my notes below:
>
> pg_dump --host=
> yourPythonAnywhereDbName.postgres.pythonanywhere-services.com
> --dbname=postgres_myDbName --(note: I don't know how to handle password)
> --port=10097 --username=yourPythonAnywhereRole --format=c
> --file=pg_alex_backup`date +%F-%H%M`.dump
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Which is correct in DAL?

2018-10-31 Thread Ben Duncan
In the books and the online manuals I see foreign key references as ( from
my table):

db.define_table('gl_chart',
Field('company_number', 'reference company', ondelete='CASCADE'),
Field('gl_account_num', type='string', length=20), .

But the extract_pgsql_models.py does a version like this:

db.define_table('gl_chart',
Field('company_number', type='reference company', ondelete='CASCADE'),
Field('gl_account_num', type='string', length=20), 

Which is correct just the 'reference xyz' or the type='reference xyz' ?

Thanks ...
Ben Duncan

-- 
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: DAL and DB VIEWS

2018-10-29 Thread Ben Duncan
Ok, found the answer ...
https://groups.google.com/forum/#!topic/web2py/DCsnCkQnIoA

On Mon, Oct 29, 2018 at 12:27 PM Ben Duncan  wrote:

> I'm thinking it should be no different than defining a table, since these
> are all external / predefined tables.
> The difference is that Postgres handles the sql and I'm guessing with DAL,
> it's just data returned.
>
> Ben Duncan
>
> On Mon, Oct 29, 2018 at 12:14 PM 黄祥  wrote:
>
>> had you try DAL's execute sql ?
>> ref:
>>
>> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#executesql
>>
>> best regards,
>> stifan
>>
>> --
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> ---
>> You received this message because you are subscribed to the Google Groups
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to web2py+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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: DAL and DB VIEWS

2018-10-29 Thread Ben Duncan
I'm thinking it should be no different than defining a table, since these
are all external / predefined tables.
The difference is that Postgres handles the sql and I'm guessing with DAL,
it's just data returned.

Ben Duncan

On Mon, Oct 29, 2018 at 12:14 PM 黄祥  wrote:

> had you try DAL's execute sql ?
> ref:
>
> http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#executesql
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 and DB VIEWS

2018-10-29 Thread Ben Duncan
Is it possible to use predefined Postgres views inside of DAL?

By views i mean (SQL code)

CREATE VIEW myview AS
select ..
from tablea, tableb
WHERE ..
);

Thanks
Ben Duncan

-- 
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] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Also found this:

http://python-future.org/compatible_idioms.html

On Thu, Oct 11, 2018 at 10:30 AM Ben Duncan  wrote:

> Try These suggestions:
>
>
> https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
> http://www.evanjones.ca/python-utf8.html
>
>
> On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari 
> wrote:
>
>> Hi,
>>
>> the encode-decode problem on question 1 is mostly related to the opening
>> of files. For example:
>>
>> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
>> if PY2:
>> lines = open(filename)
>> else:
>> lines = open(filename, encoding='utf-8')
>>
>> In PY2 there is no option for the encoder, while on PY3 it is mandatory.
>>
>> I'm still learning, too ;-)
>> Nico
>>
>>
>> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
>> ha scritto:
>>
>>> Exactly what are you running into?
>>>
>>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>>> ..
>>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>>> had to become
>>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>>
>>> And so one.
>>>
>>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>>
>>> FWIW, I'm just making the transition to Python 3,6 so I'm learning
>>> things the hard way ...
>>>
>>> Ben Duncan
>>>
>>>
>>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
>>> wrote:
>>>
>>>> Hello,
>>>>
>>>> I'm playing with the web2py-book app, in order to make it python 3
>>>> compatible and also to improve it a bit. I have a couple of questions
>>>> related to default.py:
>>>>
>>>> 1. there were some encode-decode errors. I was able to resolve them
>>>> (see https://github.com/nicozanf/web2py-book for a preview) but I was
>>>> forced to use many "IF PY2 / else" conditions, in order to preserve python
>>>> 2.7 compatibility.  Is there a more elegant and pythonic solution to manage
>>>> this and similar situations?
>>>>
>>>> 2. I've added a try/except condition, in order to catch a missing
>>>> library (pygments). It works fine, but the session.flash error message is
>>>> not displayed at all because it's followed by a  redirect to index itself
>>>> and there is a session.forget() on the top that cleans it. If I comment the
>>>> session.forget() the flash message is correctly displayed. What can I do?
>>>>
>>>> Cheers,
>>>> Nico
>>>>
>>>> --
>>>> 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.


Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Try These suggestions:

https://stackoverflow.com/questions/491921/unicode-utf-8-reading-and-writing-to-files-in-python/83
http://www.evanjones.ca/python-utf8.html


On Thu, Oct 11, 2018 at 9:38 AM Nico Zanferrari  wrote:

> Hi,
>
> the encode-decode problem on question 1 is mostly related to the opening
> of files. For example:
>
> filename = os.path.join(FOLDER, subfolder, 'chapters.txt')
> if PY2:
> lines = open(filename)
> else:
> lines = open(filename, encoding='utf-8')
>
> In PY2 there is no option for the encoder, while on PY3 it is mandatory.
>
> I'm still learning, too ;-)
> Nico
>
>
> Il giorno gio 11 ott 2018 alle ore 16:16 Ben Duncan 
> ha scritto:
>
>> Exactly what are you running into?
>>
>> I ran into this with my rewrite of of extract extract_pgsql_models.py:
>> ..
>> f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
>> had to become
>>  f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])
>>
>> And so one.
>>
>> The changes work across Python 2.7 and 3.6 seamlessly now ...
>>
>> FWIW, I'm just making the transition to Python 3,6 so I'm learning things
>> the hard way ...
>>
>> Ben Duncan
>>
>>
>> On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari 
>> wrote:
>>
>>> Hello,
>>>
>>> I'm playing with the web2py-book app, in order to make it python 3
>>> compatible and also to improve it a bit. I have a couple of questions
>>> related to default.py:
>>>
>>> 1. there were some encode-decode errors. I was able to resolve them (see
>>> https://github.com/nicozanf/web2py-book for a preview) but I was forced
>>> to use many "IF PY2 / else" conditions, in order to preserve python 2.7
>>> compatibility.  Is there a more elegant and pythonic solution to manage
>>> this and similar situations?
>>>
>>> 2. I've added a try/except condition, in order to catch a missing
>>> library (pygments). It works fine, but the session.flash error message is
>>> not displayed at all because it's followed by a  redirect to index itself
>>> and there is a session.forget() on the top that cleans it. If I comment the
>>> session.forget() the flash message is correctly displayed. What can I do?
>>>
>>> Cheers,
>>> Nico
>>>
>>> --
>>> 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.


Re: [web2py] Help needed with web2py-book app

2018-10-11 Thread Ben Duncan
Exactly what are you running into?

I ran into this with my rewrite of of extract extract_pgsql_models.py:
..
f['type'] = "'decimal({},{})'".format(f['precision'],f['scale'])
had to become
 f['type'] = "'decimal({0},{1})'".format(f['precision'],f['scale'])

And so one.

The changes work across Python 2.7 and 3.6 seamlessly now ...

FWIW, I'm just making the transition to Python 3,6 so I'm learning things
the hard way ...

Ben Duncan


On Wed, Oct 10, 2018 at 4:02 PM Nico Zanferrari  wrote:

> Hello,
>
> I'm playing with the web2py-book app, in order to make it python 3
> compatible and also to improve it a bit. I have a couple of questions
> related to default.py:
>
> 1. there were some encode-decode errors. I was able to resolve them (see
> https://github.com/nicozanf/web2py-book for a preview) but I was forced
> to use many "IF PY2 / else" conditions, in order to preserve python 2.7
> compatibility.  Is there a more elegant and pythonic solution to manage
> this and similar situations?
>
> 2. I've added a try/except condition, in order to catch a missing library
> (pygments). It works fine, but the session.flash error message is not
> displayed at all because it's followed by a  redirect to index itself and
> there is a session.forget() on the top that cleans it. If I comment the
> session.forget() the flash message is correctly displayed. What can I do?
>
> Cheers,
> Nico
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] GITHUB and my updates

2018-10-03 Thread Ben Duncan
Ok, I'll confess I've never used github. and am now totally lost.

I have, however uploaded my update to bens4linux/web2py, my update for a
utility called
extract_pgsql_models_v2.0.0.py and the read me for it.

I'm not sure what to do at this point as I would like to contribute to the
web2py project.

In the coming days/weeks/months i will be uploading a TOTAL ERP Postgres
Template layout for tables that meets or exceeds GAPP requirements.

I's based upon the 40+ years of commercial and open source systems that
i've worked on.

That is if anyone is interested.

Thanks

Ben Duncan

-- 
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] Foreign Keyes and DAL .. again.

2018-09-25 Thread Ben Duncan
Ok, I think I might have found a work around on my DAL issues with multiple
defined FK values.

But I have a question (Postgesql DB by the way)

Since I have these tables defined as "legacy", what would the ramifications
be
if I left extract_pgsql_models.py define my tables with only one foreign
keye then made sure migrate is always false and then defined my other FK
values for the tables?

>From what i can read, it's just the db.define_table that I need to
circumvent the multi foreign table issue, but the DB and - HOPEFULLLY - DAL
would catch the referential integrity errors as they occur . IS this a
correct line of reasoning ?

Thanks

Ben Duncan

-- 
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: DAL with multiple foreign keyes

2018-09-24 Thread Ben Duncan
Ok, thanks .. will think of another way to do this ..

On Mon, Sep 24, 2018 at 4:58 PM Leonel Câmara 
wrote:

> Nope the DAL and web2py does not support this.
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [web2py] Re: DAL with multiple foreign keyes

2018-09-24 Thread Ben Duncan
It's more about optimization of underlying key structure and the btree
access.
Having the Primary key "company + customer" are faster because the
optimizer can have a start point. I could do secondary key with COMPANY ,
but then the optimizer
has to go thru a different set of routines.

In this system I will wind up having a many-to-many relationships in fund
tracking.

On Mon, Sep 24, 2018 at 12:06 PM Leonel Câmara 
wrote:

> I don't get it. Why would you want the company number in the foreign key
> even if this is a multi tenant database?
>
> The reference to customers should just be to customers and not company +
> customers number. Then you put a common filter in the customers table so
> only the customers from the logged in user's company are visible.
>
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] DAL with multiple foreign keyes

2018-09-24 Thread Ben Duncan
Ok, to expand my original thread::

items_purchased has a "company number", since this is a multi tenant
database, that reflects what company this is part of (or division ...etc)

The company number is used to define the foreign key in this table to other
tables:

example:

fk to customers = " company number + customers number"
fk to items = "company number + item file"
fk to gl = "company number + gl coa"

>From reading the manuals and books, there seems to be an inability in the
db.define_table
to assign the "reference" to any other than on only fk.

Is this true? Is there some way to work around this if it is true?

Thanks
Ben Duncan

-- 
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 and Foreign Keyes

2018-09-24 Thread Ben Duncan
will DAL allow multiple foreign keys on a legacy database table?

i.e. : Table called item_purchased needs to have a FK to customer table as
well
as item table and even possibly GL COA table 

Thanks ...

Ben Duncan

-- 
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] Submitting fixes

2018-09-24 Thread Ben Duncan
I've found some errors in extract_pgsql_models.py and have fixed them.

How to do I go about submitting the updated program for inclusion repos
(asking for etiquette sake )?

I'm not quite thru with the update yet, since I need to fix it to handle
FK's with multiple key parts.

Thanks

Ben Duncan

-- 
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] Using DAL / existing Databases

2018-09-17 Thread Ben Duncan
Ok, sorry if this may seem like a long post to some.

I have created a framework of sorts to generate tables for an accounting
system.

They tables themselves are generate from various Python programs that read
layouts from old COBOL programs/ AppGen 4gl / Informix schemas , Oracle
schemas ,Tryton and Oodo and  taking the best ideas from all. The
procedures create a template file that I then use to generate the complete
structure for the accounting system database.

I need to get these layouts into web2py to start building my applications.
It is for a Postgres based database only (on  my end).

The questions are (and based on the template file at the end):

A: How easy to adapt my generator to auto create the necessary DAL entries
into the database section of web2py

B: I saw that I can use Postgres to store my DAL information rather that
flat files and Iv'e lost my links to that - can this be automated as well?

Thanks In advance - Ben Duncan

Sample - Accounts Receivable Open Item File:

# Generator Parameters:
# : = End Type of field , '|' = Field seperators
#
# FILE = Table Name to generate
# ENDFILE - End of Table Defination
# DESC - Descriptive Information for Documentor

# Lines that start with FORKEY are foreign key layouts
# They are divided by '|':
# Column 1 is name of the key ,Names to be created by FILE__fkey
# column 2 is referenced (parent) table
# Column 3 is names of fields in the layout that make up the fk layout
# They are divided by ',':
# Optional Column 4 is the Referential Action to be performed:
# On DELETE, ON UPDATE, etc...
# Program will generate key in the format of
# __fkey

# Lines that start with SECKEY are secondary keys.
# Column 1 is the key name
# Column 2 is the list of keys to form the secondary keyes
# They are divided by ',':
# Program will generate key in the format of
# __idx

# Lines that start with UNIKEY are unique secondary keys.
# Column 1 is the key name
# Column 2 is the list of keys to form the secondary keyes
# They are divided by ',':
# Program will generate key in the format of
# __idx
#
# Program will generate key in the format of
# __fkey
#

# Lines that start with FIELDS: are the field definitions.
# First Field After the ':' is a Type (single Value or multi value -
#   not used at this time)
# Second is the 'K' value that signifies this is part of the
#  primary key, if not K, it is ignored.
# Third is 'N"' for producing 'NOT NULL'
# Forth is the field name
# Fifth is the Descriptive narrative for the field used by
#   documentor
# Sixth is the TYPE
# Seventh is the length (ignored for default types)
# Eight is for any additional constraints - "DEFAULT 0" ...etc
#

FILE:AR_OPEN
DESC:Ar Open Items
DESC: This is the OPEN items file.
DESC: For MEC use the REFERENCE to refer to CASE details.
DESC: DOC_TYPE - I = Invoice, P = Payment, N = Interest, F = Add on Fee
DESC:C = Credit mem0, D = Debit Memo
FORKEY: COMPANY|COMPANY|COMPANY_NUMBER|ON DELETE CASCADE
FORKEY: CLIENT|CLIENT|COMPANY_NUMBER,CLIENT_NUMBER|ON DELETE CASCADE
SECKEY: AR_OPEN_DOC|COMPANY_NUMBER,DOC_NO
FIELDS:S|K|N|COMPANY_NUMBER|Company ID|N6,06|99|
FIELDS:S|K|N|CLIENT_NUMBER|Customer Code|N12,012|12|
FIELDS:S|K|N|DOC_NO|Document Number|N10,012|999|
FIELDS:S|0|N|POSTED_TIMESTAMP|Posted Time Stamp|T|12|
FIELDS:S|0|N|DOC_TYPE|Doc Type - I = Invoice, P = Payment, I = Interest, F
= Add on Fee|A|1|
FIELDS:S|0|N|DOC_DATE|Original Doc Date|D|8|
FIELDS:S|0|0|ORIG_DOC|Original Document|N10,012|9|
FIELDS:S|0|0|HOLD_TO_DATE|Date to start AGEING |D|8|
FIELDS:S|0|0|ORIGINAL_AMOUNT|ORIGINAL AMOUNT|MONEY|9|
FIELDS:S|0|0|BAL_DUE|Document Balance|MONEY|9|DEFAULT 0
FIELDS:S|0|0|PAID_AMOUNT|Paid on Item|MONEY|9|DEFAULT 0
FIELDS:S|0|0|DISC_AMT|Applied Discount|MONEY|9|DEFAULT 0
FIELDS:S|0|0|REFERENCE|Reference/Case ID|V|255|
FIELDS:S|0|0|APPLIED_DATE|Date Applied|D|8|
FIELDS:S|5|0|APPLIED_DOC|Applied Doc_NUM|N10,012|999|
FIELDS:S|0|0|APPLIED_REF|Applied Reference|V|25|
ENDFILE:

-- 
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: Changing Login Defaults

2018-08-08 Thread Ben Duncan
Yeah, we have a "users" file in the E-File system that will be passed via
cookies to the accounting system. The users in the Accounting systems will
have some sort of limitations and ACL's on the applications that they have
access to.

On Wed, Aug 8, 2018 at 11:02 AM Anthony  wrote:

> It's hard to say what you would need to do without knowing more about your
> requirements. Of course, you don't have to use the web2py Auth system at
> all. If you have an external system that handles authentication, you can
> use it in conjunction with web2py -- see
> http://web2py.com/books/default/chapter/29/09/access-control#Other-login-methods-and-login-forms
> (if your use case isn't covered there, you may need to write a custom login
> method to work with web2py, which you can model after one of those in
> gluon.contrib.login_methods).
>
> Anthony
>
> On Wednesday, August 8, 2018 at 11:30:26 AM UTC-4, Ben Duncan wrote:
>>
>> I've been doing some playing around with the sample applications.
>>
>> I've notices they all use tables "auth_user", "auth_group", etc.
>>
>> We have our own authentication needs for each district court (one server
>> to server
>> multiple courts that are in a distinct district) and our own
>> authentication methods.
>>
>> Is it possible to modify and where/how would we do this to change the
>> "login" methods?
>>
>> Thanks
>>
>> Ben Duncan
>>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Changing Login Defaults

2018-08-08 Thread Ben Duncan
I've been doing some playing around with the sample applications.

I've notices they all use tables "auth_user", "auth_group", etc.

We have our own authentication needs for each district court (one server to
server
multiple courts that are in a distinct district) and our own authentication
methods.

Is it possible to modify and where/how would we do this to change the
"login" methods?

Thanks

Ben Duncan

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

2018-08-07 Thread Ben Duncan
Installed it and it's up whilst I learn it ...

On Tue, Aug 7, 2018 at 9:29 AM 黄祥  wrote:

> configuration.take() no longer worked
> *e.g.*
> *private/appconfig.ini*
> [app]
> toolbar = false
>
> *models/db.py*
> response.show_toolbar = configuration.take('app.toolbar') # not worked
> while in the past worked, result the response.toolbar() is shown even the
> value is false, use configuration.get() instead
>
> best regards,
> stifan
>
> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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: Issues getting web2py to work.

2018-07-25 Thread Ben Duncan
Thanks, Figured that out late yesterday.
I've gone ahead and purchased the book "web2py complete reference manual -
5th edition".
I've pretty much decided that web2py will be our framework for the criminal
accounting system for our state supreme court.

Anyway, I will probably have LOTS and LOTS of questions along the way.

On Tue, Jul 24, 2018 at 3:07 PM, Anthony  wrote:

> You'll need to run web2py with Python 2.7 (the specific issue below is
> that the DAL code includes a dictionary comprehension, which is only
> supported in Python 2.7+).
>
> Anthony
>
>
> On Tuesday, July 24, 2018 at 4:03:13 PM UTC-4, Ben Duncan wrote:
>>
>> Redhack 6.9
>> Python 2.6.6
>>
>> Installed web2py source.
>> Ran the command:
>> >python web2py.py
>> got the message:
>>
>> Traceback (most recent call last):
>>   File "web2py.py", line 21, in 
>> import gluon.widget
>>   File "/data/web2py/web2py/gluon/__init__.py", line 23, in 
>> import pydal
>>   File "/data/web2py/web2py/gluon/packages/dal/pydal/__init__.py", line
>> 3, in 
>> from .base import DAL
>>   File "/data/web2py/web2py/gluon/packages/dal/pydal/base.py", line 145,
>> in 
>> from .objects import Table, Field, Rows, Row, Set
>>   File "/data/web2py/web2py/gluon/packages/dal/pydal/objects.py", line
>> 385
>> return [{key: noncallable(getattr(field, key)) for key in keys}
>>
>> Any Ideas ?
>>
>> Thanks
>>
>> Ben Duncan   ^
>>
>> --
> Resources:
> - http://web2py.com
> - http://web2py.com/book (Documentation)
> - http://github.com/web2py/web2py (Source code)
> - https://code.google.com/p/web2py/issues/list (Report Issues)
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[web2py] Issues getting web2py to work.

2018-07-24 Thread Ben Duncan
Redhack 6.9
Python 2.6.6

Installed web2py source.
Ran the command:
>python web2py.py
got the message:

Traceback (most recent call last):
  File "web2py.py", line 21, in 
import gluon.widget
  File "/data/web2py/web2py/gluon/__init__.py", line 23, in 
import pydal
  File "/data/web2py/web2py/gluon/packages/dal/pydal/__init__.py", line 3,
in 
from .base import DAL
  File "/data/web2py/web2py/gluon/packages/dal/pydal/base.py", line 145, in

from .objects import Table, Field, Rows, Row, Set
  File "/data/web2py/web2py/gluon/packages/dal/pydal/objects.py", line 385
return [{key: noncallable(getattr(field, key)) for key in keys}

Any Ideas ?

Thanks

Ben Duncan   ^

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