[web2py] Re: Deploying Web2py with nginx on FreeBSD

2014-09-14 Thread GregD
Have you tried changing the owner on the nginx location directory that's 
defined in your nginx.conf flie?  Try making it the same owner that's 
defined in the nginx.conf file, which is typically, web-data.

On Wednesday, September 10, 2014 11:03:13 AM UTC-5, myappeng...@gmail.com 
wrote:

 Hi, everyone.
 I'm in the process of deploying Web2py with nginx on FreeBSD. 
 Does anyone have a deployment script for this configuration. All the 
 recipes I have seen are for Linux and I'm having difficulties converting 
 them for FreeBSD.
 I have installed nginx and uwsgi succesfully, but I get a permissions 
 error [forbidden 403] when I web on to the nginx server.

 Many Thanks
 Mike


-- 
This message is for named person(s) only.  It may contain confidential 
and/or legally privileged information.  No confidentiality or privilege is 
waived or lost should mis-transmission occur.  If you receive this message 
in error, delete it (and all copies) and notify the sender.  You must not, 
directly or indirectly,use, disclose, distribute, print, or copy any part 
of this message if you are not the intended recipient. GAD GROUP 
TECHNOLOGY, INC. reserves the right to monitor all e-mail communications 
through its networks.

Any views expressed in this message are those of the individual sender, 
except where the message states otherwise and the sender is authorized to 
state them to be the views of any such entity.

This e-mail has been virus and content scanned by GAD GROUP TECHNOLOGY, INC.

-- 
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: AD LDAP Auth without creating Auth tables

2013-11-11 Thread GregD
Niphlod,

Thanks for all your help.  We have the app working now.  To answer your 
questions:

1.  yes, password and role are reserved words in Firebird 1.5; Not sure 
about 2.x version though
2.  I can see uses for rname down the road.  Glad its in the works.
3.  We're using Firebird 1.5 because its the customer's production database 
system.  They haven't upgraded to the latest version.  
4.  Our new approach was to create to DALs db and db2.  db is sqlite and 
will take care of requirement to implement Auth.  db2 is the connection to 
firebird 1.5.  We will create forms and query logic around the db2 
connection.

This was a good project; it taught us a lot about Auth.

Thanks,

On Sunday, November 10, 2013 4:59:33 PM UTC-6, Niphlod wrote:

 if password and role are reserved keywords, then there is a huge issue 
 because what needs to be changed is how auth creates the scheme by default 
 (and I don't see it happening in web2py for a small percentage of firebird 
 users)...

 One thing at a time though. We need to figure out the problem when 
 creating the id (assuming your initial report still stands)

 BTW 
 Field('id', 'integer', notnull=True),
 should be 
 Field('id', 'id', notnull=True)
 so you can skip the primarykey definition.

 Once that works fine, please send out the sql.log generated, so we can fix 
 the 'id' creation at DAL side: if you're correct about the report, then all 
 tables created by DAL can't work (because every table created by DAL by 
 default has a PK defined as 'id').

 Then, I think you can use the super-experimental new feature in dal that 
 is called rname.
 Basically the model of the table remains fixed, but the name of the 
 table (or of the fields) are translated to rname when talking to the 
 backend.
 Currently it's tested only in SQLite, Postgresql, Mysql and MSSQL.

 That being said, what you need practically is to replace any field that is 
 a reserved keyword in Firebird with something that isn't, passing the 
 name of the field. You can try passing the already quoted password string

 Field('password', ., rname='password')

 or choose a totally different one, such as 

 Field('password', ., rname='a_totally_different_one')
 (watch out the quotes. there are two single quotes to delimit the 
 variable name in python the variable is the name of the column 
 surrounded by double quotes, that are passed as they are to the backend)

 DAL will still work with this table, but when asking for 

 db.table.password == 'a' 

 what will happen is 

 WHERE a_totally_different_one = 'a'


 BTW: why the need to work with firebird 1.6 since 2.5.2 is out ?
 One thing is trying to access a legacy table.but why bother creating 
 tables for the app in a really old backend that is only going to provide 
 more and more headaches?


-- 
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/groups/opt_out.


[web2py] Re: AD LDAP Auth without creating Auth tables

2013-11-10 Thread GregD
Niphlod,

I manually defined the auth tables.  However, system is now saying 
auth_user already exist.
class 'fdb.fbcore.DatabaseError' ('Error while executing SQL 
statement:\n- SQLCODE: -607\n- unsuccessful metadata update\n- Table 
AUTH_USER already exists', -607, 335544351)

Version
web2py™ Version 2.7.4-stable+timestamp.2013.10.14.15.16.29
Python Python 2.7.5: c:\python27\python.exe (prefix: c:\python27)
Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
Traceback (most recent call last):
  File C:\web2py_src\web2py\gluon\restricted.py, line 217, in restricted
exec ccode in environment
  File C:/web2py_src/web2py/applications/unionhall/models/db.py, line 19, 
in module
primarykey=['id']
  File C:\web2py_src\web2py\gluon\dal.py, line 7935, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
  File C:\web2py_src\web2py\gluon\dal.py, line 7972, in lazy_define_table
polymodel=polymodel)
  File C:\web2py_src\web2py\gluon\dal.py, line 1002, in create_table
self.create_sequence_and_triggers(query,table)
  File C:\web2py_src\web2py\gluon\dal.py, line 3684, in 
create_sequence_and_triggers
self.execute(query)
  File C:\web2py_src\web2py\gluon\dal.py, line 1836, in execute
return self.log_execute(*a, **b)
  File C:\web2py_src\web2py\gluon\dal.py, line 1830, in log_execute
ret = self.cursor.execute(command, *a[1:], **b)
  File c:\python27\lib\site-packages\fdb-1.4-py2.7.egg\fdb\fbcore.py, 
line 3323, in execute
self._ps._execute(parameters)
  File c:\python27\lib\site-packages\fdb-1.4-py2.7.egg\fdb\fbcore.py, 
line 3024, in _execute
Error while executing SQL statement:)
DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -607\n- 
unsuccessful metadata update\n- Table AUTH_USER already exists', -607, 
335544351)
Error snapshot  help
class 'fdb.fbcore.DatabaseError'(('Error while executing SQL 
statement:\n- SQLCODE: -607\n- unsuccessful metadata update\n- Table 
AUTH_USER already exists', -607, 335544351))

I'm really close to finishing this up.  Just need to get auth working 
correctly, replace the password field since its a reserved word in 
Firebird.  Also need to figure out what to do with the Role field in 
auth_group because firebird used role for something.  I had to create 
field called au_group_role.  But don't know how to integrate that into 
web2py auth scheme.

db.define_table('auth_user',
Field('id', 'integer', notnull=True),
Field('first_name', 'string', length=128),
Field('last_name', 'string', length=128),
Field('email', 'string', length=512),
Field('registration_key', 'string', length=512),
Field('reset_password_key', 'string', length=512),
primarykey=['id']
)

db.define_table('auth_group',
Field('id', 'integer', notnull=True),
Field('au_grp_role', 'string', length=512),
Field('description', 'text'),
primarykey=['id'])

attempting to use this line to deal with auth_user.password field
auth.settings.password_field = 'passwrd' # In Firebird password is a 
reserved word; so using passwrd instead

What can I do about auth_group.role?  

Thoughts?



On Sunday, November 10, 2013 6:46:33 AM UTC-6, Niphlod wrote:

 Very strange, since fdb is included as an adapter for some time now. I 
 guess firebird adoption is definitely not widespread.
 This should be addressed in DAL at creation time. 
 Can you provide the syntax that web2py should use vs the sintax that it 
 actually uses ? Maybe open a ticket on google code so it doesn't get lost. 

 On Sunday, November 10, 2013 4:19:28 AM UTC+1, GregD wrote:

 Niphlod,

 Thanks for the response.  I understand it better now.  

 web2py generates this message
 DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -607\n- 
 unsuccessful metadata update\n- Column: ID not defined as NOT NULL - cannot 
 be used in PRIMARY KEY constraint definition', -607, 335544

 I think its because its trying to create a table with ID as primary key, 
 but it does not include NOT NULL in the creation of the table.

 this is from the sql.log file:
 CREATE TABLE auth_user(
 id INTEGER PRIMARY KEY,
 first_name VARCHAR(128),
 last_name VARCHAR(128),
 email VARCHAR(512),
 username VARCHAR(128),
 passwrd VARCHAR(512),
 registration_key VARCHAR(512),
 reset_password_key VARCHAR(512),
 registration_id VARCHAR(512)
 );

 firebird will not allow this create statement unless it has NOT NULL 
 added.


 On Saturday, November 9, 2013 7:00:13 AM UTC-6, Niphlod wrote:

 web2py definitely needs the auth tables to work with any auth backend 
 (even LDAP).
 Of course username and pwd are stored in AD, but AD doesn't have, e.g, 
 the user id.
 web2py uses auth_* tables for dealing with RBAC, and even if you don't 
 need granular permissions, groups

[web2py] Re: AD LDAP Auth without creating Auth tables

2013-11-09 Thread GregD
Niphlod,

Thanks for the response.  I understand it better now.  

web2py generates this message
DatabaseError: ('Error while executing SQL statement:\n- SQLCODE: -607\n- 
unsuccessful metadata update\n- Column: ID not defined as NOT NULL - cannot 
be used in PRIMARY KEY constraint definition', -607, 335544

I think its because its trying to create a table with ID as primary key, 
but it does not include NOT NULL in the creation of the table.

this is from the sql.log file:
CREATE TABLE auth_user(
id INTEGER PRIMARY KEY,
first_name VARCHAR(128),
last_name VARCHAR(128),
email VARCHAR(512),
username VARCHAR(128),
passwrd VARCHAR(512),
registration_key VARCHAR(512),
reset_password_key VARCHAR(512),
registration_id VARCHAR(512)
);

firebird will not allow this create statement unless it has NOT NULL added.


On Saturday, November 9, 2013 7:00:13 AM UTC-6, Niphlod wrote:

 web2py definitely needs the auth tables to work with any auth backend 
 (even LDAP).
 Of course username and pwd are stored in AD, but AD doesn't have, e.g, the 
 user id.
 web2py uses auth_* tables for dealing with RBAC, and even if you don't 
 need granular permissions, groups etc, it still has to map a user to a 
 unique integer(ish) id.
 Moreover, auth_* tables assure you that you won't continuously hit the 
 auth backend once authenticated (sort of a cached copy of what is needed 
 is written into the database).

 You shouldn't have problems with firebird  what is the exception your 
 app raises when trying to create the auth tables ?



-- 
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/groups/opt_out.


[web2py] AD LDAP Auth without creating Auth tables

2013-11-08 Thread GregD
We want to perform AD Auth but Web2Py seems to need to create the Auth 
Tables OR it want to see existing Auth tables. 

Our problem is that we're using an older database Firebird 1.5 and can't 
seem to get Web2Py to recognize Auth tables from that database.

Is there a way to do AD Auth without Web2Py needing to see Auth Tables? 
 After all, the username and password is stored in AD.

Thoughts?

Greg

-- 
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/groups/opt_out.


[web2py] Installation of Firebird Driver not working

2013-10-18 Thread GregD
I'm trying to install the Firebird Driver FDB but not getting very far.

Here's my steps:

1.  Install easy_install [OK]

run easy_install fdb and get the following error:

C:\easy_install fdb
Searching for fdb
Reading https://pypi.python.org/simple/fdb/
Best match: fdb 1.4
Downloading 
https://pypi.python.org/packages/source/f/fdb/fdb-1.4.tar.gz#md5=a99
34fd8004467ac69682e5b09e272c8
Processing fdb-1.4.tar.gz
Writing 
c:\users\admini~1.loc\appdata\local\temp\4\easy_install-fduyeg\fdb-1.4\s
etup.cfg
Running fdb-1.4\setup.py -q bdist_egg --dist-dir 
c:\users\admini~1.loc\appdata\l
ocal\temp\4\easy_install-fduyeg\fdb-1.4\egg-dist-tmp-qfzl2d
Traceback (most recent call last):
  File C:\python27\Scripts\easy_install-script.py, line 9, in module
load_entry_point('setuptools==1.1.6', 'console_scripts', 
'easy_install')()
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
1925, in
 main
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
1912, in
 with_ei_usage
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
1929, in
 lambda
  File C:\python27\lib\distutils\core.py, line 152, in setup
dist.run_commands()
  File C:\python27\lib\distutils\dist.py, line 953, in run_commands
self.run_command(cmd)
  File C:\python27\lib\distutils\dist.py, line 972, in run_command
cmd_obj.run()
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
374, in
run
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
609, in
easy_install
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
639, in
install_item
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
825, in
install_eggs
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
1031, in
 build_and_install
  File build\bdist.win32\egg\setuptools\command\easy_install.py, line 
1016, in
 run_setup
  File build\bdist.win32\egg\setuptools\sandbox.py, line 69, in run_setup
  File build\bdist.win32\egg\setuptools\sandbox.py, line 120, in run
  File build\bdist.win32\egg\setuptools\sandbox.py, line 71, in lambda
  File setup.py, line 7, in module
  File 
c:\users\admini~1.loc\appdata\local\temp\4\easy_install-fduyeg\fdb-1.4\f
db\__init__.py, line 23, in module
  File 
c:\users\admini~1.loc\appdata\local\temp\4\easy_install-fduyeg\fdb-1.4\f
db\fbcore.py, line 34, in module
  File 
c:\users\admini~1.loc\appdata\local\temp\4\easy_install-fduyeg\fdb-1.4\f
db\ibase.py, line 43, in module
  File C:\python27\lib\ctypes\__init__.py, line 365, in __init__
self._handle = _dlopen(self._name, mode)
TypeError: expected string or Unicode object, NoneType found


Any idea what I'm doing wrong?

-- 
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/groups/opt_out.


Re: [web2py] Custom Auth

2013-10-09 Thread GregD
We have to use tables from sql server (aspnet_user and aspnet_membership) 
for our authentication.

So we've extended Auth like this

from gluon.tools import Auth
def MyNewAuth 
  ...
  # we copied the Login method from Auth to here
 ...
 # use the following code to decipher the password from aspnet_membership
 # rowa and rowb was used earlier to get username and password from 
aspnet_users, etc...
  b64salt = str(rowa.PasswordSalt)

   b64hash = str(rowa.Password)

   binsalt = b64decode(b64salt)

   password_string = str(form.vars.pswd).encode(utf16)

   password_string = utf16tobin(password_string)

   m1 = hashlib.sha1()

   m1.update(binsalt + password_string)

   if b64encode(m1.digest()) == b64hash:
   ...
Now how do we continue using extended Auth class so that we can use 
authentication throughout app?

I hope this makes sense. If not, I can elaborate further. Just let me know.

On Tuesday, October 8, 2013 4:08:25 PM UTC-5, viniciusban wrote:

 Web2py Auth is a class. 

 You should extend it and in models/db.py you should have something like: 
 auth = MyExtendedAuth() 


 On Tue, Oct 8, 2013 at 2:54 PM, GregD gregor...@gadgroup.comjavascript: 
 wrote: 
  We created a form in the index controller to authenticate users to a 
  database that utilize asp.net membership for authentication.  However, 
 we 
  need to turn on Authentication for all forms now, but can't seem to do 
 it 
  since we didn't use the web2py built-in authentication mechanism. 
  
  Is it possible to move the code we created in the controller to the 
 model so 
  that we can simply add authentication to all forms/pages?  If so, how? 
  Is 
  there another way to accomplish 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+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
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/groups/opt_out.


[web2py] Custom Auth

2013-10-08 Thread GregD
We created a form in the index controller to authenticate users to a 
database that utilize asp.net membership for authentication.  However, we 
need to turn on Authentication for all forms now, but can't seem to do it 
since we didn't use the web2py built-in authentication mechanism.

Is it possible to move the code we created in the controller to the model 
so that we can simply add authentication to all forms/pages?  If so, how? 
 Is there another way to accomplish 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/groups/opt_out.


[web2py] Tab Views

2013-09-14 Thread GregD
I'm working with version 2.6.2 and liking tabbed windows.  Great way to 
edit model,view and controller just by clicking the tab for each.

-- 
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/groups/opt_out.


[web2py] Re: Help creating RESTful webservice

2013-08-26 Thread GregD
Niphlod,

You right, I didn't have to reimport the pyodbc.  I'm connecting to the 
database now, but still getting an error.

I think it has something to do with how I define the field RowVersion. 
 RowVersion is defined as a timestamp data type in MS SQL Server 2012.  How 
do I define that in the define_table function?



On Friday, August 23, 2013 1:44:15 PM UTC-5, Niphlod wrote:

 seems that you're using the binary version. May I ask why do you need to 
 reimport pyodbc on your own ?
 Why not just using db = DAL(mssql:// etc etc etc ) ?

 On Friday, August 23, 2013 8:09:45 PM UTC+2, GregD wrote:

 Hi,

 We're new to Web2py and starting to use it more and more to meet 
 customer's demand for Web Apps.  Currently, we need to create a few forms 
 to retrieve info from production database system.

 Our environment is as follows:
 Windows Server 2008 R2
 SQL Server 2012 Standard
 IIS 7.0

 We've downloaded web2py and have forms created.  However, we are having 
 issues connecting to existing SQL Server database.  Our DAL is as follows:

 import pyodbc
 from gluon.dal import MSSQLAdapter
 if not (MSSQLAdapter.driver):
   MSSQLAdapter.driver = pyodbc
 db = pyodbc.connect(DRIVER={SQL 
 SERVER};SERVER=localhost\sqlexpress2012;DATABASE=Customer;UID=sa;PWD=***)

 We've defined the tables as follows:

 db.define_table('Locals', 
 Field('id', 'int'),
 Field('Name', 'str'),
 Field('Logo', 'buffer'),
 Field('ActiveFlag', 'bool' ),
 Field('RowVersion', 'datetime.datetime'),
 Field('Address1', 'str'),
 Field('Address2', 'str'),
 Field('City', 'str'),
 Field('State', 'str'),
 Field('Zip', 'str'),
 Field('Phone', 'str'),
 Field('PrimaryContact', 'str'),
 Field('SecondaryContact', 'str'),
 Field('FaxTitle', 'str'),
 Field('TestingName', 'str'),
 Field('RecieveParts', 'str'),
 primarykey=[id],
 migrate=False)

 however, when we attempt to connect to database from admin page we get ...

 Traceback (most recent call last):
   File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, 
 in restricted
   File C:/web2py/applications/Reciprocity/models/db.py 
 http://192.168.1.125:8000/admin/default/edit/Reciprocity/models/db.py, 
 line 61, in module
 AttributeError: 'pyodbc.Connection' object has no attribute 'define_table'

 It appears there is no define_table method in pyodbc, is that correct?  If 
 so, how should we model exsiting SQL Server tables using pyodbc?



-- 

--- 
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/groups/opt_out.


[web2py] Help creating RESTful webservice

2013-08-23 Thread GregD
Hi,

We're new to Web2py and starting to use it more and more to meet customer's 
demand for Web Apps.  Currently, we need to create a few forms to retrieve 
info from production database system.

Our environment is as follows:
Windows Server 2008 R2
SQL Server 2012 Standard
IIS 7.0

We've downloaded web2py and have forms created.  However, we are having 
issues connecting to existing SQL Server database.  Our DAL is as follows:

import pyodbc
from gluon.dal import MSSQLAdapter
if not (MSSQLAdapter.driver):
  MSSQLAdapter.driver = pyodbc
db = pyodbc.connect(DRIVER={SQL 
SERVER};SERVER=localhost\sqlexpress2012;DATABASE=Customer;UID=sa;PWD=***)

We've defined the tables as follows:

db.define_table('Locals', 
Field('id', 'int'),
Field('Name', 'str'),
Field('Logo', 'buffer'),
Field('ActiveFlag', 'bool' ),
Field('RowVersion', 'datetime.datetime'),
Field('Address1', 'str'),
Field('Address2', 'str'),
Field('City', 'str'),
Field('State', 'str'),
Field('Zip', 'str'),
Field('Phone', 'str'),
Field('PrimaryContact', 'str'),
Field('SecondaryContact', 'str'),
Field('FaxTitle', 'str'),
Field('TestingName', 'str'),
Field('RecieveParts', 'str'),
primarykey=[id],
migrate=False)

however, when we attempt to connect to database from admin page we get ...

Traceback (most recent call last):
  File /home/mdipierro/make_web2py/web2py/gluon/restricted.py, line 212, in 
restricted
  File C:/web2py/applications/Reciprocity/models/db.py 
http://192.168.1.125:8000/admin/default/edit/Reciprocity/models/db.py, line 
61, in module
AttributeError: 'pyodbc.Connection' object has no attribute 'define_table'

It appears there is no define_table method in pyodbc, is that correct?  If so, 
how should we model exsiting SQL Server tables using pyodbc?

-- 

--- 
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/groups/opt_out.


[web2py] crud permissions

2013-08-01 Thread GregD
I've turned on auth and attempting to use crud.

when I go to my app http://.../data/create/table_name

I get insufficient privileges
NOT Authorized
Access Denied

What am I missing?

db.py is as follows:

from gluon.tools import Auth
from gluon.tools import Crud

db = DAL('sqlite://storage.sqlite')

db.define_table (
'contacts',
Field('FirstName'),
Field('LastName', requires=IS_NOT_EMPTY()),
Field('Address1'),
Field('Address2'),
Field('City'),
Field('State'),
Field('Zip'),
Field('Mobile'),
Field('Work'),
Field('Fax'),
Field('Home'),
Field('EmailAddr'),
Field('WebURL'),
Field('JobTitle'),
Field('Company'),
Field('CreateDate', 'datetime', default=request.now, writable=False) )

auth = Auth(db)
auth.define_tables(username=True)

crud = Crud(db)
crud.settings.auth = auth
crud.settings.controller = 'default'
crud.settings.create_next = URL('index')

default.py controller includes the following:

def give_create_permission(form):
group_id = auth.id_group('user_%s' % auth.user.id)
auth.add_permission(group_id, 'read', db.contacts)
auth.add_permission(group_id, 'create', db.contacts)
auth.add_permission(group_id, 'select', db.contacts)

crud.settings.auth = auth

def create_contacts():
form = crud.create(db.contacts, onaccept=give_update_permission)
return dict(form=crud())

-- 

--- 
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/groups/opt_out.