[web2py] Re: Problem with oracle query

2020-01-14 Thread 'tomt' via web2py-users
Thanks for posting your solution.  I ran into the same problem and probably 
wouldn't have figured it out without your post.

- Tom

On Monday, April 15, 2019 at 5:20:36 AM UTC-6, gliporace wrote:
>
> I think I found the problem:
> the query is sent with the table name double-quoted:
>
> select "ana_paz"."COGNOME", "ana_paz"."NOME" from "ana_paz" where 
> "ana_paz"."COGNOME"='ROSSI'  <--- doesn't not work ("table or view does 
> not exists")
>
> select ana_paz."COGNOME", ana_paz."NOME" from "ana_paz" where 
> ana_paz."COGNOME"='ROSSI'  < works
>
> Setting 
> entity_quoting = False
>
> in the database connection solved the problem.
>
>
>
> Il giorno venerdì 12 aprile 2019 17:00:14 UTC+2, gliporace ha scritto:
>>
>> Hi,
>> I just updated my web2py installation from 2.11 to 2.18.5, but the apps 
>> who make use of cx_Oracle for connecting to a Oracle database show this 
>> error 
>> when ther try to query a table/view:
>>
>> Exception ORA-00942: table or view does not exist
>>
>> The old web2py installation run without problems on a Ubuntu server 14.04 
>> and cx_Oracle 5.3, the new installation is on Ubuntu server 16.04 with the 
>> same version of cx_Oracle.
>>
>> Is there any means to check what is the query before is sent to the 
>> server?
>>
>

-- 
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/20c1d130-f770-4361-9403-9e4bcd30e3aa%40googlegroups.com.


[web2py] Re: Web2Py and ldap integration

2019-07-31 Thread &#x27;tomt' via web2py-users
I have used ldap_auth successfully by implementing the following in 
models/db.py:

from gluon.contrib.login_methods.ldap_auth import ldap_auth 
...
db = DAL('mysql://mydb:mydb@localhost/password') 
...
# --- end of web2py scaffolding ---
...
auth.settings.login_methods.append(ldap_auth(mode='ad', 
server='dc1.mydomain.com',base_dn='ou=users,dc=mydomain,dc=com'))
auth.settings.login_methods.append(ldap_auth(mode='ad', 
server='dc1.mydomain.com',base_dn='ou=operators,dc=mydomain,dc=com'))
...
db2 = DAL('oracle://myextradb/account@password', migrate=False)


I found that I had to make extra database definitions after the append 
statements or I received a segmentation fault.  

I suspect that you could add another append statement to add an additional 
domain controller but I haven't tested this.

Hopefully this helps you - Tom


On Friday, July 19, 2019 at 11:30:00 PM UTC-6, Davidiam wrote:
>
> Hello,
>
> I have read and implemented the recipe for Windows active directory ldap 
> integration with Web2Py (
> http://www.web2py.com/books/default/chapter/29/09/access-control) and for 
> the most part the documentation is clear except for the last bit where it 
> refers to : 
>
> from gluon.contrib.login_methods.ldap_auth import ldap_auth
> auth.settings.login_methods.append(ldap_auth(mode='ad',
>server='my.domain.controller',
>base_dn='ou=Users,dc=domain,dc=com'))
>
> For me there are 2 things that aren't clear here :
> 1) Where should this code be inserted ?  In the default.py controller or 
> in db.py or somewhere else ?
> 2) We have multiple domain controllers in our domain, do we need to supply 
> a specific server for the server parameter ?
>
> An example of implementing this with the welcome application would be 
> appreciated, specifying the file which was modified. 
>

-- 
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/62b48bac-e85d-4ce7-94c4-637dfcf41aa3%40googlegroups.com.


[web2py] Re: please help testing web3py

2019-07-28 Thread &#x27;tomt' via web2py-users
I installed py4web on centos 7 in a virtual python environment and it works 
fine.

http://127.0.0.1:8000/_dashboard works as advertised, however 
http://localhost:8000/_dashboard doesn't.
When using localhost, the dashboard page comes up, but it won't display any 
of the installed applications or any tickets.

I followed the documentation to add a session counter.  The code works when 
using http://127.0.0.1/myapp but not when using http://localhost/myapp.  
(localhost is defined as 127.0.0.1 on my system) Most of my tests  work 
with http://localhost/myapp/* but some don't.  I'm not sure if this is a 
problem or not.

- Tom

On Saturday, July 6, 2019 at 9:57:26 PM UTC-6, Massimo Di Pierro wrote:
>
> Let's test the dashboard today:
>
> # download web2py from pypi
>
> python3 -m pip install web3py
>
> # start it:
>
> web3py-start myapps
>
> (pick a one time password  and answer yes when it wants to create 
> something, it will create myapps folder and a temp .web3py-service folder)
>
> # open browser
>
> http://127.0.0.1:8000/_dashboard
>
> Now create a new app by cloning scaffold
>
> Does it work?
> How does it flow?
> What explanations should be necessary?
> Can you write a brief documentation of your experience for other users?
>
>
>

-- 
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/0a90e92e-24b5-4caa-84a9-d842ff888290%40googlegroups.com.


[web2py] RSA Securid integration with web2py

2018-04-25 Thread &#x27;tomt' via web2py-users
Hi,

Has anyone integrated web2py authentication with RSA Securid?  If you have, 
I'd appreciate it if you could share the steps you took.

- Thanks in advance, - Tom

-- 
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: How can I access functions from multiple files in the controllers directory?

2016-11-03 Thread &#x27;tomt' via web2py-users
Hi,
Thanks for your reply.  I tried using modules as you suggested.  It works 
great for simple python functions, but when I try to use DAL it dies.  It 
appears that functions in modules aren't aware of the model definitions.  
Chapter 4 of the manual indicates that I could probably do this by 
importing exec_environment but I think I will just put my DAL code back in 
controllers/default.py.

- Tom

On Tuesday, November 1, 2016 at 10:03:30 PM UTC-6, 黄祥 wrote:
>
> just an idea why not put it on modules?
> e.g.
> *controllers/default.py*
> import file1
>
> a = file1.function1(x, y)
> b = file1.function2(y, z)
>
> *modules/file1.py*
> def function1(value1, value2):
> code
> return
> 
> def function2(value1, value2):
> code
> return
>
> 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.


[web2py] How can I access functions from multiple files in the controllers directory?

2016-11-01 Thread &#x27;tomt' via web2py-users
Hi,

In the controllers directory I wanted to define some functions in another 
file.
I had hoped to import the functions to make them available to default.py but
I haven't been able to get this to work. 

I'm hoping that someone can point out my error, and possibly a solution.

In the controllers directory there is default.py and file1.py

--- default.py ---
...
from file1 import *
...
a = function1(x,y)
...
b = function2(y,z)
...

--- file1.py ---
...
def function1(value1,value2):
code
return

def function2(value1,value2):
code
return

ImportError: No module named file1

(I defined __init__.py in controllers, but this didn't help)

Any pointers would be appreciated - Tom

-- 
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: Code change in oracle.py to allow joins in pagination.

2016-10-27 Thread &#x27;tomt' via web2py-users
I downloaded the latest release, 2.14.6, and downloaded my patch file from 
this post and applied it against oracle.py:
cd gluon/packages/dal/pydal/adapters
patch < oracle.patch

It created the oracle.py I expected and it runs correctly.
Are you referring to a different version of web2py?

- Tom

On Monday, October 3, 2016 at 1:29:59 PM UTC-6, Massimo Di Pierro wrote:
>
> Sorry the patch does not work with the latest pydal/adapters/oracle.py. 
> Can I ask you to resubmit it?
>
> On Sunday, 25 September 2016 20:24:48 UTC-5, tomt wrote:
>>
>> Hi,  I've attached the oracle.patch file for gluon/packages/dal/pydal/
>> adapters.oracle.py  
>>
>> - Tom
>>
>> On Saturday, September 24, 2016 at 9:25:06 PM UTC-6, Massimo Di Pierro 
>> wrote:
>>>
>>> I can take care of it. Can you email me your patch as an attachment?
>>>
>>> On Friday, 23 September 2016 19:46:34 UTC-5, tomt wrote:
>>>>
>>>> I'd be happy to give it a try, but I'm not sure what steps to take.  
>>>>> When I go to github and click on create new pull request it appears I 
>>>>> have 
>>>>> to select a branch to compare to. I'm uncertain if I am supposed to 
>>>>> select 
>>>>> admin, experimental, or enter a value of my own.  Does web2py have any 
>>>>> suggested steps, or a guideline for using github?  
>>>>>
>>>>
>>>> - Tom 
>>>>
>>>

-- 
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: Code change in oracle.py to allow joins in pagination.

2016-09-25 Thread &#x27;tomt' via web2py-users
Hi,  I've attached the oracle.patch file for 
gluon/packages/dal/pydal/adapters.oracle.py  

- Tom

On Saturday, September 24, 2016 at 9:25:06 PM UTC-6, Massimo Di Pierro 
wrote:
>
> I can take care of it. Can you email me your patch as an attachment?
>
> On Friday, 23 September 2016 19:46:34 UTC-5, tomt wrote:
>>
>> I'd be happy to give it a try, but I'm not sure what steps to take.  When 
>>> I go to github and click on create new pull request it appears I have to 
>>> select a branch to compare to. I'm uncertain if I am supposed to select 
>>> admin, experimental, or enter a value of my own.  Does web2py have any 
>>> suggested steps, or a guideline for using github?  
>>>
>>
>> - Tom 
>>
>

-- 
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.
--- oracle.py	2016-05-09 18:21:47.0 -0600
+++ oracle.py.new	2016-09-25 19:01:04.0 -0600
@@ -67,7 +67,30 @@
 sql_w_row = sql_w + ' AND w_row > %i' % lmin
 else:
 sql_w_row = 'WHERE w_row > %i' % lmin
-return 'SELECT %s %s FROM (SELECT w_tmp.*, ROWNUM w_row FROM (SELECT %s FROM %s%s%s) w_tmp WHERE ROWNUM<=%i) %s %s %s;' % (sql_s, sql_f, sql_f, sql_t, sql_w, sql_o, lmax, sql_t, sql_w_row, sql_o)
+ 
+# remove blanks from sql_f
+mysql_f = sql_f.replace(" ","")
+# split into list
+myfields = mysql_f.split(",")
+select1 = "SELECT /*+ FIRST_ROWS(10) */"
+select1 = "SELECT"
+select2 = "SELECT"
+select3 = "SELECT"
+for i in range(len(myfields)):
+#select1 += ' c%s "%s",' % (i,myfields[i])  #Full field names are not required
+select1 += ' c%s,' % (i)
+select2 += ' w_tmp.c%s,' % (i)
+select3 += ' %s c%s,' % (myfields[i],i)
+# remove trailing ,
+select1 = select1.rstrip(",")
+select3 = select3.rstrip(",")
+mysql = "%s\nFROM (\n  %s ROWNUM rn\n  FROM (\n%s" % (select1,select2,select3)  
+mysql += "\nFROM %s\n%s\n%s" % (sql_t,sql_w,sql_o)
+mysql += "\n  ) w_tmp\n  WHERE ROWNUM <= %s\n)WHERE rn > %s\n" % (limitby[1],limitby[0])
+#print "mysql:%s" % (mysql)
+return mysql
+#return 'SELECT %s %s FROM (SELECT w_tmp.*, ROWNUM w_row FROM (SELECT %s FROM %s%s%s) w_tmp WHERE ROWNUM<=%i) %s %s %s;' % (sql_s, sql_f, sql_f, sql_t, sql_w, sql_o, lmax, sql_t, sql_w_row, sql_o)
+
 return 'SELECT %s %s FROM %s%s%s;' % (sql_s, sql_f, sql_t, sql_w, sql_o)
 
 def constraint_name(self, tablename, fieldname):


[web2py] Re: Code change in oracle.py to allow joins in pagination.

2016-09-23 Thread &#x27;tomt' via web2py-users

>
> I'd be happy to give it a try, but I'm not sure what steps to take.  When 
> I go to github and click on create new pull request it appears I have to 
> select a branch to compare to. I'm uncertain if I am supposed to select 
> admin, experimental, or enter a value of my own.  Does web2py have any 
> suggested steps, or a guideline for using github?  
>

- Tom 

-- 
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] Code change in oracle.py to allow joins in pagination.

2016-09-10 Thread &#x27;tomt' via web2py-users
Hello,

I have patched the select_limitby routine in oracle.py to allow for 
successful pagination when joins are used.

This is an example of the sql it generates:

SELECT c0 "STATUSPOINT.POINTNUMBER", c1 "STATUSPOINT.POINTNAME", c2 
"AOR.REFERENCENAME", c3 "AOR.AOR"
FROM (
  SELECT w_tmp.c0, w_tmp.c1, w_tmp.c2, w_tmp.c3, ROWNUM rn
  FROM (
SELECT STATUSPOINT.POINTNUMBER c0, STATUSPOINT.POINTNAME c1, 
AOR.REFERENCENAME c2, AOR.AOR c3
FROM AOR, STATUSPOINT
 WHERE (STATUSPOINT.POINTACCESSAREA = AOR.AOR)
 ORDER BY STATUSPOINT.POINTNUMBER
  ) w_tmp
  WHERE ROWNUM <= 20
)WHERE rn > 10

The sql I used is based on a suggestion from 
https://blog.jooq.org/2014/06/09/stop-trying-to-emulate-sql-offset-pagination-with-your-in-house-db-framework/

It works successfully in my initial tests, but I realize that it's possible 
that this change may cause some problems that I haven't tested for.

I'm hopeful that this change may be considered for implementation into the 
official web2py code.  Please let me know if there is anything that I can 
do to assist in this process.


... gluon/packages/dal/pydal/adapters/oracle.py ...

def select_limitby(self, sql_s, sql_f, sql_t, sql_w, sql_o, limitby):
if limitby:
(lmin, lmax) = limitby
if len(sql_w) > 1:
sql_w_row = sql_w + ' AND w_row > %i' % lmin
else:
sql_w_row = 'WHERE w_row > %i' % lmin

# start of my code changes

# remove blanks from sql_f
mysql_f = sql_f.replace(" ","")
# split into lists
myfields = mysql_f.split(",")
select1 = "SELECT"
select2 = "SELECT"
select3 = "SELECT"
for i in range(len(myfields)):
select1 += ' c%s "%s",' % (i,myfields[i])
select2 += ' w_tmp.c%s,' % (i)
select3 += ' %s c%s,' % (myfields[i],i)
# remove trailing ','
select1 = select1.rstrip(",")
select3 = select3.rstrip(",")
mysql = "%s\nFROM (\n  %s ROWNUM rn\n  FROM (\n%s" % 
(select1,select2,select3)  
mysql += "\nFROM %s\n%s\n%s" % (sql_t,sql_w,sql_o)
mysql += "\n  ) w_tmp\n  WHERE ROWNUM <= %s\n)WHERE rn > %s\n" % 
(limitby[1],limitby[0])
return mysql
#return  'SELECT %s %s FROM (SELECT w_tmp.*, ROWNUM w_row FROM 
(SELECT %s FROM %s%s%s) w_tmp WHERE ROWNUM<=%i) %s %s %s;' % (sql_s, sql_f, 
sql_f, sql_t, sql_w, sql_o, lmax, sql_t, sql_w_row, sql_o)

# end of my code changes

return 'SELECT %s %s FROM %s%s%s;' % (sql_s, sql_f, sql_t, sql_w, sql_o)

.


-- 
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: SQLFORM.grid problems with Oracle database tables

2016-09-06 Thread &#x27;tomt' via web2py-users
Nico,

Thanks for your response.  The tables were already joined in the query 
definition inside the controller.
   query = ((db2.STATUSPOINT.POINTNUMBER < 100)&\
 (db2.STATUSPOINT.POINTACCESSAREA == db2.AOR.AOR))

I feel quite certain that the problem is associated with the extra SQL 
required to do pagination on an Oracle database.  I have tested this theory 
to the extent that I successfully implemented the same controller, model, 
and data on a mysql database, and everything worked perfectly.  

I've included the models as you suggested:

db2 = DAL('oracle://**/@*', migrate=False)

db2.define_table('AOR',
 Field('AOR','integer',writable=False),
 Field('REFERENCENAME','string',writable=False),
 Field('ACCESSAREAASSIGNMENT','integer',writable=False),
 Field('ACCESSZONEASSIGNMENT','integer,writable=False'),
 primarykey=['AOR'],
 migrate=False
)

db2.define_table('STATUSPOINT',
   Field('POINTNUMBER', 
'integer',writable=False),  
   Field('POINTNAME',   
'string',writable=False), 
   Field('LOGPARTITION',
'integer',writable=False), 
   Field('POINTACCESSAREA', 
'integer',writable=False), 
   Field('ALTERNATEMENUINFORMATIONAREA',
'integer',writable=False), 
   Field('LOGICALDISPLAYREFERENCE', 
'string',writable=False),   
   Field('STATION', 
'integer',writable=False),  
   Field('GROUPINHERITANCE',
'integer',writable=False), 
   Field('TRIGGERS',
'integer',writable=False), 
   Field('INITIALVALUE',
'integer',writable=False), 
   Field('PROPAGATEINITIALVALUE',   
'string',writable=False), 
   Field('SETNONUPDATE',
'string',writable=False),  
   Field('MANUALOVERRIDE',  
'string',writable=False),
   Field('MANUALENTRY', 
'string',writable=False),   
   Field('EVENTS',  
'string',writable=False),
   Field('MAPBOARDGROUPNUMBER', 
'integer',writable=False),  
   Field('DATADIVISION',
'integer',writable=False), 
   Field('ANALOGDEMANDSCAN',
'string',writable=False),  
   Field('STATEFEATURES',   
'integer',writable=False),
   Field('STATECALCULATOR', 
'integer',writable=False),  
   Field('CONTROL', 
'integer',writable=False),  
   Field('INDICATION',  
'integer',writable=False),   
   Field('ALTDATASOURCELIST',   
'integer',writable=False),
   Field('ALTDATASOURCEUSAGELIST',  
'integer',writable=False),  
   Field('ALTDATASOURCEPROC',   
'integer',writable=False),
   Field('ASSOCDEVICESETNUMBER',
'integer',writable=False),  
   Field('ASSETID', 
'string',writable=False),   
   Field('PICOLLECTION',
'string',writable=False),  
   Field('PIVALUETAG',  
'string',writable=False),
   Field('PIQUALITYSTORAGE',
'string',writable=False),  
   Field('PIQUALITYTAG',
'string',writable=False),  
   Field('COLLECTTOHISTORICAL', 
'integer',writable=False),  
   Field('POINTURLS',   
'integer',writable=False),
   Field('ACTIONDESCRIPTIONSET',
'integer',writable=False),  
   Field('CIRCUITLABELNUMBER',  
'integer',writable=False),   
   Field('SUBSTATIONNUMBER',
'integer',writable=False), 
   Field('DEVICETYPENUMBER',
'integer',writable=False), 
   Field('LONGNAMENUMBER',  
'integer',writable=False),   
   Field('TOGGLERELEASETHRESHOLD',  
'integer',writable=False),  
   Field('TOGGLEINHIBITTHRESHOLD',  
'integer',writable=False),  
   Field('CONTROLWARNING',  
'integer',writable=False),   
   Field('EDNACOLLECTION',  
'string',writable=False),
   Field('EDNAEXTIDENTIFIER',   
'string',writable=False), 
   Field('EDNAQUALITYSTORAGE',  
'string',writable=False),
   Field('EDNASECURITYGROUP',   
'integer',writable=False),
   Field('DOG1REF', 
'integer',writable=False),  
 

[web2py] SQLFORM.grid problems with Oracle database tables

2016-09-05 Thread &#x27;tomt' via web2py-users
Hi,

I have been using SQLFORM.grid to display some legacy Oracle tables.  While 
it works fine when the query is for a single table, as soon as the query 
involves a join between two tables the grid returns multiple duplicate 
entries.  (I'm using web2py 2.13.4-)

The result looks like this:
PointnumberPointnameReferencename
1RTU 1 Status & ControlHarris Test
1RTU 1 Status & ControlHarris Test
1RTU 1 Status & ControlHarris Test
1RTU 1 Status & ControlHarris Test
1RTU 1 Status & ControlHarris Test
2RTU 2 Status & ControlHarris Test
2RTU 2 Status & ControlHarris Test
2RTU 2 Status & ControlHarris Test
2RTU 2 Status & ControlHarris Test
2RTU 2 Status & ControlHarris Test
3RTU 3 Status & ControlHarris Test
3RTU 3 Status & ControlHarris Test
3RTU 3 Status & ControlHarris Test
3RTU 3 Status & ControlHarris Test
3RTU 3 Status & ControlHarris Test
...

The following is the controller that generated the previous results.
..
def search1():
fields = 
[db2.STATUSPOINT.POINTNUMBER,db2.STATUSPOINT.POINTNAME,db2.AOR.REFERENCENAME]

maxtextlengths = {
   'STATUSPOINT.POINTNAME': 30,
   'AOR.REFERENCENAME': 30,
   }

query = ((db2.STATUSPOINT.POINTNUMBER < 100)&\
 (db2.STATUSPOINT.POINTACCESSAREA == db2.AOR.AOR))
 
orderby = [db2.STATUSPOINT.POINTNUMBER]
grid=SQLFORM.grid(
query=query,
deletable=False,editable=False,details=False,
searchable=True,fields=fields,
paginate=5,csv=False,maxtextlengths=maxtextlengths,
orderby=orderby,
)

print "search1 grid db2._timings %s" % db2._timings
print type(grid)
print len(grid)
return dict(grid=grid)
..

- the number of duplicates(5) is the same as the value for paginate.
- paging forward shows the same values.

- the sql reported by db2._timings is
[("ALTER SESSION SET NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'", 
0.00066494941711425781), ("ALTER SESSION SET
NLS_TIMESTAMP_FORMAT = '-MM-DD HH24:MI:SS'", 0.0005130767822265625), 
('SELECT count(*) FROM AOR,STATUSPOINT WHERE
((STATUSPOINT.POINTNUMBER < 100) AND (STATUSPOINT.POINTACCESSAREA = 
AOR.AOR))', 0.0013380050659179688), ('SELECT 
STATUSPOINT.POINTNUMBER, STATUSPOINT.POINTNAME, AOR.REFERENCENAME, AOR.AOR 
FROM (SELECT w_tmp.*, ROWNUM w_row FROM
(SELECT STATUSPOINT.POINTNUMBER, STATUSPOINT.POINTNAME, AOR.REFERENCENAME, 
AOR.AOR FROM AOR, STATUSPOINT WHERE
((STATUSPOINT.POINTNUMBER < 100) AND (STATUSPOINT.POINTACCESSAREA = 
AOR.AOR)) ORDER BY STATUSPOINT.POINTNUMBER) w_tmp
WHERE ROWNUM<=25) AOR, STATUSPOINT  WHERE ((STATUSPOINT.POINTNUMBER < 100) 
AND (STATUSPOINT.POINTACCESSAREA =
AOR.AOR)) AND w_row > 20  ORDER BY STATUSPOINT.POINTNUMBER', 
0.014330863952636719)]

- when I execute this sql from the command line using sqlplus, I see the 
same results with all the duplicates

- I believe there is flaw with the sql statements generated by web2py

- I wrote some sql that return more appropriate results but I'm not 
familiar enough with the inner workings of web2py to be able to implement 
it.
- If anyone has suggestions about where to start, what modules to change 
and best coding practices, I'd appreciate the pointers.

SELECT c1 "STATUSPOINT.POINTNUMBER", c2 "STATUSPOINT.POINTNAME", c3 
"AOR.REFERENCENAME"
FROM (
  SELECT w_tmp.c1, w_tmp.c2, w_tmp.c3, ROWNUM rn
  FROM (
SELECT STATUSPOINT.POINTNUMBER c1, STATUSPOINT.POINTNAME c2, 
AOR.REFERENCENAME c3
FROM AOR, STATUSPOINT
WHERE STATUSPOINT.POINTACCESSAREA = AOR.AOR
ORDER BY STATUSPOINT.POINTNUMBER
  ) w_tmp
  WHERE ROWNUM <= 30
)
WHERE rn > 20;

- Tom


-- 
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: Oracle perfomance issues with version 2.12.3

2015-11-10 Thread &#x27;tomt' via web2py-users
Thanks for the suggestion.  I started a web2py session from the command 
line, and ran a simple DAL select from there.

python web2py.py -M -S myapplication

result = 
db2(db2.soe_tdb.pointnumber>0).select(db2.soe_tdb.ALL,limitby=(0,10))

print db2._timings

[("ALTER SESSION SET NLS_DATE_FORMAT = '-MM-DD HH24:MI:SS'", 
0.001035928726196289), ("ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 
'-MM-DD HH24:MI:SS'", 0.0008900165557861328), ('SELECT soe_tdb.utctime, 
soe_tdb.miliseconds, soe_tdb.pointnumber, soe_tdb.pointname, 
soe_tdb.stationname, soe_tdb.statenumber, soe_tdb.statename, 
soe_tdb.groupname, soe_tdb.tv_sec, soe_tdb.tv_usec, soe_tdb.confirmed FROM 
(SELECT w_tmp.*, ROWNUM w_row FROM (SELECT soe_tdb.utctime, 
soe_tdb.miliseconds, soe_tdb.pointnumber, soe_tdb.pointname, 
soe_tdb.stationname, soe_tdb.statenumber, soe_tdb.statename, 
soe_tdb.groupname, soe_tdb.tv_sec, soe_tdb.tv_usec, soe_tdb.confirmed FROM 
soe_tdb WHERE (soe_tdb.pointnumber > 0) ORDER BY soe_tdb.utctime) w_tmp 
WHERE ROWNUM<=10) soe_tdb WHERE (soe_tdb.pointnumber > 0) AND w_row > 0 
ORDER BY soe_tdb.utctime', 59.642492055892944)]

The select took about a minute whether I used web2py version 2.9.5, 2.11.2 
or 2.12.3.  This does suggest that something changed to SQLFORM.grid 
between 2.11 and 2.12.  I'll dig a little deeper by trying some variations 
on my use of SQLFORM.grid.

Thanks, - Tom 


On Tuesday, November 10, 2015 at 12:30:55 AM UTC-6, Paolo Valleri wrote:

> Hi,
> there should be something wrong going on.
> As a first step, I'd write a simple query (i.e., select(db.table.ALL, 
> limit=(0,10)) using pydal (the database abstraction layer used in web2py) 
> and try to find out in which version has been introduced this performance 
> issue. If you don't find a performance issue on pydal, then there should be 
> something in the SQLFORM.grid part.
>
>  Paolo
>
> On Sunday, November 8, 2015 at 6:16:31 AM UTC+1, tomt wrote:
>>
>> Hi,
>>
>> I encountered really slow responses when I was using my web2py app to 
>> access an oracle database.  I tried to use dbstats in response.toolbar to 
>> measure this, but it wouldn't show the sql or any timing information.  I 
>> decided to try downgrading to an older web2py version, 2.11.2, and noticed 
>> a dramatic change.
>>
>> web2py 2.11.2   query took 4 seconds
>> web2py 2.12.3   query took > 2 minutes
>>
>> I've tried this several times, with the same result. Were there any 
>> changes in web2py that could account for this?
>>
>> The query I am running was passed to sqlform.grid
>>
>> soequery = ( (db2.soe_tdb.utctime > fromdate)&\
>>  (db2.soe_tdb.utctime < todate)&\
>>  (db2.soe_tdb.stationname.belongs(stationlist))&\
>>  (db2.soe_tdb.pointnumber == db2.statuspoint.pointnumber)&\
>>  (db2.statuspoint.pointaccessarea == 
>> db2.accessareaassignment.setnumber)&\
>>  (db2.accessareaassignment.referencename == 'SOE')&\
>>  ~(db2.statuspoint.pointname.like('%@%')) )
>>
>> orderby = [db2.soe_tdb.utctime]
>>
>> grid=SQLFORM.grid(
>> query=soequery,
>> deletable=False,editable=False,details=False,
>> searchable=True,fields=fields,headers=headers,
>> paginate=10,csv=False,maxtextlengths=maxtextlengths,
>> orderby=orderby,
>> )
>>
>> Please let me know if there is any other information that I could provide 
>> to try to resolve this.
>>
>> Thanks in advance, - Tom
>>
>

-- 
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] Oracle perfomance issues with version 2.12.3

2015-11-07 Thread &#x27;tomt' via web2py-users
Hi,

I encountered really slow responses when I was using my web2py app to 
access an oracle database.  I tried to use dbstats in response.toolbar to 
measure this, but it wouldn't show the sql or any timing information.  I 
decided to try downgrading to an older web2py version, 2.11.2, and noticed 
a dramatic change.

web2py 2.11.2   query took 4 seconds
web2py 2.12.3   query took > 2 minutes

I've tried this several times, with the same result. Were there any changes 
in web2py that could account for this?

The query I am running was passed to sqlform.grid

soequery = ( (db2.soe_tdb.utctime > fromdate)&\
 (db2.soe_tdb.utctime < todate)&\
 (db2.soe_tdb.stationname.belongs(stationlist))&\
 (db2.soe_tdb.pointnumber == db2.statuspoint.pointnumber)&\
 (db2.statuspoint.pointaccessarea == 
db2.accessareaassignment.setnumber)&\
 (db2.accessareaassignment.referencename == 'SOE')&\
 ~(db2.statuspoint.pointname.like('%@%')) )

orderby = [db2.soe_tdb.utctime]

grid=SQLFORM.grid(
query=soequery,
deletable=False,editable=False,details=False,
searchable=True,fields=fields,headers=headers,
paginate=10,csv=False,maxtextlengths=maxtextlengths,
orderby=orderby,
)

Please let me know if there is any other information that I could provide 
to try to resolve this.

Thanks in advance, - Tom

-- 
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] dbstats with oracle doesn't show sql selects or timing

2015-11-07 Thread &#x27;tomt' via web2py-users
Hi,

I'm using web2py 2.12.3 connecting to oracle 10.2
I tried to use the dbstat function of {{=response.toolbar()}} to examine 
database performance, but the sql select and its timing isn't printed.  
This feature works as expected when I'm connecting to a mysql database.  Is 
this a bug, or just a limitation of the oracle driver?

Thanks in advance, - Tom

-- 
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: what are the12 core objects

2014-07-02 Thread &#x27;tomt' via web2py-users
- thanks for the response

-- 
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] what are the12 core objects

2014-07-01 Thread &#x27;tomt' via web2py-users
The preface says that "the API includes just 12 core objects"
What are they?

- Thanks in advance 

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


[web2py] Can I temporarily disable record_versioning?

2013-10-25 Thread tomt
Hi,
I appreciate the db.table._enable_record_versioning() 
capability provided by web2py, but there are some occasions when
I'd like to modify a table that has record versioning implemented
and not modify the archive.

Is there some way that I can temporarily disable record versioning?

I guess I could use raw sql, but I was hoping there was a mechanism
to temporarily disable archiving.

Is this possible?

- thanks in advance - Tom

-- 
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: SQLFORM.grid: how can I return to a page after a custom edit function

2013-09-22 Thread tomt
I thought I'd post the solution I came up with.

It turned out to be easier than I thought it would be.  Just read the page 
number from request.vars.page, and pass it in the redirect after the 
form.accepts.


# I define the links in a subroutine.
def markup_body(row):
page = request.vars.page
if page:
body = 
A('edit',_href=URL('markup_edit',args=(row.id),vars=dict(page=page)) )
else:
body = A('edit',_href=URL('markup_edit',args=(row.id)) )

return body

def markupgrid():
query = (db.sta_markup.id>0)
table=db.sta_markup
db.sta_markup.modified_on.readable = True  # force the field to be 
viewed
db.sta_markup.modified_by.readable = True
fields=[db.sta_markup.formatted_text,
db.sta_markup.modified_on,
db.sta_markup.modified_by,]
grid = SQLFORM.grid(query=query,

details=False,csv=False,editable=False,deletable=False,create=False,searchable=True,
paginate=5,fields=fields,links=[dict(header='Link',body=markup_body 
)],links_placement='left',
)
return dict(grid=grid)

def markup_edit():  
id = request.args(0)  
page = request.vars.page
info = db.sta_markup(id)
form = SQLFORM(db.sta_markup,info,deletable = True, showid=False)
if form.accepts(request.vars, session):
response.flash='Changes saved'
redirect(URL(f='markupgrid',vars=dict(page=page)))
    
return dict(form=form)


On Wednesday, September 18, 2013 9:57:33 PM UTC-6, tomt wrote:
>
> Hi,
>
> I'm looking for suggestions or examples on how I can implement a custom 
> edit function for SQLFORM.grid that will remember the page it was called 
> from, and return to it once the editing is complete.
>
> I was able to call the custom edit function easily enough by using the 
> 'links' parameter
> links=[dict(header='edit',body=lambda row: 
> A('edit',_href=URL('edit_markup',args=(row.id))) )]
>
> edit_markkup uses SQLFORM to edit the record, and this is working 
> correctly, but I don't know how to code the redirect to return to the same 
> page position in the grid that it was called from. (In other words, if the 
> record I wanted to edit was on the second page, once editing was done, the 
> second page would be displayed)
>
> After searching through this group I believe that I have to pass the page 
> number and the signature, but I haven't figured out how to do this.
>
> If this is possible, I'd really appreciate a simple example of how to do 
> it.  - Tom
>
>

-- 
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] SQLFORM.grid: how can I return to a page after a custom edit function

2013-09-18 Thread tomt
Hi,

I'm looking for suggestions or examples on how I can implement a custom 
edit function for SQLFORM.grid that will remember the page it was called 
from, and return to it once the editing is complete.

I was able to call the custom edit function easily enough by using the 
'links' parameter
links=[dict(header='edit',body=lambda row: 
A('edit',_href=URL('edit_markup',args=(row.id))) )]

edit_markkup uses SQLFORM to edit the record, and this is working 
correctly, but I don't know how to code the redirect to return to the same 
page position in the grid that it was called from. (In other words, if the 
record I wanted to edit was on the second page, once editing was done, the 
second page would be displayed)

After searching through this group I believe that I have to pass the page 
number and the signature, but I haven't figured out how to do this.

If this is possible, I'd really appreciate a simple example of how to do 
it.  - Tom

-- 
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] Re: web2py 2.6.1 is OUT - IMPORTANT READ

2013-09-14 Thread tomt
Hi,

I am getting a mysql error after upgrading to 2.6.1(and 2.6.2)

Web2py doesn't throw a ticket, rather the mysql error shows up directly on 
the browser:

Query Not Supported: (1064, u"You have an error in your SQL syntax; check 
the manual that
corresponds to your MySQL server version for the right syntax to use near 
'LONGTEXT)) AND
(staffnotes.is_active = 'T')) ORDER BY staffnotes.date DESC, staf' at line 
1")

I have record versioning enabled on the table in question:
db.define_table('staffnotes',
 Field('staffid','string'),
 Field('date','datetime',requires=IS_DATETIME(format='%Y-%m-%d 
%H:%M:%S'), default=request.now),
 Field('comment','string'),
 auth.signature,  
)
db.staffnotes._enable_record_versioning()

I chose to let the migration occur rather than go through the migrate_false 
steps mentioned.
The sql.log for the app revealed that migrations were performed on all 
string types, but not for the 'is_active' field defined with 
auth.signature. It remains defined as char(1) in mysql.

Any suggestions?

-- 
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: Example of web2py integration with an AJAX grid (preferably jquery based) which updates backend db ?

2013-09-08 Thread tomt
Simon,

I wanted to thank you for the answer you posted.
As a casual user of web2py, I would have never figured this out
on my own, but your clear example showing db, controller and view
made it easy for me to understand and to implement.

It would be great if the experienced users of web2py would
contribute similar small examples. I believe that would be
one way to help make web2py more popular.

ps. I had to modify the following to get update to work:
jQuery('.dog_name').editable("{{=URL('dogs', 
'upd_dog_name')}}",{  
to:
jQuery('.dog_name').editable("{{=URL('default', 
'upd_dog_name')}}",{  

- Tom


On Wednesday, September 4, 2013 11:25:49 PM UTC-6, Simon Ashley wrote:
>
> Download jeditable, 
> Install in the static/js folder.
>
> Include in layout.html i.e.
>   
>
>
> *Model*
> db.define_table('dogs',
> Field('dog_name','string'))
>
>
> *Controller:*
> def populate():
> db.dogs.truncate()
> db.fleas.truncate()
> db.dogs.insert(dog_name='dagwood')
> db.dogs.insert(dog_name='daisy')
> 
> def dogs():
> db.dogs.dog_name.represent = lambda value, row: DIV(value if value 
> else '-',_class='dog_name', _id=str(row.id)+'.dog_name')
> g = SQLFORM.grid(db.dogs, searchable=False, csv=False, user_signature=
> False)
> return dict(form = g)
>
>
> def upd_dog_name():
> id,column = request.post_vars.id.split('.')
> value = request.post_vars.value
> db(db.dogs.id == id).update(**{column:value})
> return value
>
>
> *View:*
> {{extend 'layout.html'}}
>
> 
> jQuery(document).ready(function(){
> jQuery('.dog_name').editable("{{=URL('dogs', 'upd_dog_name')}}",{ 
>   
> tooltip: "Click to edit, enter to save",
>  indicator : 'updating',
>  });})
> 
>
>
> 
> {{=form}}
> 
>
>
>
>

-- 

--- 
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] Question about using _enable_record_versioning to another database

2013-07-20 Thread tomt
It appears that if I use _enable_record_versioning to archive a table 
to another database, then that database must have an auth_user table.

Is there any way to archive a table to another database and have 
it refer to the auth_user table in the local database?

# local database
db = 
DAL('mysql://arch:*@localhost/arch',pool_size=1,check_reserved=['mysql'])
# external database
db2 = 
DAL('mysql://arch2:*@localhost/arch2',pool_size=1,check_reserved=['mysql'])


db.define_table('stuff',
Field('pointtype','integer',),
Field('comment','string'),
auth.signature,
)
db.stuff._enable_record_versioning(archive_db=db2)

-- 

--- 
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: Use model in another app

2013-07-04 Thread tomt
Occasionally I have written a web2py app that makes use of a model/db from 
another app.  Basically, all that I do is define additional database 
connections in models/db.py to the old app, and redeclare all the table 
definitions. 
I attempt to prevent accidental structure changes to the external tables by 
adding migrate=false to the connection.
This works for me, but there may be some serious problems with this method 
that I haven't considered.  

In the following example, db2 and db3 are the connections to model/db from 
another app.
I've included a few of the define_table statement to try to give you an 
idea of what I did.
The controller example shows how the external databases are accessed.

I hope this answers your question.  - Tom

--- snippets from models/db.py

db = DAL('mysql://**:**@*/master')   
db2 = DAL('oracle://**/***@', migrate=False) # 
external
db3 = DAL('mysql://*:*@*/semdb',migrate=False)   # 
external

db2.define_table('accessareaassignment',
 Field('assignmentnumber','integer',writable=False),
 Field('referencename','string',writable=False),
 Field('setnumber','integer',writable=False),
 Field('accessarea','integer',writable=False),
 primarykey=['assignmentnumber'],
 migrate=False
 )

db3.define_table('scadaemail',
Field('type','string',default='Disabled'),
Field('email','string'),
Field('comment','string'),
)


--- code snippets from controllers/default.py
...
info = db3.scadapointlist(id)
form = SQLFORM(db3.scadapointlist,info,showid=False)
if (info.pointtype == 1):
pointname_info = db2(db2.statuspoint.pointnumber == 
info.pointnumber).select()
if (info.pointtype == 2):
pointname_info = db2(db2.analogpoint.pointnumber == 
info.pointnumber).select()
#if ((type == "None") or (point == "None")):

form.vars.pointname = pointname_info[0].pointname
... 

grid = SQLFORM.grid(db3.scadaemail,
details=False,searchable=False,csv=False,showbuttontext=True,

fields=[db3.scadaemail.type,db3.scadaemail.email,db3.scadaemail.comment],
maxtextlengths=maxtextlengths,
)




On Thursday, June 27, 2013 1:03:09 PM UTC-6, Tom Russell wrote:
>
> I have 2 apps and one I want to use the model/db from it in the other in a 
> SQLFORM.grid. I have read through and googled and cannot find a way to do 
> this.
>
> Is this possible and how?
>
> Thanks,
>
> Tom
>

-- 

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

2013-04-05 Thread tomt
I migrate applications fairly often, and using fake_migrate_all works best 
for me:

db = DAL(...,fake_migrate_all=True)



On Friday, April 5, 2013 5:24:33 PM UTC-6, Tito Garrido wrote:
>
> Hi Folks!
>
> I am trying to migrate my web2py application from one server to another.
>
> I have pack my application and restored the MYSQL database but when I 
> tried to run it there I got:
> InternalError: (1050, u"Table 'auth_user' already 
> exists")
> I have followed 
> http://web2py.com/books/default/chapter/29/06?search=fake_#Fixing-broken-migrations
>
> but when I try to use fake_migration I got
> 504 Gateway Time-out 
> --
> nginx/1.1.19
>
>
> How can I fix it?
>
> Regards,
>
> Tito
>
> -- 
>
> Linux User #387870
> .
>  _/_õ|__|
> ..º[ .-.___.-._| . . . .
> .__( o)__( o).:___ 
>

-- 

--- 
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: problem with latest trunk SQLFORM.grid

2012-12-14 Thread tomt
Thanks for the response.

To restate your answer, if arg[id] is declared, then the calling url must 
reflect this.

Given this, It turns out that I can avoid the problem I was having by 
simply changing the form.accepts section to redirect after processing.

The previous version of sqlhtml.py was letting me get away with some 
questionable code.


On Wednesday, December 12, 2012 9:00:33 PM UTC-6, Massimo Di Pierro wrote:
>
> I believe this is the correct behavior.
>
> You are declaring that the Grid urls must contain args=[id] so if it is 
> does not you have no access. your grid is readonly mode so it is always 
> visible (when it properly parse the arguments).
>
> I am missing something?
>
>
>
>
>
> On Monday, 10 December 2012 21:48:09 UTC-6, tomt wrote:
>>
>> I simplified the controller to better understand the problem I'm seeing.
>>
>> def test():
>> id = 2
>> query = (db.staffnotes.staffid == id)
>> 
>> fields=[db.staffnotes.staffid,db.staffnotes.date,db.staffnotes.comment]
>> orderby = [~db.staffnotes.date,~db.staffnotes.modified_on]
>> grid = SQLFORM.grid(query=query,
>> 
>> details=False,csv=False,editable=False,deletable=False,create=False,searchable=True,
>> paginate=10,fields=fields,orderby=orderby,
>> args=[id],
>> )
>> return dict(grid=grid) 
>>
>> - When I call this routine with:
>> http://localhost:8000/myapp/default/test
>> - I receive the 'not authorized' flash and the grid doesn't display
>>
>> - If I call it with:
>> http://localhost:8000/myapp/default/test/2
>> - the grid displays with no error.
>> (this appears to be because request.args(0) matchs args=[id] where id=2)
>>
>> - If I call it with:
>> http://localhost:8000/myapp/default/test/garbage/view
>> - I receive the 'not authorized' flash and the grid doesn't display
>> - If I signoff and repeat the url
>> http://localhost:8000/myapp/default/test/garbage/view
>> - the grid displays with no error.
>> - I don't intend to pass phony urls to get past the error. I just listed 
>> them to try to understand what I'm doing wrong.
>>
>> - If I get rid of the args=[id] parameter on SQLFORM.grid call
>>   the grid displays no matter what the url is, and whether or not I'm 
>> logged in,
>>   but I need the args=[id] because I use it with links.
>>
>> Does this clarify anything?  
>>
>> On Monday, December 10, 2012 12:44:30 PM UTC-6, tomt wrote:
>>>
>>> Yes, I am logged in.
>>>  
>>> On the initial call of the controller the grid is displayed without and 
>>> error.  When I select a new value from the dropdown form, a new query is 
>>> used and passed to SQLFORM.grid, and this is when the 'not authorized' 
>>> flash is generated.
>>>  
>>>  
>>> On Monday, December 10, 2012 9:21:29 AM UTC-6, Massimo Di Pierro wrote:
>>>
>>>> Are you logged in when you try accessing the grid? Do you get a not 
>>>> authorized when trying to visualize the grid or when searching or when 
>>>> visualizing a record? 
>>>>
>>>> Massimo
>>>>
>>>> On Sunday, 9 December 2012 19:23:20 UTC-6, tomt wrote: 
>>>>>
>>>>> Hi,
>>>>>
>>>>> Recent changes in trunk are causing my use of SQLFORM.grid to issue a 
>>>>> 'not authorized' flash.
>>>>> It appears to be because of the following change in sqlhtml.py:
>>>>>
>>>>> - stable:
>>>>> # if not user_signature every action is accessible
>>>>> # else forbid access unless
>>>>> # - url is based url
>>>>> # - url has valid signature (vars are not signed, only 
>>>>> path_info)
>>>>> # = url does not contain 'create','delete','edit' (readonly)
>>>>> if user_signature:
>>>>> if not(
>>>>> '/'.join(str(a) for a in args) == 
>>>>> '/'.join(request.args) or
>>>>> URL.verify(request, user_signature=user_signature,
>>>>>hash_vars=False) or not (
>>>>> 'create' in request.args or
>>>>> 'delete' in request.args or
>>>>> 'edit' in request.args)):
>

[web2py] Re: problem with latest trunk SQLFORM.grid

2012-12-10 Thread tomt
I simplified the controller to better understand the problem I'm seeing.

def test():
id = 2
query = (db.staffnotes.staffid == id)
fields=[db.staffnotes.staffid,db.staffnotes.date,db.staffnotes.comment]
orderby = [~db.staffnotes.date,~db.staffnotes.modified_on]
grid = SQLFORM.grid(query=query,

details=False,csv=False,editable=False,deletable=False,create=False,searchable=True,
paginate=10,fields=fields,orderby=orderby,
args=[id],
)
return dict(grid=grid) 

- When I call this routine with:
http://localhost:8000/myapp/default/test
- I receive the 'not authorized' flash and the grid doesn't display

- If I call it with:
http://localhost:8000/myapp/default/test/2
- the grid displays with no error.
(this appears to be because request.args(0) matchs args=[id] where id=2)

- If I call it with:
http://localhost:8000/myapp/default/test/garbage/view
- I receive the 'not authorized' flash and the grid doesn't display
- If I signoff and repeat the url
http://localhost:8000/myapp/default/test/garbage/view
- the grid displays with no error.
- I don't intend to pass phony urls to get past the error. I just listed 
them to try to understand what I'm doing wrong.

- If I get rid of the args=[id] parameter on SQLFORM.grid call
  the grid displays no matter what the url is, and whether or not I'm 
logged in,
  but I need the args=[id] because I use it with links.

Does this clarify anything?  

On Monday, December 10, 2012 12:44:30 PM UTC-6, tomt wrote:
>
> Yes, I am logged in.
>  
> On the initial call of the controller the grid is displayed without and 
> error.  When I select a new value from the dropdown form, a new query is 
> used and passed to SQLFORM.grid, and this is when the 'not authorized' 
> flash is generated.
>  
>  
> On Monday, December 10, 2012 9:21:29 AM UTC-6, Massimo Di Pierro wrote:
>
>> Are you logged in when you try accessing the grid? Do you get a not 
>> authorized when trying to visualize the grid or when searching or when 
>> visualizing a record? 
>>
>> Massimo
>>
>> On Sunday, 9 December 2012 19:23:20 UTC-6, tomt wrote: 
>>>
>>> Hi,
>>>
>>> Recent changes in trunk are causing my use of SQLFORM.grid to issue a 
>>> 'not authorized' flash.
>>> It appears to be because of the following change in sqlhtml.py:
>>>
>>> - stable:
>>> # if not user_signature every action is accessible
>>> # else forbid access unless
>>> # - url is based url
>>> # - url has valid signature (vars are not signed, only path_info)
>>> # = url does not contain 'create','delete','edit' (readonly)
>>> if user_signature:
>>> if not(
>>> '/'.join(str(a) for a in args) == '/'.join(request.args) 
>>> or
>>> URL.verify(request, user_signature=user_signature,
>>>hash_vars=False) or not (
>>> 'create' in request.args or
>>> 'delete' in request.args or
>>> 'edit' in request.args)):
>>> session.flash = T('not authorized')
>>> redirect(referrer)
>>> - trunk
>>> # if not user_signature every action is accessible
>>> # else forbid access unless
>>> # - url is based url
>>> # - url has valid signature (vars are not signed, only path_info)
>>> # = url does not contain 'create','delete','edit' (readonly)
>>> if user_signature:
>>> if not (
>>> '/'.join(str(a) for a in args) == '/'.join(request.args) 
>>> or
>>> URL.verify(request,user_signature=user_signature,
>>>hash_vars=False) or
>>> (request.args(len(args))=='view' and not logged)):
>>> session.flash = T('not authorized')
>>> redirect(referrer)
>>>
>>> I normally call my routine with no parameter after having signed on
>>> and then I select a specific user from the dropdown list. 
>>> With the latest trunk the selection is ignored and the flash 'not 
>>> authorized'
>>> is generated. My controller doesn't call create, delete, or edit. It 
>>> uses javascript to 
>>> to select and pass on the staffid to the

[web2py] Re: problem with latest trunk SQLFORM.grid

2012-12-10 Thread tomt
Yes, I am logged in.
 
On the initial call of the controller the grid is displayed without and 
error.  When I select a new value from the dropdown form, a new query is 
used and passed to SQLFORM.grid, and this is when the 'not authorized' 
flash is generated.
 
 
On Monday, December 10, 2012 9:21:29 AM UTC-6, Massimo Di Pierro wrote:

> Are you logged in when you try accessing the grid? Do you get a not 
> authorized when trying to visualize the grid or when searching or when 
> visualizing a record? 
>
> Massimo
>
> On Sunday, 9 December 2012 19:23:20 UTC-6, tomt wrote: 
>>
>> Hi,
>>
>> Recent changes in trunk are causing my use of SQLFORM.grid to issue a 
>> 'not authorized' flash.
>> It appears to be because of the following change in sqlhtml.py:
>>
>> - stable:
>> # if not user_signature every action is accessible
>> # else forbid access unless
>> # - url is based url
>> # - url has valid signature (vars are not signed, only path_info)
>> # = url does not contain 'create','delete','edit' (readonly)
>> if user_signature:
>> if not(
>> '/'.join(str(a) for a in args) == '/'.join(request.args) 
>> or
>> URL.verify(request, user_signature=user_signature,
>>hash_vars=False) or not (
>> 'create' in request.args or
>> 'delete' in request.args or
>> 'edit' in request.args)):
>> session.flash = T('not authorized')
>> redirect(referrer)
>> - trunk
>> # if not user_signature every action is accessible
>> # else forbid access unless
>> # - url is based url
>> # - url has valid signature (vars are not signed, only path_info)
>> # = url does not contain 'create','delete','edit' (readonly)
>> if user_signature:
>> if not (
>> '/'.join(str(a) for a in args) == '/'.join(request.args) 
>> or
>> URL.verify(request,user_signature=user_signature,
>>hash_vars=False) or
>> (request.args(len(args))=='view' and not logged)):
>> session.flash = T('not authorized')
>> redirect(referrer)
>>
>> I normally call my routine with no parameter after having signed on
>> and then I select a specific user from the dropdown list. 
>> With the latest trunk the selection is ignored and the flash 'not 
>> authorized'
>> is generated. My controller doesn't call create, delete, or edit. It uses 
>> javascript to 
>> to select and pass on the staffid to the grid.
>>
>> Restoring this piece of code in sqlhtml.py to the previous version 
>> eliminates my problem.
>> I'm not sure what change was meant to do differently. Perhaps it was a 
>> mistake, or it could be that I was using SQLFORM.grid incorrectly.
>>
>> ... my controller 
>> def note_list():
>> script = SCRIPT("""
>> $('document').ready(function(){
>> $('#mycombo').change(function(){
>> $('#myform').submit();
>> });
>> });
>> """)
>>
>> form = SQLFORM(db.staffnotes,fields=['staffid'])
>> del form[0][1]  # delete the submit_record__row from the form
>> staffid = request.args(0)
>> # Modify form elements for use by script
>> form.attributes['_id'] = 'myform'
>> form.element('select').attributes['_id'] = 'mycombo'
>>
>> # Build table of all notes if staffid isn't set
>> if staffid:
>> query = ((db.staffnotes.staffid == db.staff.id) & 
>> (db.staffnotes.staffid == staffid))
>> else:
>> query = ((db.staffnotes.staffid == db.staff.id))
>>
>> if form.accepts(request.vars,session,dbio=False):
>> staffid = form.vars.staffid 
>> query = ((db.staffnotes.staffid == db.staff.id) & 
>> (db.staffnotes.staffid == staffid))
>>
>> 
>> fields=[db.staffnotes.staffid,db.staffnotes.date,db.staffnotes.comment]
>&g

[web2py] Re: SQLFORM.grid: search and links

2012-12-07 Thread tomt
After some more investigation I found out that the latest trunk has the 
added options:
 buttons_placement = 
'right',   ):
 links_placement = 'right' 

With this option I can set links_placement ='left'  which results in the 
'links' column appearing on the first column.

Great, problem solved.

On Friday, December 7, 2012 10:02:53 PM UTC-6, tomt wrote:
>
> I would also like to be able to change the position of the 'links' column.
> I see that your post didn't receive any answers. Did you figure out how to 
> do this?
> If you did, I would appreciate if you could tell me how.
>
> - Tom
>
> On Sunday, January 29, 2012 4:33:21 PM UTC-6, backseat wrote:
>>
>> I've a couple of questions about SQLFORM.grid:
>>
>>  - Is it possible to position the buttons/links created by the 'links' 
>> argument somewhere other than the end of the row? It feels as if the 
>> 'fields' argument should be able to do this, but I can't see how.
>>
>>  - Is it possible for the 'search' box to search linked tables? That may 
>> be asking a bit much...
>>
>> Thanks
>>
>

-- 





[web2py] Re: SQLFORM.grid: search and links

2012-12-07 Thread tomt
I would also like to be able to change the position of the 'links' column.
I see that your post didn't receive any answers. Did you figure out how to 
do this?
If you did, I would appreciate if you could tell me how.

- Tom

On Sunday, January 29, 2012 4:33:21 PM UTC-6, backseat wrote:
>
> I've a couple of questions about SQLFORM.grid:
>
>  - Is it possible to position the buttons/links created by the 'links' 
> argument somewhere other than the end of the row? It feels as if the 
> 'fields' argument should be able to do this, but I can't see how.
>
>  - Is it possible for the 'search' box to search linked tables? That may 
> be asking a bit much...
>
> Thanks
>

-- 





Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-11-23 Thread tomt
I run into the same problem.  I don't have a solution other than removing 
the row from the represent statement when using powertable.  
example:
db.acquisti.id_p.represent=lambda id: db.prodotti[id].nomeb
or
db.task.designer.represent = lambda value: db.staff[value].name

The problem with this is that it will then generate an error if 
SQLFORM.grid is used to display the same table.


On Friday, November 23, 2012 1:50:27 PM UTC-6, palomar wrote:
>
> Thanks for your tips but I have one more problem:
> in my model I use represent to view the title instead of the ID of a 
> linked table:
>
> #db.acquisti.id_p.represent=lambda id, row: db.prodotti[id].nomeb
>
> that (I think) generate this error whit powertable:
> (() takes exactly 2 arguments (1 given))
>
> line 286:
>
> elif field.represent:
> r = field.represent(r)
>
>
> Someone can help me?
> ciao ;)
>
> Il giorno venerdì 23 novembre 2012 20:44:02 UTC+1, palomar ha scritto:
>>
>> i think 
>>
>> response.files.append(URL(r=request,c='static',f='plugin_powertable/ui/css/%s/jquery-ui-1.8.24.custom.js'))
>> ;)
>>
>> Il giorno giovedì 18 ottobre 2012 06:06:33 UTC+2, tomt ha scritto:
>>>
>>> After a little digging around on the web  I found out why I was 
>>> powertable was generating errors with the latest web2py.
>>>
>>> jquery version 1.8 requires jquery-ui-1.8.22
>>>
>>> I went to http://jqueryui.com/ and downloaded legacy v1.8.24 which 
>>> provided jquery-ui-1.8.24.custom.zip. This zip file included 
>>> jquery-ui-1.8.24.custom.min.js which I then copied to 
>>> static/plugin_powertable/ui/js
>>> I modified models/powertable.py to load it:
>>>
>>>
>>> After taking these steps, the error messages are gone and now powertable 
>>> works with no problems.
>>>
>>>
>>>
>>> On Sunday, October 14, 2012 9:10:17 PM UTC-6, tomt wrote:
>>>>
>>>> I noticed another problem with powertable and web2py 2.0.9
>>>>
>>>> When I created a new app under web2py 2.0.9 and tried to implement a 
>>>> powertable it exhibited some unusual behaviour. On initial callup, the 
>>>> powertable showed all records instead of the number specified by 
>>>> iDisplayLength and the columns don't show the column sorting icon. Also 
>>>> the 
>>>> column id is displayed even though table.showkeycolumn = False
>>>>
>>>> Firebug showed an error in plugin_powertable/jquery.dataTables.min.js: 
>>>> "detailed error: TypeError: a.charCodeAt is not a function"
>>>>
>>>> I discovered that if I replaced /static/js/jquery.js with version 
>>>> v1.7.1 from an earlier version of web2py, all the powertable problems 
>>>> disappeared.
>>>>
>>>> Web2py 2.0.9 uses jQuery v@1.8.0 which apparently triggers the problem 
>>>> with powertable.  Earlier versions of web2py used jQuery v1.7.1 which 
>>>> seems 
>>>> to work ok with powertable.
>>>>
>>>> I'm wondering if I can make powertable work if I use a more recent 
>>>> version of datatables?  Which files from the datatables would I have to 
>>>> incorporate? Any suggestions?
>>>>
>>>> - Tom
>>>>
>>>>
>>>>
>>>>
>>>> On Monday, October 8, 2012 5:42:46 PM UTC-6, rochacbruno wrote:
>>>>>
>>>>> Thanks, I will update the repo. 
>>>>
>>>>

-- 





[web2py] Record versioning

2012-10-23 Thread tomt
Hi,

I'm using auth.signature and db.my_table._enable_record_versioning()
to enable record versioning on a table.

db.define_table('mytable',
 Field('staffid','string'),
 Field('date','datetime',requires=IS_DATETIME(format='%Y-%m-%d 
%H:%M:%S'), default=request.now),
 Field('comment','string'),
 auth.signature 
)
db.mytable._enable_record_versioning()

This works great. I can delete or modify records and I have a full 
historical record in mytable_archive.

I can see all the details with the appadmin function, but I haven't 
been able to figure out how to display this info with SQLFORM.grid
I thought I could disable the common_filter with:
db.mytable._common_filter = None
but this didn't work.

Any pointers?

-- 





Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-17 Thread tomt
After a little digging around on the web  I found out why I was powertable 
was generating errors with the latest web2py.

jquery version 1.8 requires jquery-ui-1.8.22

I went to http://jqueryui.com/ and downloaded legacy v1.8.24 which provided 
jquery-ui-1.8.24.custom.zip. This zip file included 
jquery-ui-1.8.24.custom.min.js which I then copied to 
static/plugin_powertable/ui/js
I modified models/powertable.py to load it:
response.files.append(URL(r=request,c='static',f='plugin_powertable/ui/css/%s/jquery-ui-1.8.24.custom.css'
 
% theme))

After taking these steps, the error messages are gone and now powertable 
works with no problems.



On Sunday, October 14, 2012 9:10:17 PM UTC-6, tomt wrote:
>
> I noticed another problem with powertable and web2py 2.0.9
>
> When I created a new app under web2py 2.0.9 and tried to implement a 
> powertable it exhibited some unusual behaviour. On initial callup, the 
> powertable showed all records instead of the number specified by 
> iDisplayLength and the columns don't show the column sorting icon. Also the 
> column id is displayed even though table.showkeycolumn = False
>
> Firebug showed an error in plugin_powertable/jquery.dataTables.min.js: 
> "detailed error: TypeError: a.charCodeAt is not a function"
>
> I discovered that if I replaced /static/js/jquery.js with version v1.7.1 
> from an earlier version of web2py, all the powertable problems disappeared.
>
> Web2py 2.0.9 uses jQuery v@1.8.0 which apparently triggers the problem 
> with powertable.  Earlier versions of web2py used jQuery v1.7.1 which seems 
> to work ok with powertable.
>
> I'm wondering if I can make powertable work if I use a more recent version 
> of datatables?  Which files from the datatables would I have to 
> incorporate? Any suggestions?
>
> - Tom
>
>
>
>
> On Monday, October 8, 2012 5:42:46 PM UTC-6, rochacbruno wrote:
>>
>> Thanks, I will update the repo. 
>
>

-- 





Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-14 Thread tomt
I noticed another problem with powertable and web2py 2.0.9

When I created a new app under web2py 2.0.9 and tried to implement a 
powertable it exhibited some unusual behaviour. On initial callup, the 
powertable showed all records instead of the number specified by 
iDisplayLength and the columns don't show the column sorting icon. Also the 
column id is displayed even though table.showkeycolumn = False

Firebug showed an error in plugin_powertable/jquery.dataTables.min.js: 
"detailed error: TypeError: a.charCodeAt is not a function"

I discovered that if I replaced /static/js/jquery.js with version v1.7.1 
from an earlier version of web2py, all the powertable problems disappeared.

Web2py 2.0.9 uses jQuery v@1.8.0 which apparently triggers the problem with 
powertable.  Earlier versions of web2py used jQuery v1.7.1 which seems to 
work ok with powertable.

I'm wondering if I can make powertable work if I use a more recent version 
of datatables?  Which files from the datatables would I have to 
incorporate? Any suggestions?

- Tom




On Monday, October 8, 2012 5:42:46 PM UTC-6, rochacbruno wrote:
>
> Thanks, I will update the repo. 

-- 





[web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-08 Thread tomt
Thanks to everybody for fixing this!

You might also want to make a similar change at about line 244:
 
   try:
field = sqlrows.db[tablename][fieldname]
#   except KeyError:
except (KeyError,AttributeError):
field = None


On Monday, October 8, 2012 2:15:58 PM UTC-6, Massimo Di Pierro wrote:


:-)
>
> On Monday, 8 October 2012 12:53:27 UTC-5, Don_X wrote:
>>
>> BINGO ! - IT WORKS LIKE A CHARM MASSIMO !!! ...  
>>
>> Thank you ... now  I can study this properly so I can adapt it to my app !
>>
>> On Monday, October 8, 2012 1:49:09 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Now the error is at a different line. The previous error has been fixed. 
>>> Now it is at line 215:
>>>
>>>
>>> try:
>>> _id = record[keycolumntbl][keycolumnfld]
>>> except KeyError:
>>>
>>>
>>> as before it should be
>>>
>>> try:
>>> _id = record[keycolumntbl][keycolumnfld]
>>> except (KeyError, AttributeError):
>>>
>>>
>>>
>>> On Monday, 8 October 2012 12:39:09 UTC-5, Don_X wrote:

 For a more detailed report .. I have openned up the last line 
 pertaining to the plugin_powertable.py below :



- 
Function argument list   

()

Code listing



20.
21.
22.
23.
24.
25.

26.
27.
28.
29.

table.showkeycolumn = False
table.extra = dict(
   
 details={'detailscallback':URL('myfunction.load')}
   )

table = table.create()


return locals()

   Variables
 
table>>>'...te': }>table.create<
function plugin_powertable>   
-   

*File /home/www-data/web2py/applications/powertable/
models/plugin_powertable.py in plugin_powertable at line 811*
code
arguments
variables   
Function argument list


()
  Code listing 

806.
807.
808.
809.
810.
811.

812.
813.
814.
815.

ifunctions=str(ifunctions),

 searchcolumnjs=str(searchcolumnjs)
)
  ),
CSS,
PowerTable(),

)


plugins.powerTable.create = plugin_powertable

Variables
global PowerTable
- 
 

*File /home/www-data/web2py/applications/powertable/
models/plugin_powertable.py in __init__ at line 215*
code
arguments
variables   

Function argument list


(self=<__restricted__.PowerTable object>)
  Code listing



210.
211.
212.
213.
214.
215.

216.
217.
218.
219.

else:
_title = T('Record %s' % str(rc+1))

#setting the id and key for every  based on required 
 keycolumn
try:
_id = record[keycolumntbl][keycolumnfld]

except KeyError:
if virtualfields:
_id = record[sqlrows.colnames[0].split('.')[0]].id
else:


   Variables
 
 record>>>object at 0xa757f98c>, 'name': 'Television'}>_idundefined
keycolumntbl'product'keycolumnfld'id'
- 

*File /home/www-data/web2py/gluon/dal.py in __getitem__ 
at line 6376*
code
arguments
variables  
Function argument list


(self=>>>'...ter object at 0xa757f98c>, 'name': 'Television'}>, 
key='product')
Code listing  

6371.
6372.
6373.
6374.
6375.
6376.

6377.
6378.
6379.
6380.

elif m:
try:
   

Re: [web2py] Re: powerTable AttributeError: 'DAL' object has no attribute 'virtual'

2012-10-02 Thread tomt
I also have been having the same issue.  I'm running web2py 2.0.9
I only have one db = DAL statement.
All of my DAL is in models/db.py.  I don't have any files in the modules 
directory.
I haven't specifically stored a rows object in session, although the 
controller does have a couple of the following statements.
if form.accepts(request.vars,session, dbio=False):


On Monday, October 1, 2012 3:05:34 PM UTC-6, Massimo Di Pierro wrote:
>
> Are you storing a rows object in a session? Do you have DAL in modules 
> instead of models? Do you have multiple db=DAL() statements?
>
> On Monday, 1 October 2012 14:33:29 UTC-5, Wes Hall wrote:
>>
>> I have been having the same issue and was able to try trunk just now.
>>
>> The error persists.
>>
>> My working powerTable code on 1.99.3 no longer works on 2.0.9.
>>
>> On Monday, October 1, 2012 1:23:54 PM UTC-4, Massimo Di Pierro wrote:
>>>
>>> Can you please try the trunk version?
>>>
>>> On Sunday, 30 September 2012 21:32:22 UTC-5, visuallinux wrote:

 Dear Massimo.

 My code is the following:

 @auth.requires_membership('Administrador')
 def clientes():


 class Virtual(object):

 @virtualsettings(label=T('Editar'))
 def edit(self):
 
 link_editar= URL(r =request,f='editablefunction',
 args=[self.clientes.id])
 link_icono_editar= IMG(_src=URL(r=request,c='static',
 f='images/Edit_Icon.png'),
 _alt='Editar'
 )
 return (A(link_icono_editar,_href= link_editar))# + str(
 self.clientes.id))) 

reg=db(db.clientes).select(db.clientes.id
 ,db.clientes.rut,db.clientes.dv,db.clientes.rsocial,
 
 db.clientes.direccion,db.clientes.ciudad,db.clientes.mail,
 
 db.clientes.tipo,db.clientes.fecha,db.clientes.giro,db.tarifa.nombre,
 db.estados.nombre,db.clientes.tarifica,
 join=(db.tarifa.on(db.clientes.id_tarifa==db.tarifa.id),
 db.estados.on(db.clientes.estado==db.estados.id),
 db.tipos.on(db.clientes.tipo==db.tipos.id),
 db.tarificacion.on(db.clientes.tarifica==
 db.tarificacion.id)),

 orderby=db.clientes.rsocial)

 powerTable = plugins.powerTable
 powerTable.datasource = reg
 .
 .
 table=powerTable.create()
 return dict(table=table)


 I do not understand what is wrong.

 --- On *Sun, 9/30/12, Massimo Di Pierro * wrote:


 From: Massimo Di Pierro 
 Subject: [web2py] Re: powerTable AttributeError: 'DAL' object has no 
 attribute 'virtual'
 To: web...@googlegroups.com
 Date: Sunday, September 30, 2012, 11:00 PM

 I think it should be Virtual, not virtual.

 On Sunday, 30 September 2012 20:11:34 UTC-5, visuallinux wrote:

 Dear All. 

 I am trying to use PowerTable, but i am receiving the follow error: 

 Traceback (most recent call last): 
   File "/home/fvillarroel/www/web2py/ gluon/restricted.py", line 209, 
 in restricted 
 exec ccode in environment 
   File "/home/fvillarroel/www/web2py/ applications/administrador/ 
 controllers/clientes.py", line 107, in  
   File "/home/fvillarroel/www/web2py/ gluon/globals.py", line 185, in 
  
 self._caller = lambda f: f() 
   File "/home/fvillarroel/www/web2py/ gluon/tools.py", line 2783, in f 
 return action(*a, **b) 
   File "/home/fvillarroel/www/web2py/ applications/administrador/ 
 controllers/clientes.py", line 63, in clientes 
 table=powerTable.create() 
   File "/home/fvillarroel/www/web2py/ applications/administrador/ 
 models/plugin_powertable.py", line 704, in plugin_powertable 
 PowerTable(), 
   File "/home/fvillarroel/www/web2py/ applications/administrador/ 
 models/plugin_powertable.py", line 178, in __init__ 
 headers[c] = sqlrows.db[t][f].label 
   File "/home/fvillarroel/www/web2py/ gluon/dal.py", line 7136, in 
 __getitem__ 
 return self.__getattr__(str(key)) 
   File "/home/fvillarroel/www/web2py/ gluon/dal.py", line 7143, in 
 __getattr__ 
 return ogetattr(self, key) 
 AttributeError: 'DAL' object has no attribute 'virtual' 


 Any idea. 


  -- 
  
  
  



-- 





[web2py] Re: Question on using legacy tables

2012-07-25 Thread tomt
More good news. I discovered that this fix now allows me to use 
SQLFORM.grid on legacy tables that don't have an 'id' field!

On Wednesday, July 25, 2012 9:10:38 PM UTC-6, tomt wrote:
>
> I tried the latest trunk, and it solves the problem I described.  This is 
> great and it will make it much easier for me to interact with my legacy 
> tables.
> I also have to thank you for the amazingly fast fix!!!
> Thanks a lot - Tom
>
> On Wednesday, July 25, 2012 8:14:14 PM UTC-6, Massimo Di Pierro wrote:
>>
>> There is a solution in trunk. Please give it a try.
>>
>> On Wednesday, 25 July 2012 20:36:07 UTC-5, tomt wrote:
>>>
>>> Hi,
>>> I was using a version of trunk.  I downloaded today's version and got 
>>> the same error.  I opened a ticket as suggested. (Issue 908)
>>>
>>> On Wednesday, July 25, 2012 7:38:47 AM UTC-6, Massimo Di Pierro wrote:
>>>>
>>>> Please open a ticket. This can be fixed if not fixed already. Using 
>>>> trunk or stable?
>>>>
>>>> On Tuesday, 24 July 2012 23:28:29 UTC-5, tomt wrote:
>>>>>
>>>>> I use several legacy tables in my web2py applications
>>>>> A typical definition that I use is:
>>>>> db2.define_table('analogpoint',
>>>>>  Field('pointnumber','integer',writable=False),
>>>>>  Field('pointname','string',writable=False),
>>>>>  primarykey=['pointnumber'],
>>>>>  migrate=False
>>>>> )
>>>>>
>>>>> I can access this table with DAL:
>>>>> info = db2(db2.analogpoint.pointnumber == point) \
>>>>>   .select(db2.analogpoint.pointnumber,db2.analogpoint.pointname)
>>>>>
>>>>> but the following method generates an error:
>>>>> temp = db2.analogpoint[1].pointname
>>>>> KeyError: '_id'
>>>>>
>>>>> Is there a way to use this method on a table that doesn't have an 'id' 
>>>>> field
>>>>>
>>>>> I have had success when I generate a view that includes an 'id' field
>>>>> for every legacy table, but I would like to avoid this if possible.
>>>>>
>>>>> - Tom
>>>>>
>>>>

-- 





[web2py] Re: Question on using legacy tables

2012-07-25 Thread tomt
I tried the latest trunk, and it solves the problem I described.  This is 
great and it will make it much easier for me to interact with my legacy 
tables.
I also have to thank you for the amazingly fast fix!!!
Thanks a lot - Tom

On Wednesday, July 25, 2012 8:14:14 PM UTC-6, Massimo Di Pierro wrote:
>
> There is a solution in trunk. Please give it a try.
>
> On Wednesday, 25 July 2012 20:36:07 UTC-5, tomt wrote:
>>
>> Hi,
>> I was using a version of trunk.  I downloaded today's version and got the 
>> same error.  I opened a ticket as suggested. (Issue 908)
>>
>> On Wednesday, July 25, 2012 7:38:47 AM UTC-6, Massimo Di Pierro wrote:
>>>
>>> Please open a ticket. This can be fixed if not fixed already. Using 
>>> trunk or stable?
>>>
>>> On Tuesday, 24 July 2012 23:28:29 UTC-5, tomt wrote:
>>>>
>>>> I use several legacy tables in my web2py applications
>>>> A typical definition that I use is:
>>>> db2.define_table('analogpoint',
>>>>  Field('pointnumber','integer',writable=False),
>>>>  Field('pointname','string',writable=False),
>>>>  primarykey=['pointnumber'],
>>>>  migrate=False
>>>> )
>>>>
>>>> I can access this table with DAL:
>>>> info = db2(db2.analogpoint.pointnumber == point) \
>>>>   .select(db2.analogpoint.pointnumber,db2.analogpoint.pointname)
>>>>
>>>> but the following method generates an error:
>>>> temp = db2.analogpoint[1].pointname
>>>> KeyError: '_id'
>>>>
>>>> Is there a way to use this method on a table that doesn't have an 'id' 
>>>> field
>>>>
>>>> I have had success when I generate a view that includes an 'id' field
>>>> for every legacy table, but I would like to avoid this if possible.
>>>>
>>>> - Tom
>>>>
>>>

-- 





[web2py] Re: Question on using legacy tables

2012-07-25 Thread tomt
Hi,
I was using a version of trunk.  I downloaded today's version and got the 
same error.  I opened a ticket as suggested. (Issue 908)

On Wednesday, July 25, 2012 7:38:47 AM UTC-6, Massimo Di Pierro wrote:
>
> Please open a ticket. This can be fixed if not fixed already. Using trunk 
> or stable?
>
> On Tuesday, 24 July 2012 23:28:29 UTC-5, tomt wrote:
>>
>> I use several legacy tables in my web2py applications
>> A typical definition that I use is:
>> db2.define_table('analogpoint',
>>  Field('pointnumber','integer',writable=False),
>>  Field('pointname','string',writable=False),
>>  primarykey=['pointnumber'],
>>  migrate=False
>> )
>>
>> I can access this table with DAL:
>> info = db2(db2.analogpoint.pointnumber == point) \
>>   .select(db2.analogpoint.pointnumber,db2.analogpoint.pointname)
>>
>> but the following method generates an error:
>> temp = db2.analogpoint[1].pointname
>> KeyError: '_id'
>>
>> Is there a way to use this method on a table that doesn't have an 'id' 
>> field
>>
>> I have had success when I generate a view that includes an 'id' field
>> for every legacy table, but I would like to avoid this if possible.
>>
>> - Tom
>>
>

-- 





[web2py] Question on using legacy tables

2012-07-24 Thread tomt
I use several legacy tables in my web2py applications
A typical definition that I use is:
db2.define_table('analogpoint',
 Field('pointnumber','integer',writable=False),
 Field('pointname','string',writable=False),
 primarykey=['pointnumber'],
 migrate=False
)

I can access this table with DAL:
info = db2(db2.analogpoint.pointnumber == point) \
  .select(db2.analogpoint.pointnumber,db2.analogpoint.pointname)

but the following method generates an error:
temp = db2.analogpoint[1].pointname
KeyError: '_id'

Is there a way to use this method on a table that doesn't have an 'id' field

I have had success when I generate a view that includes an 'id' field
for every legacy table, but I would like to avoid this if possible.

- Tom

-- 





[web2py] Re: confused with install on centos 5.7

2012-05-24 Thread tomt
I installed web2py with mod_wsgi on centos 5.2.
I haven't used it extensively, but I did get it to work 
for a couple of my web2py applications.

Instead of running the install script, I manually implemented
most of the steps from the setup-web2py-fedora.sh script.
I have selinux disabled in this configuration.
The following is a record of what I did...
No guarantees...



You will probably need the following packages.
httpd.i386  
mod_ssl.i386
wget.i386   
httpd-devel.i386
sqlite-devel.i386   
zlib-devel.i386 

The python on most servers is 2.5, so I will rebuild it for 2.7
===
/usr/local/Python-2.7.2
./configure --prefix=/usr/local --with-threads --enable-shared 
--with-zlib=/usr/include
make && make install

Rebuild mod_wsgi to use the new python:
===
/usr/local/tar# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
cd /usr/local/mod_wsgi-3.3
./configure --with-python=/usr/local/bin/python
make && make install

Install web2py somewhere. It must be owned by the apache process.
=
mkdir -p /opt/web-apps
chmod 755 /opt
chmod 755 /opt/web-apps
cd /opt/web-apps
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R apache:apache web2py


Setup SSL
=
mkdir -p /etc/httpd/ssl
openssl genrsa 1024 > /etc/httpd/ssl/self_signed.key
openssl req -new -x509 -nodes -sha1 -days 365 -key 
/etc/httpd/ssl/self_signed.yum list httpd mod_ssl mod_wsgi wget python 
httpd-devel sqlite-devel zlib-devel
key > /etc/httpd/ssl/self_signed.cert
(supply appropriate responses)

openssl x509 -noout -fingerprint -text < /etc/httpd/ssl/self_signed.cert > 
/etc/httpd/ssl/self_signed.info

Setup web2py admin password
===
cd /opt/web-apps/web2py

sudo -u apache python -c "from gluon.main import save_password; 
save_password(raw_input('admin password: '),443)"


Configure Apache

/etc/httpd/conf.d
... wsgi.conf ..
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix run/wsgi


- mod_python interferes with mod_wsgi.
- hide or remove mod_python.conf from /etc/httpd/conf.d
 




I followed various instructions I found in the web2py group
to build web2py.conf.
There are simpler configurations, but I needed web2py to 
coexist with other pre-existing httpd applications.

This configuration serves two named web2py apps: app1 and app2

--- /etc/httpd/conf.d/web2py.conf --
NameVirtualHost *:80
NameVirtualHost *:443


  ServerName MyServer
  RewriteEngine on 
  RewriteRule ^/app1(.*)$ /w2p/app1$1 [PT,L] 
  RewriteRule ^/app2(.*)$ /w2p/app2$1 [PT,L] 
# RewriteLog "/var/log/httpd/rewrite_log"
# RewriteLogLevel 9
  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py user=apache group=apache 
home=/opt/web-apps/web2py
  WSGIProcessGroup web2py

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) 
/opt/web-apps/web2py/applications/$1/static/$2

  
Options -Indexes
Order Allow,Deny
Allow from all
  

  
Deny from all
  

  
Deny from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log



  ServerName MyServer
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  RewriteEngine on 
  RewriteRule ^/admin(.*)$ /w2p/admin$1 [PT,L] 
  RewriteRule ^/examples(.*)$ /w2p/examples$1 [PT,L] 

# RewriteLog "/var/log/httpd/rewrite_log"
# RewriteLogLevel 9

  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py2 user=apache group=apache 
home=/opt/web-apps/web2py
  WSGIProcessGroup web2py2

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) 
/opt/web-apps/web2py/applications/$1/static/$2

  
Options -Indexes
ExpiresActive On
ExpiresDefault "access plus 1 hour"
Order Allow,Deny
Allow from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log










[web2py] Re: confused with install on centos 5.7

2012-05-24 Thread tomt
I installed web2py with mod_wsgi on centos 5.2.
I haven't used it extensively, but I did get it to work 
for a couple of my web2py applications.

Instead of running the install script, I manually implemented
most of the steps from the setup-web2py-fedora.sh script.
The following is a record of what I did...
No guarantees...



You will probably need the following packages.
httpd.i386  
mod_ssl.i386
wget.i386   
httpd-devel.i386
sqlite-devel.i386   
zlib-devel.i386 

The python on most servers is 2.5, so I will rebuild it for 2.7
===
/usr/local/Python-2.7.2
./configure --prefix=/usr/local --with-threads --enable-shared 
--with-zlib=/usr/include
make && make install

Rebuild mod_wsgi to use the new python:
===
/usr/local/tar# wget http://modwsgi.googlecode.com/files/mod_wsgi-3.3.tar.gz
cd /usr/local/mod_wsgi-3.3
./configure --with-python=/usr/local/bin/python
make && make install

Install web2py somewhere. It must be owned by the apache process.
=
mkdir -p /opt/web-apps
chmod 755 /opt
chmod 755 /opt/web-apps
cd /opt/web-apps
wget http://web2py.com/examples/static/web2py_src.zip
unzip web2py_src.zip
chown -R apache:apache web2py


Setup SSL
=
mkdir -p /etc/httpd/ssl
openssl genrsa 1024 > /etc/httpd/ssl/self_signed.key
openssl req -new -x509 -nodes -sha1 -days 365 -key 
/etc/httpd/ssl/self_signed.yum list httpd mod_ssl mod_wsgi wget python 
httpd-devel sqlite-devel zlib-devel
key > /etc/httpd/ssl/self_signed.cert
(supply appropriate responses)

openssl x509 -noout -fingerprint -text < /etc/httpd/ssl/self_signed.cert > 
/etc/httpd/ssl/self_signed.info

Setup web2py admin password
===
cd /opt/web-apps/web2py

sudo -u apache python -c "from gluon.main import save_password; 
save_password(raw_input('admin password: '),443)"


Configure Apache

/etc/httpd/conf.d
... wsgi.conf ..
LoadModule wsgi_module modules/mod_wsgi.so
WSGISocketPrefix run/wsgi


- mod_python interferes with mod_wsgi.
- hide or remove mod_python.conf from /etc/httpd/conf.d
 




I followed various instructions I found in the web2py group
to build web2py.conf.
There are simpler configurations, but I needed web2py to 
coexist with other pre-existing httpd applications.

This configuration serves two named web2py apps: app1 and app2

--- /etc/httpd/conf.d/web2py.conf --
NameVirtualHost *:80
NameVirtualHost *:443


  ServerName MyServer
  RewriteEngine on 
  RewriteRule ^/app1(.*)$ /w2p/app1$1 [PT,L] 
  RewriteRule ^/app2(.*)$ /w2p/app2$1 [PT,L] 
# RewriteLog "/var/log/httpd/rewrite_log"
# RewriteLogLevel 9
  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py user=apache group=apache 
home=/opt/web-apps/web2py
  WSGIProcessGroup web2py

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) 
/opt/web-apps/web2py/applications/$1/static/$2

  
Options -Indexes
Order Allow,Deny
Allow from all
  

  
Deny from all
  

  
Deny from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log



  ServerName MyServer
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  RewriteEngine on 
  RewriteRule ^/admin(.*)$ /w2p/admin$1 [PT,L] 
  RewriteRule ^/examples(.*)$ /w2p/examples$1 [PT,L] 


# RewriteLog "/var/log/httpd/rewrite_log"
# RewriteLogLevel 9

  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py2 user=apache group=apache 
home=/opt/web-apps/web2py
  WSGIProcessGroup web2py2

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) 
/opt/web-apps/web2py/applications/$1/static/$2

  
Options -Indexes
ExpiresActive On
ExpiresDefault "access plus 1 hour"
Order Allow,Deny
Allow from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log





ps: I disabled selinux.  




[web2py] bootstrap css problem

2012-04-25 Thread tomt
Hi,
I just tried bootstrap.min.css in trunk. I noticed one small problem.  The 
buttons on SQLFORM.grid no longer show up, instead I get links for add, 
edit, and delete.  The html generated for the add is:

Add

My previous code generated the same html, but it displayed a button, not just 
the link.
- Any suggestions?



[web2py] Re: new feature in trunk: full auditing

2012-04-14 Thread tomt
I discovered why the archive table wasn't being created, there is a typo in 
gluon/tools.py at line 1293:
for table in tables: 
if 'modifed_on' in table.fields():
should be
for table in tables: 
if 'modified_on' in table.fields():

Now the the 'mythings_archive' table is created as expected, and changes 
are recorded in it as expected.

I didn't mention it before, but I expect that the builtin audit feature 
will be very useful for my applications.  This feature along with the 
addition of SQLFORM.grid have made web2py enormously more productive.

Thanks to all the developers for all these improvements.
- Tom



On Friday, April 13, 2012 10:53:10 PM UTC-6, tomt wrote:
>
> I'm have been trying to test this new audit function in trunk, but so far 
> the mything_archive table has never been created in any of my tests.
>
> Is this the current state of the implementation, or am I missing something?
>
> I downloaded the latest trunk and used it web2py admin to create a new app.
>
> I then modified db.py according to the instructions in this thread:
> 
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> auth.define_tables(username=True, signature=True)
> ...
> db.define_table("points",
> Field('type','integer'),
> Field('point','integer'),
> Field('pointname','string'),
> auth.signature)
> auth.enable_record_versioning(db)
> 
>
> I've tried this with both mysql and sqlite databases, but no *_archive 
> table...
>
>
> Any comments or suggestions?
>
> thanks, - Tom
>
>
>
> On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>>
>> This is how it works:
>>
>> # define auth 
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>> auth.define_tables(username=True,signature=True)
>>
>> # define your own tables like
>> db.define_table('mything',Field('name'),auth.signature)
>>
>> # than do:
>> auth.enable_record_versioning(db)
>>
>> how does it work? every table, including auth_user will have an 
>> auth.signature including created_by, created_on, modified_by, modified_on, 
>> is_active fields. When a record of table mything (or any other table) is 
>> modified, a copy of the previous record is copied into mything_archive 
>> which references the current record. When a record is deleted, it is not 
>> actually deleted but is_active is set to False, all records with 
>> is_active==False are filtered out in searches except in appadmin.
>>
>> Pros:
>> - your app will get full record archival for auditing purposes
>> - could not be simpler. nothing else to do. Try with 
>> SQLFORM.grid(db.mything) for example.
>> - does not break references and there is no need for uuids
>> - does not slow down searches because archive is done in separate archive 
>> tables
>>
>> Cons:
>> - uses lots of extra memory because every version of a record is stored 
>> (it would be more efficient to store changes only but that would make more 
>> difficult to do auditing).
>> - slows down db(...).update(...) for multi record because it needs to 
>> copy all records needing update from the original table to the archive 
>> table. This requires selecting all the records.
>>
>> Comments? Suggestions?
>>
>>
>>
>>
>>
>>
>>
> On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>>
>> This is how it works:
>>
>> # define auth 
>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>> auth.define_tables(username=True,signature=True)
>>
>> # define your own tables like
>> db.define_table('mything',Field('name'),auth.signature)
>>
>> # than do:
>> auth.enable_record_versioning(db)
>>
>> how does it work? every table, including auth_user will have an 
>> auth.signature including created_by, created_on, modified_by, modified_on, 
>> is_active fields. When a record of table mything (or any other table) is 
>> modified, a copy of the previous record is copied into mything_archive 
>> which references the current record. When a record is deleted, it is not 
>> actually deleted but is_active is set to False, all records with 
>> is_active==False are filtered out in searches except in appadmin.
>>
>> Pros:
>> - your app will get full record archival for auditing purposes
>> - could not be simpler. nothing else to do. Try with 
>> SQLFORM.grid(db.mything) for example.
>> - does not break references and there is no need for uuids
>> - does not slow down searches because archive is done in separate archive 
>> tables
>>
>> Cons:
>> - uses lots of extra memory because every version of a record is stored 
>> (it would be more efficient to store changes only but that would make more 
>> difficult to do auditing).
>> - slows down db(...).update(...) for multi record because it needs to 
>> copy all records needing update from the original table to the archive 
>> table. This requires selecting all the records.
>>
>> Comments? Suggestions?
>>
>>
>>
>>
>>
>>
>>

[web2py] Re: new feature in trunk: full auditing

2012-04-13 Thread tomt
I'm have been trying to test this new audit function in trunk, but so far 
the mything_archive table has never been created in any of my tests.

Is this the current state of the implementation, or am I missing something?

I downloaded the latest trunk and used it web2py admin to create a new app.

I then modified db.py according to the instructions in this thread:

auth = Auth(db, hmac_key=Auth.get_or_create_key())
auth.define_tables(username=True, signature=True)
...
db.define_table("points",
Field('type','integer'),
Field('point','integer'),
Field('pointname','string'),
auth.signature)
auth.enable_record_versioning(db)


I've tried this with both mysql and sqlite databases, but no *_archive 
table...


Any comments or suggestions?

thanks, - Tom



On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>
> This is how it works:
>
> # define auth 
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> auth.define_tables(username=True,signature=True)
>
> # define your own tables like
> db.define_table('mything',Field('name'),auth.signature)
>
> # than do:
> auth.enable_record_versioning(db)
>
> how does it work? every table, including auth_user will have an 
> auth.signature including created_by, created_on, modified_by, modified_on, 
> is_active fields. When a record of table mything (or any other table) is 
> modified, a copy of the previous record is copied into mything_archive 
> which references the current record. When a record is deleted, it is not 
> actually deleted but is_active is set to False, all records with 
> is_active==False are filtered out in searches except in appadmin.
>
> Pros:
> - your app will get full record archival for auditing purposes
> - could not be simpler. nothing else to do. Try with 
> SQLFORM.grid(db.mything) for example.
> - does not break references and there is no need for uuids
> - does not slow down searches because archive is done in separate archive 
> tables
>
> Cons:
> - uses lots of extra memory because every version of a record is stored 
> (it would be more efficient to store changes only but that would make more 
> difficult to do auditing).
> - slows down db(...).update(...) for multi record because it needs to copy 
> all records needing update from the original table to the archive table. 
> This requires selecting all the records.
>
> Comments? Suggestions?
>
>
>
>
>
>
>
On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>
> This is how it works:
>
> # define auth 
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> auth.define_tables(username=True,signature=True)
>
> # define your own tables like
> db.define_table('mything',Field('name'),auth.signature)
>
> # than do:
> auth.enable_record_versioning(db)
>
> how does it work? every table, including auth_user will have an 
> auth.signature including created_by, created_on, modified_by, modified_on, 
> is_active fields. When a record of table mything (or any other table) is 
> modified, a copy of the previous record is copied into mything_archive 
> which references the current record. When a record is deleted, it is not 
> actually deleted but is_active is set to False, all records with 
> is_active==False are filtered out in searches except in appadmin.
>
> Pros:
> - your app will get full record archival for auditing purposes
> - could not be simpler. nothing else to do. Try with 
> SQLFORM.grid(db.mything) for example.
> - does not break references and there is no need for uuids
> - does not slow down searches because archive is done in separate archive 
> tables
>
> Cons:
> - uses lots of extra memory because every version of a record is stored 
> (it would be more efficient to store changes only but that would make more 
> difficult to do auditing).
> - slows down db(...).update(...) for multi record because it needs to copy 
> all records needing update from the original table to the archive table. 
> This requires selecting all the records.
>
> Comments? Suggestions?
>
>
>
>
>
>
>

[web2py] Re: new feature in trunk: full auditing

2012-04-09 Thread tomt
I have declared the table in db.py with auth.signature, and uncommented 
auth.enable_record_versioning(db), but the _archive table isn't created.
 - Tom

On Monday, April 9, 2012 8:33:18 AM UTC-6, Massimo Di Pierro wrote:
>
> the signature=True only adds a signature to the auth_* tables so that if a 
> user creates an account for another user or creates a group, you can keep 
> track of who did it.
>
> The mything_archive table should be created by:
>
> auth.enable_record_versioning(db)
>
> This should be called after the mything table is defined. Does it work?
>
> On Sunday, 8 April 2012 22:08:47 UTC-5, tomt wrote:
>>
>> Hi,
>> Thanks for your response.  I deleted the database as you suggested and 
>> changed signature=False.  The problem did go away and I was able to add 
>> users without the error.  
>> I then reverted to signature=True.  While subsequent modifications did 
>> show the signature, the 'mything_archive' was never created.
>>
>> - Tom
>>
>> On Sunday, April 8, 2012 9:04:14 AM UTC-6, Massimo Di Pierro wrote:
>>>
>>> Can you try again with mysql, delete the database and replace:
>>>
>>> auth.define_tables(signature=True)
>>> with
>>> auth.define_tables(signature=False)
>>>
>>> Does the problem does away? It looks like it does not like the self 
>>> reference in auth_user. 
>>>
>>> On Saturday, 7 April 2012 22:09:31 UTC-5, tomt wrote:
>>>>
>>>> Hi,
>>>>
>>>> I tried using your new versioning feature in trunk.
>>>> I created an app using a mysql database:
>>>> db = DAL('mysql://version:version@localhost/version')
>>>> When I used the admin function to define a new user
>>>> I received the following error:
>>>> 
>>>>  
>>>> (1452, u'Cannot add or update a child row: a foreign key constraint 
>>>> fails 
>>>> (`version/auth_user`, CONSTRAINT `auth_user_ibfk_1` 
>>>> FOREIGN KEY (`created_by`) REFERENCES `auth_user` (`id`) ON DELETE 
>>>> CASCADE)')
>>>> 
>>>>
>>>> I rebuilt the app to use sqlite instead of mysql:
>>>> db = DAL('sqlite://storage.sqlite')
>>>>
>>>> I was then able to add a user without the error
>>>>
>>>> I was using MySQL client version: 5.0.84
>>>>
>>>> - any suggestions?  - Tom
>>>>
>>>> On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>>>>>
>>>>> This is how it works:
>>>>>
>>>>> # define auth 
>>>>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>>>>> auth.define_tables(username=True,signature=True)
>>>>>
>>>>> # define your own tables like
>>>>> db.define_table('mything',Field('name'),auth.signature)
>>>>>
>>>>> # than do:
>>>>> auth.enable_record_versioning(db)
>>>>>
>>>>> how does it work? every table, including auth_user will have an 
>>>>> auth.signature including created_by, created_on, modified_by, 
>>>>> modified_on, 
>>>>> is_active fields. When a record of table mything (or any other table) is 
>>>>> modified, a copy of the previous record is copied into mything_archive 
>>>>> which references the current record. When a record is deleted, it is not 
>>>>> actually deleted but is_active is set to False, all records with 
>>>>> is_active==False are filtered out in searches except in appadmin.
>>>>>
>>>>> Pros:
>>>>> - your app will get full record archival for auditing purposes
>>>>> - could not be simpler. nothing else to do. Try with 
>>>>> SQLFORM.grid(db.mything) for example.
>>>>> - does not break references and there is no need for uuids
>>>>> - does not slow down searches because archive is done in separate 
>>>>> archive tables
>>>>>
>>>>> Cons:
>>>>> - uses lots of extra memory because every version of a record is 
>>>>> stored (it would be more efficient to store changes only but that would 
>>>>> make more difficult to do auditing).
>>>>> - slows down db(...).update(...) for multi record because it needs to 
>>>>> copy all records needing update from the original table to the archive 
>>>>> table. This requires selecting all the records.
>>>>>
>>>>> Comments? Suggestions?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>

[web2py] Re: new feature in trunk: full auditing

2012-04-08 Thread tomt
Hi,
Thanks for your response.  I deleted the database as you suggested and 
changed signature=False.  The problem did go away and I was able to add 
users without the error.  
I then reverted to signature=True.  While subsequent modifications did show 
the signature, the 'mything_archive' was never created.

- Tom

On Sunday, April 8, 2012 9:04:14 AM UTC-6, Massimo Di Pierro wrote:
>
> Can you try again with mysql, delete the database and replace:
>
> auth.define_tables(signature=True)
> with
> auth.define_tables(signature=False)
>
> Does the problem does away? It looks like it does not like the self 
> reference in auth_user. 
>
> On Saturday, 7 April 2012 22:09:31 UTC-5, tomt wrote:
>>
>> Hi,
>>
>> I tried using your new versioning feature in trunk.
>> I created an app using a mysql database:
>> db = DAL('mysql://version:version@localhost/version')
>> When I used the admin function to define a new user
>> I received the following error:
>> 
>>  
>> (1452, u'Cannot add or update a child row: a foreign key constraint fails 
>> (`version/auth_user`, CONSTRAINT `auth_user_ibfk_1` 
>> FOREIGN KEY (`created_by`) REFERENCES `auth_user` (`id`) ON DELETE 
>> CASCADE)')
>> 
>>
>> I rebuilt the app to use sqlite instead of mysql:
>> db = DAL('sqlite://storage.sqlite')
>>
>> I was then able to add a user without the error
>>
>> I was using MySQL client version: 5.0.84
>>
>> - any suggestions?  - Tom
>>
>> On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>>>
>>> This is how it works:
>>>
>>> # define auth 
>>> auth = Auth(db, hmac_key=Auth.get_or_create_key())
>>> auth.define_tables(username=True,signature=True)
>>>
>>> # define your own tables like
>>> db.define_table('mything',Field('name'),auth.signature)
>>>
>>> # than do:
>>> auth.enable_record_versioning(db)
>>>
>>> how does it work? every table, including auth_user will have an 
>>> auth.signature including created_by, created_on, modified_by, modified_on, 
>>> is_active fields. When a record of table mything (or any other table) is 
>>> modified, a copy of the previous record is copied into mything_archive 
>>> which references the current record. When a record is deleted, it is not 
>>> actually deleted but is_active is set to False, all records with 
>>> is_active==False are filtered out in searches except in appadmin.
>>>
>>> Pros:
>>> - your app will get full record archival for auditing purposes
>>> - could not be simpler. nothing else to do. Try with 
>>> SQLFORM.grid(db.mything) for example.
>>> - does not break references and there is no need for uuids
>>> - does not slow down searches because archive is done in separate 
>>> archive tables
>>>
>>> Cons:
>>> - uses lots of extra memory because every version of a record is stored 
>>> (it would be more efficient to store changes only but that would make more 
>>> difficult to do auditing).
>>> - slows down db(...).update(...) for multi record because it needs to 
>>> copy all records needing update from the original table to the archive 
>>> table. This requires selecting all the records.
>>>
>>> Comments? Suggestions?
>>>
>>>
>>>
>>>
>>>
>>>
>>>

[web2py] Re: new feature in trunk: full auditing

2012-04-07 Thread tomt
Hi,

I tried using your new versioning feature in trunk.
I created an app using a mysql database:
db = DAL('mysql://version:version@localhost/version')
When I used the admin function to define a new user
I received the following error:

 
(1452, u'Cannot add or update a child row: a foreign key constraint fails 
(`version/auth_user`, CONSTRAINT `auth_user_ibfk_1` 
FOREIGN KEY (`created_by`) REFERENCES `auth_user` (`id`) ON DELETE 
CASCADE)')


I rebuilt the app to use sqlite instead of mysql:
db = DAL('sqlite://storage.sqlite')

I was then able to add a user without the error

I was using MySQL client version: 5.0.84

- any suggestions?  - Tom

On Thursday, April 5, 2012 4:16:04 PM UTC-6, Massimo Di Pierro wrote:
>
> This is how it works:
>
> # define auth 
> auth = Auth(db, hmac_key=Auth.get_or_create_key())
> auth.define_tables(username=True,signature=True)
>
> # define your own tables like
> db.define_table('mything',Field('name'),auth.signature)
>
> # than do:
> auth.enable_record_versioning(db)
>
> how does it work? every table, including auth_user will have an 
> auth.signature including created_by, created_on, modified_by, modified_on, 
> is_active fields. When a record of table mything (or any other table) is 
> modified, a copy of the previous record is copied into mything_archive 
> which references the current record. When a record is deleted, it is not 
> actually deleted but is_active is set to False, all records with 
> is_active==False are filtered out in searches except in appadmin.
>
> Pros:
> - your app will get full record archival for auditing purposes
> - could not be simpler. nothing else to do. Try with 
> SQLFORM.grid(db.mything) for example.
> - does not break references and there is no need for uuids
> - does not slow down searches because archive is done in separate archive 
> tables
>
> Cons:
> - uses lots of extra memory because every version of a record is stored 
> (it would be more efficient to store changes only but that would make more 
> difficult to do auditing).
> - slows down db(...).update(...) for multi record because it needs to copy 
> all records needing update from the original table to the archive table. 
> This requires selecting all the records.
>
> Comments? Suggestions?
>
>
>
>
>
>
>

[web2py] Re: Smarttable & SQLFORM.grid

2012-03-28 Thread tomt
You may be thinking of 'powertable'.  This plugin presents a grid that 
includes a typeahead search 
function. It can be found at https://bitbucket.org/rochacbruno/powertable.

- Tom

On Monday, March 26, 2012 2:24:42 PM UTC-6, greenpoise wrote:
>
> What I was looking for was a type-ahead function using SQLFORM.smartgrid 
> instead of typing a word and pressing search.
>
>
>
>
>
>
>
>
> On Thursday, 22 March 2012 16:15:23 UTC-7, Alan Etkin wrote:
>>
>> I think you mean SQLFORM.smartgrid. 
>>
>> Book's 7.8 section (the features are explained there): 
>>
>> "... 
>> A SQLFORM.smartgrid looks a lot like a grid, in fact it contains a 
>> grid but it is 
>> designed to take as input not a query but only one table and to browse 
>> said 
>> table and selected referencing tables. 
>> ..." 
>>
>> On Mar 22, 7:16 pm, greenpoise  wrote: 
>> > Are these two equivalents?? I remember using smartables at some point. 
>> What 
>> > I liked about it was the search feature without having to press any 
>> button 
>> > to search for my text within a table. Does SQLFORM.grid provides 
>> something 
>> > similar?? 
>> > 
>> > Thanks 
>> > 
>> > d
>
>

[web2py] Re: TNS error on Oracle

2012-03-06 Thread tomt
I have had success with the following connection string:
db = DAL('oracle://user/password@sid')


I tried out the alternate form you used:
db = DAL('oracle://user/password@server:port/service_name')

And it worked successfully. When I used a bad password or
a bad service_name I saw a similar error to what you reported:

Traceback (most recent call last):
  File "/home/tomt/web2py/gluon/restricted.py", line 194, in
restricted
exec ccode in environment
  File "/home/tomt/web2py/applications/scadadb/models/db.py", line 17,
in 
db = DAL('oracle://user/password@server:port/service_name')
  File "/home/tomt/web2py/gluon/dal.py", line 4156, in __init__
raise RuntimeError, "Failure to connect, tried %d times:\n%s" %
(attempts, error)
RuntimeError: Failure to connect, tried 5 times:
ORA-12514: TNS:listener does not currently know of service requested
in connect descriptor

- Tom


On Mar 6, 10:38 am, Lazarof  wrote:
> Hi!
>
> Are you sure that
>    3.     db = DAL("oracle://ricardo/rica...@10.10.1.84:1521/XE")
> and not
>    3.     db = DAL("oracle://ricardo/password@XE")
>
> On Mar 6, 6:21 pm, Bruno Rocha  wrote:
>
> > Does anybody knows something about this?
>
> > it connects with cx_oracle and raw queries, but gives this error on DAL.
>
> >    1.  Traceback (most recent call last):
> >    2.    File "", line 1, in 
> >    3.     db = DAL("oracle://ricardo/rica...@10.10.1.84:1521/XE")
> >    4.   File "C:\Python27\lib\site-packages\gluon\dal.py", line 5968, in
> >    __init__
> >    5.     raise RuntimeError, "Failure to connect, tried %d times:\n%s" % (
> >    attempts, tb)
> >    6. RuntimeError: Failure to connect, tried 5 times:
> >    7.  Traceback (most recent call last):
> >    8.    File "C:\Python27\lib\site-packages\gluon\dal.py", line 5955, in
> >    __init__
> >    9.     self._adapter = ADAPTERS[self._dbname](*args)
> >    10.   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2185, in
> >    __init__
> >    11.     self.pool_connection(connect)
> >    12.   File "C:\Python27\lib\site-packages\gluon\dal.py", line 465, in
> >     pool_connection
> >    13.     self.connection = f()
> >    14.   File "C:\Python27\lib\site-packages\gluon\dal.py", line 2184, in
> >     connect
> >    15.     return self.driver.connect(uri,**driver_args)
> >    16. DatabaseError: ORA-12514: TNS:listener does not currently know of
> >    service requested in connect descriptor
>
> > --
>
> > Bruno Rocha
> > [http://rochacbruno.com.br]
>
>


[web2py] Re: web2py 1.99.5 is OUT

2012-03-01 Thread tomt
Hi,

I just installed 1.99.5.  Clicking on the database administration
button doesn't bring up the usual database administration form.
Instead it brings up http://127.0.0.1:8000/admin/default/site.  (The
link value for the button is http://127.0.0.1:8000/app1/appadmin/index)

On Mar 1, 5:28 pm, Massimo Di Pierro 
wrote:
> Most of them should be self explanatory from the changelog. Some point you
> to files. Look inside, they usually contain an example.
> A few are not documented in any way so feel free to ask here for
> explanation
>
> ... until they will make it into the book.
>
> Massimo


[web2py] Re: how to deploy web2py not in the apache root (help with url rewriting)

2012-02-08 Thread tomt
Hi,

I have had some success using wsgi on a fedora system by installing
the following config file in /etc/httpd/conf.d . It's basically the
config from the online manual with rewrite rules taken from the user
group.

I have two applications, 'cpa4' and 'master' that are accessed with
http://server2/w2p/cpa4 and http://server/w2p/master.
--
NameVirtualHost *:80
NameVirtualHost *:443


  ServerName server2
  RewriteEngine on
  RewriteLog "/var/log/httpd/rewrite_log"
  RewriteLogLevel 9
  RewriteRule ^/master(.*)$ /w2p/master$1 [PT,L]
  RewriteRule ^/cpa4(.*)$ /w2p/cpa4$1 [PT,L]
  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py user=apache group=apache home=/opt/web-apps/
web2py
  WSGIProcessGroup web2py

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/
$1/static/$2

  
Options -Indexes
Order Allow,Deny
Allow from all
  

  
Deny from all
  

  
Deny from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log



  ServerName server2
  SSLEngine on
  SSLCertificateFile /etc/httpd/ssl/self_signed.cert
  SSLCertificateKeyFile /etc/httpd/ssl/self_signed.key

  RewriteEngine on
  RewriteLog "/var/log/httpd/rewrite_log"
  RewriteLogLevel 9
  RewriteRule ^/admin(.*)$ /w2p/admin$1 [PT,L]
  RewriteRule ^/examples(.*)$ /w2p/examples$1 [PT,L]

  WSGIScriptAlias /w2p /opt/web-apps/web2py/wsgihandler.py
  WSGIDaemonProcess web2py2 user=apache group=apache home=/opt/web-
apps/web2py
  WSGIProcessGroup web2py2

  
AllowOverride None
Order Allow,Deny
Deny from all

  Allow from all

  

  AliasMatch ^/([^/]+)/static/(.*) /opt/web-apps/web2py/applications/
$1/static/$2

  
Options -Indexes
ExpiresActive On
ExpiresDefault "access plus 1 hour"
Order Allow,Deny
Allow from all
  

  CustomLog /var/log/httpd/access_log common
  ErrorLog /var/log/httpd/error_log

--


On Feb 8, 12:52 pm, giovanni allegri  wrote:
> For now I've solved setting the WSGIScriptAlias to /w2p
>
> and in routes.py:
>
> > routes_out = ((r'/(?P.*)', r'/w2p/\g'),)
>
> Any comments are welcome for something cleaner, but I fear that
> "reverse rewriting" for URL() is only possible if set inside
> routes.py. Am I wrong?
>
> giovanni
>
> On 8 Feb, 18:45, giovanni allegri  wrote:
>
> > I've seen a lot of examples to manage url rewriting and proxying with
> > web2py, but I haven't found a solution to my problem.
> > I don't have much experience with mod_rewrite, but I would like to use
> > it and avoid rewriting inside web2py (through its routes facilites).
>
> > My situation is a single domain, where various applications are hosted
> > through Aliases.
> > I have path_to_wsgi/applications/myapp, and I would like to serve it
> > athttp://my.domain.ip/myapp.
> > The domain root points to another service, so I can't install web2py
> > to the root.
> > Is there e ready to use recipe to do it?
>
> > Thanks
> > giovanni
>
>


[web2py] How can I use an alternate(non-root) directory in a production deployment?

2012-01-12 Thread tomt
I followed the manual's instruction for deploying web2py in a
production environment using apache and wsgi, and it works as
advertised. Calling http://domain.com/app1/default/function works just
like it did when I ran the rocket server from the command line.

I really want web2py to run from a subdirectory of the webserver, as I
intend to use an existing webserver that already has other functions.
I made one simple change to the default.conf file:

WSGIScriptAlias /xxx /opt/web-apps/web2py/wsgihandler.py

Calling http://domain.com/xxx/app1/default/function activates the same
web2py function as before, but all of the references on the displayed
page still point to http://domain.com/app1.  This makes sense as the
URL function that generated the reference doesn't know I've moved the
application.

What's the easiest way to get my existing web2py applications to work
under this new path?  I'm guessing that using routes_in and routes_out
in routes.py may do the job, but my attempts at using it have failed.

I'm interested in any advice, and examples would be appreciated.

Thanks in advance, - Tom


[web2py] Re: Access remote oracle database

2011-11-24 Thread tomt
Do you have the oracle client installed on your web2py machine?  If
you do, you should be able to test the connection to oracle with
'sqlplus database/password'.

oracle-instantclient is available for free from 
www.oracle.com/technetwork/index.html.
I'm using this on my linux machine to access a remote oracle server
using web2py. I believe this is also available for windows.  I
installed three rpms, basic, sqlplus, and devel.

If you have the oracle client set up, you might want to test if you
can access oracle directly from python before trying it from web2py.

The cx_Oracle source has some good examples of how to do this.

If all this is already working, then post some of the specific errors
you are having and I'll try to help if I can.

- Tom


On Nov 24, 6:36 pm, Massimo Di Pierro 
wrote:
> Web2py supports oracle. Requires cxoracle and rinning from source.
> What problem do you experience?
>
> On Nov 24, 12:42 pm, Humberto  wrote:
>
> > web2py already comes with native oracle support? I installed pyodbc
> > and cx_oracle, but I still can't connect to my remote oracle database.
>
> > I tested a connection with postgres (I needed to install psycopg2) and
> > it's working fine.
>
> > Ps. My OS is Windows 7 x64.
> > Ps2. I tried running the web2py binary and from the source.
>
>


[web2py] Re: help please on adding jquery-ui theme to SQLFORM.grid

2011-11-14 Thread tomt
Thanks for the responses,

After reading the notes, I dug around and discovered the following
list of themes that can be used in layout.html.

base
black-tie
blitzer
cupertino
dark-hive
dot-luv
eggplant
excite-bike
flick
hot-sneaks
humanity
le-frog
mint-choc
overcast
pepper-grinder
redmond
smoothness
south-street
start
sunny
swanky-purse
trontastic
ui-darkness
ui-lightness
vader

Simply substitute any of these theme names in place of the ''
below.
(This is the line in layout.html referenced in the earlier note)


http://ajax.googleapis.com/ajax/libs/
jqueryui/1.8.16/themes//jquery-ui.css" type="text/css"
media="all" />

(I imagine you already know this, but I thought I'd include the list I
found for other interested users)

- Tom

On Nov 13, 9:15 pm, Anthony  wrote:
> CSS files typically go in your app's /static/css folder, and you then have
> to make sure the CSS file gets linked in the page head (like any other CSS
> file). An easy way to include the CSS file is to do:
>
> response.files.append(URL('static', 'cs/your_theme_file.css'))
>
> in the controller action that needs the jquery-ui theme (or in your
> layout.html file if needed on most/all pages).
>
> Anthony
>
> On Sunday, November 13, 2011 9:45:45 PM UTC-5, tomt wrote:
>
> > Hi,
>
> > I'm looking for an example of how to install and use a jquery theme
> > for SQLFORM.grid
>
> > I see that I can implement jquery-ui by defining:
> > form = SQLFORM.grid(query=db.table.field=='3',ui='jquery-ui')
>
> > I see that I can download a theme fromhttp://jqueryui.com/download
> > but I don't know where to install it, or how to enable it.  I searched
> > the web2py group for examples, but I failed to find any.
>
> > I'd appreciate it if someone could post a working example of this
> > feature.
>
> > Thanks in advance,  - Tom
>
>


[web2py] help please on adding jquery-ui theme to SQLFORM.grid

2011-11-13 Thread tomt
Hi,

I'm looking for an example of how to install and use a jquery theme
for SQLFORM.grid

I see that I can implement jquery-ui by defining:
form = SQLFORM.grid(query=db.table.field=='3',ui='jquery-ui')

I see that I can download a theme from http://jqueryui.com/download
but I don't know where to install it, or how to enable it.  I searched
the web2py group for examples, but I failed to find any.

I'd appreciate it if someone could post a working example of this
feature.

Thanks in advance,  - Tom



[web2py] help on howto redirect user based on their auth_membership

2011-11-10 Thread tomt
Hi,

Is there a way to redirect a user to a specific controller based on
their auth_group.role and/or auth_membership?

I would like a view only user to be redirected to one controller after
login, and a "supervisor" user go to a different controller after
login.

Any suggestions?

Thanks, - Tom


[web2py] Re: Please help me understand how 'lambda row, rc' works

2011-11-06 Thread tomt
Thanks for your response.

Using your suggestion of implementing a controller helped me to see
that
defining the 'content' statement in extracolumns causes SQLTABLE to
pass
the current record and rc(rowcount) to be used by a controller
or function, that can then be used by the A() helper.

- Tom

On Nov 6, 6:42 am, Stefaan Himpe  wrote:
> tomt wrote:
> > I wanted to implement the 'extracolumns' feature of SQLTABLE
> > and the example provided in the source code is:
>
> >      :param extracolums = [{'label':A('Extra',_href='#'),
> >                      'class': '', #class name of the header
> >                      'width':'', #width in pixels or %
> >                      'content':lambda row, rc: A('Edit',_href='edit/
> > %s'%row.id),
> >                      'selected': False #agregate class selected to this
> > column
> >                      }]
>
> > I don't understand this because I didn't define 'row' or 'rc' anywhere
> > in my controller, but the content definition worked anyways.
>
> With lambda you create a function in-place (without giving it a name).
> If you write lambda row, rc : ... you say that you define a function
> expecting two parameters: "row" and "rc"
>
> To understand better, you could just as well write the following
> equivalent code with a normal function (untested):
>
> def show_content(row, rc):
>         return A('Edit', _href='edit/%s'%row.id)
>
> extracolums = [{'label':A('Extra',_href='#'),
>                        'class': '',
>                        'width':'',
>                        'content': show_content,
>                        'selected': False
>                        }]


[web2py] Please help me understand how 'lambda row, rc' works

2011-11-05 Thread tomt
I wanted to implement the 'extracolumns' feature of SQLTABLE
and the example provided in the source code is:

:param extracolums = [{'label':A('Extra',_href='#'),
'class': '', #class name of the header
'width':'', #width in pixels or %
'content':lambda row, rc: A('Edit',_href='edit/
%s'%row.id),
'selected': False #agregate class selected to this
column
}]

I assumed that I would have to substitute the 'row' in the content
definition
statement with the actual array used to build the SQLTABLE, but I was
surprised to find that example worked exactly as written.

I don't understand this because I didn't define 'row' or 'rc' anywhere
in my controller, but the content definition worked anyways.

It seems silly to question something that is working,
but I'd like to understand where 'row' and 'rc' come from
if someone is willing to offer an explanation.

Thanks in advance - Tom


[web2py] Re: table without id

2011-10-11 Thread tomt
Hi,

I have been able to access legacy databases that don't have an id
field.  In the following example 'pointnumber' is the primary key, and
is unique. I was able to read values from this table with DAL.  I used
the following model:


db2.define_table('statuspoint',
 Field('pointnumber','integer'),
 Field('pointname','string'),
 Field('pointaccessarea','integer'),
 Field('station','integer'),
 Field('statefeatures','integer'),
 Field('indication','integer'),
 primarykey=['pointnumber'],
)


Some parts of web2py(such as SQLFORM.grid) appear to require the 'id'.
To allow this, I created a view in my database(mysql) to rename the
pointnumber field to id.

CREATE VIEW view_statuspoint AS
SELECT pointnumber id,pointname,pointaccessarea,
station,statefeatures,indication
from statuspoint;

The following model uses the view:

db2.define_table('view_statuspoint',
 Field('id','integer'),
 Field('pointname','string'),
 Field('pointaccessarea','integer'),
 Field('station','integer'),
 Field('statefeatures','integer'),
 Field('indication','integer'),
 Field('dog_assignment_fko','integer'),
 migrate=False
)

This allowed me to create a form with SQLFORM.grid and to update
records. That's all I've tested.

- Tom

On Oct 11, 9:04 am, Cory Coager  wrote:
> I have created some database tables externally to web2py.  Does web2py
> require an id field for tables?  The reason why I'm asking is, when I
> use the DAL to do an insert, web2py tries to retrieve the currval of
> the insert.  Seeing how I don't have an id, this throws an exception.
> How should I handle this?


[web2py] Question about SQLFORM.grid and legacy tables

2011-09-22 Thread tomt
Hi,

I was wondering if SQLFORM.grid can be used to display legacy tables
that don't contain a field called 'id', and if so, how?

I have this table definition:
db2.define_table('statuspoint',
 Field('pointnumber','integer'),
 Field('pointname','string'),
 Field('station','integer'),
 primarykey=['pointnumber'],
 migrate=False
)

The controller:
def grid():
form = SQLFORM.grid(db2.statuspoint)
return dict(form=form)

when called throws the error:
query = query._id>0
  File "/home/xa21/web2py/gluon/dal.py", line 4916, in __getattr__
return self[key]
  File "/home/xa21/web2py/gluon/dal.py", line 4860, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: '_id'

Thanks in advance, - Tom


[web2py] Re: How to use SQLFORM.grid

2011-09-21 Thread tomt
Hi,

Can SQLFORM.grid be used to display legacy tables, specifically a
table that doesn't have a field named 'id', and if so, how?

The following is an example of a table I'm currently using in the
latest trunk.  Dbadmin displays it successfully, but web2py throws an
exception
when I try to display it with grid.

The table is defined as:

db2.define_table('statuspoint',
 Field('pointnumber','integer'),
 Field('pointname','string'),
 Field('pointaccessarea','integer'),
 Field('station','integer'),
 primarykey=['pointnumber'],
 migrate=False
)

Controller:
def grid():
form = SQLFORM.grid(db2.statuspoint)
return dict(form=form)

Error:
  File "/home/xa21/web2py/gluon/dal.py", line 4522, in __call__
query = query._id>0
  File "/home/xa21/web2py/gluon/dal.py", line 4916, in __getattr__
return self[key]
  File "/home/xa21/web2py/gluon/dal.py", line 4860, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: '_id'

- Thanks in advance, - Tom


[web2py] Re: History tables how?

2011-09-19 Thread tomt
Thanks a lot Massimo,

Both forms work correctly.
I had no idea I could use crud.archive(form) in the stable release
with anything but crud.  I am now using it successfully on several
SQLFORM routines.

On Sep 18, 9:57 pm, Massimo Di Pierro 
wrote:
> ERRATA:
>
> With stable you can do
>
> form=SQLFORM()
> if form.accepts(request,session):
>       crud.archive(form)
>
> With trunk:
>
> form=SQLFORM()
> if form.process(onsuccess=auth.archive).accepted: ...
>
> "onsuccess" not "onaccept"
>
> On Sep 18, 10:46 pm, tomt  wrote:
>
> > Massimo,
>
> > Thanks for the quick update.  I installed trunk... hg 
> > clonehttps://code.google.com/p/web2py/
> > and tried the suggested code
>
> > def editarch2():
> >     id = request.args(0) or 1
> >     row=db.things(id)
> >     form=SQLFORM(db.things,row)
> >     if form.process(onaccept=auth.archive).accepted:
> >         response.flash='ok'
> >     return dict(form=form)
>
> > And received the following error message:
> >   File "/home/xa21/web2py/applications/archtst/controllers/
> > default.py", line 91, in editarch2
> >     if form.process(onaccept=auth.archive).accepted:
> >   File "/home/xa21/web2py/gluon/html.py", line 1947, in process
> >     self.validate(**kwargs)
> >   File "/home/xa21/web2py/gluon/html.py", line 1898, in validate
> >     if self.accepts(**kwargs):
> > TypeError: accepts() got an unexpected keyword argument 'onaccept'
>
> > Any comments? Thanks -Tom
>
> > On Sep 18, 8:14 pm, Massimo Di Pierro 
> > wrote:
>
> > > Correction..
>
> > > With stable you can do
>
> > > form=SQLFORM()
> > > form.accepts(request,session,onaccept=crud.archive)
>
> > > With trunk crud.archive is an alias for auth.archive (new) and
> > > form.process(...) is similar to form.accepts(...) but returns the form
> > > instead of boolean. In other words this (old):
>
> > > form=SQLFORM()
> > > if form.accepts(request,session,onaccept=crud.archive): ...
>
> > > and this (new)
>
> > > form=SQLFORM()
> > > if form.process(onaccept=auth.archive).accepted: ...
>
> > > are equivalent.
>
> > > massimo
>
> > > On Sep 18, 9:11 pm, Massimo Di Pierro 
> > > wrote:
>
> > > > You need trunk
>
> > > > On Sep 18, 8:12 pm, tomt  wrote:
>
> > > > > Hi,
>
> > > > > Could you please elaborate on this a bit?
>
> > > > > Does this capability exist in 1.98.2?  I couldn't find any
> > > > > documentation on it.  Do I have to write some additional code to make
> > > > > this work?  If I implement your example literally:
>
> > > > > form=SQLFORM(db.things,row).process(onaccept=auth.archive)
>
> > > > > The error tells me "AttributeError: 'Auth' object has no attribute
> > > > > 'archive'"
>
> > > > > I'd appreciate some pointers.
>
> > > > > Thanks, - Tom
>
> > > > > On Sep 13, 9:26 pm, Massimo Di Pierro 
> > > > > wrote:
>
> > > > > > I think this calls for a new feature. for today the best I can 
> > > > > > suggest
> > > > > > is
>
> > > > > > form = SQLFORM(...).process(onaccept=auth.archive)
>
> > > > > > (notice auth.archive and crud.archive are the same but you can 
> > > > > > archive
> > > > > > without crud). I hate crud. I want it to die but slowly.
>
> > > > > > On Sep 13, 5:16 pm, Michele Comitini 
> > > > > > wrote:
>
> > > > > > > A question which bothers me a lot lately ;-)
>
> > > > > > > I know that crud has a nice support forhistorytables inside the 
> > > > > > > db,
> > > > > > > but I cannot use crud everywhere.
> > > > > > > It would be nice if DAL had support for this feature(*)
>
> > > > > > > I would like to have web2py take care of the task instead of 
> > > > > > > filling
> > > > > > > the db with triggers and stored procedures.
>
> > > > > > > On PostgreSQL I suppose can use the tablelog machinery, but first 
> > > > > > > I do
> > > > > > > not even know if it still works on pg 9.x and secondly it is not
> > > > > > > portable at all...
>
> > > > > > > Does anyone have suggestions?
>
> > > > > > > thanks
>
> > > > > > > mic
>
> > > > > > > (*)now I expect Massimo showing me how I am ignorant with one of 
> > > > > > > his
> > > > > > > great onliners! ;-)
>
>


[web2py] Re: History tables how?

2011-09-18 Thread tomt
Massimo,

Thanks for the quick update.  I installed trunk... hg clone
https://code.google.com/p/web2py/
and tried the suggested code

def editarch2():
id = request.args(0) or 1
row=db.things(id)
form=SQLFORM(db.things,row)
if form.process(onaccept=auth.archive).accepted:
response.flash='ok'
return dict(form=form)

And received the following error message:
  File "/home/xa21/web2py/applications/archtst/controllers/
default.py", line 91, in editarch2
if form.process(onaccept=auth.archive).accepted:
  File "/home/xa21/web2py/gluon/html.py", line 1947, in process
self.validate(**kwargs)
  File "/home/xa21/web2py/gluon/html.py", line 1898, in validate
if self.accepts(**kwargs):
TypeError: accepts() got an unexpected keyword argument 'onaccept'

Any comments? Thanks -Tom

On Sep 18, 8:14 pm, Massimo Di Pierro 
wrote:
> Correction..
>
> With stable you can do
>
> form=SQLFORM()
> form.accepts(request,session,onaccept=crud.archive)
>
> With trunk crud.archive is an alias for auth.archive (new) and
> form.process(...) is similar to form.accepts(...) but returns the form
> instead of boolean. In other words this (old):
>
> form=SQLFORM()
> if form.accepts(request,session,onaccept=crud.archive): ...
>
> and this (new)
>
> form=SQLFORM()
> if form.process(onaccept=auth.archive).accepted: ...
>
> are equivalent.
>
> massimo
>
> On Sep 18, 9:11 pm, Massimo Di Pierro 
> wrote:
>
> > You need trunk
>
> > On Sep 18, 8:12 pm, tomt  wrote:
>
> > > Hi,
>
> > > Could you please elaborate on this a bit?
>
> > > Does this capability exist in 1.98.2?  I couldn't find any
> > > documentation on it.  Do I have to write some additional code to make
> > > this work?  If I implement your example literally:
>
> > > form=SQLFORM(db.things,row).process(onaccept=auth.archive)
>
> > > The error tells me "AttributeError: 'Auth' object has no attribute
> > > 'archive'"
>
> > > I'd appreciate some pointers.
>
> > > Thanks, - Tom
>
> > > On Sep 13, 9:26 pm, Massimo Di Pierro 
> > > wrote:
>
> > > > I think this calls for a new feature. for today the best I can suggest
> > > > is
>
> > > > form = SQLFORM(...).process(onaccept=auth.archive)
>
> > > > (notice auth.archive and crud.archive are the same but you can archive
> > > > without crud). I hate crud. I want it to die but slowly.
>
> > > > On Sep 13, 5:16 pm, Michele Comitini 
> > > > wrote:
>
> > > > > A question which bothers me a lot lately ;-)
>
> > > > > I know that crud has a nice support for history tables inside the db,
> > > > > but I cannot use crud everywhere.
> > > > > It would be nice if DAL had support for this feature(*)
>
> > > > > I would like to have web2py take care of the task instead of filling
> > > > > the db with triggers and stored procedures.
>
> > > > > On PostgreSQL I suppose can use the tablelog machinery, but first I do
> > > > > not even know if it still works on pg 9.x and secondly it is not
> > > > > portable at all...
>
> > > > > Does anyone have suggestions?
>
> > > > > thanks
>
> > > > > mic
>
> > > > > (*)now I expect Massimo showing me how I am ignorant with one of his
> > > > > great onliners! ;-)
>
>


[web2py] Re: History tables how?

2011-09-18 Thread tomt
Hi,

Could you please elaborate on this a bit?

Does this capability exist in 1.98.2?  I couldn't find any
documentation on it.  Do I have to write some additional code to make
this work?  If I implement your example literally:

form=SQLFORM(db.things,row).process(onaccept=auth.archive)

The error tells me "AttributeError: 'Auth' object has no attribute
'archive'"

I'd appreciate some pointers.

Thanks, - Tom

On Sep 13, 9:26 pm, Massimo Di Pierro 
wrote:
> I think this calls for a new feature. for today the best I can suggest
> is
>
> form = SQLFORM(...).process(onaccept=auth.archive)
>
> (notice auth.archive and crud.archive are the same but you can archive
> without crud). I hate crud. I want it to die but slowly.
>
> On Sep 13, 5:16 pm, Michele Comitini 
> wrote:
>
> > A question which bothers me a lot lately ;-)
>
> > I know that crud has a nice support for history tables inside the db,
> > but I cannot use crud everywhere.
> > It would be nice if DAL had support for this feature(*)
>
> > I would like to have web2py take care of the task instead of filling
> > the db with triggers and stored procedures.
>
> > On PostgreSQL I suppose can use the tablelog machinery, but first I do
> > not even know if it still works on pg 9.x and secondly it is not
> > portable at all...
>
> > Does anyone have suggestions?
>
> > thanks
>
> > mic
>
> > (*)now I expect Massimo showing me how I am ignorant with one of his
> > great onliners! ;-)
>
>


[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-09-17 Thread tomt
Hi,

I have a question about using powertable.

When I try to build a powertable on the following select:
tasks=db(db.task.cpaid==3).select(db.task.cpa,db.task.description,db.task.ls_js)
I get the following error:
  File "/home/xa21/workspace/web2py/applications/cpa4/models/
plugin_powertable.py", line 219, in __init__
_id = record.id
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 3786, in
__getattr__
return self[key]
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 3777, in
__getitem__
return dict.__getitem__(self, key)
KeyError: 'id'

I suspect this means that powertable requires a field named 'id'. Is
this true, or is there a way I can get around this?
(The table I'm interested in displaying is a legacy table that doesn't
contain an .id field)

- Tom



[web2py] Re: New Plugin: plugin_ckeditor

2011-09-13 Thread tomt
I found out that I had caused my own problem.  This plugin now works
as expected on IE7, IE8 and firefox.  (I had modified the toolbar to
add a few items and remove the scayt_autostartup. I left a comma after
the toolbar's closing bracket ],  Firefox was ok with this, but IE
wasnt')

- Tom
On Sep 3, 10:12 pm, tomt  wrote:
> Hi,
>
> Doesplugin_ckeditorwork with internet explorer? It works great with
> firefox, but I have problems using it with IE.
>
> When I call up the application with IE8 like 
> this:http://server:8000/application/default/editthis
>   The text area doesn't load the ckeditor
>   Surprisingly, when I call it like 
> this:http://192.168.1.1:8000/application/default/editthis
>  ckeditor initalizes on the text field and works as desired.
>
> Maybe this is a problem with the configuration on my network, but I'd
> be interested to know if other users have problems with IE andplugin_ckeditor.
>
>  - Tom


[web2py] Re: Published my collection of plugins

2011-09-04 Thread tomt
Thanks for you quick response. Your suggestion worked as desired.

On Sep 4, 3:04 am, kenji4569  wrote:
> >I was wondering if solidtables has a formatting option that will
> > display a text field without escaping the html tags?
>
> You can do this by using the "represent" feature of Field, as in
> SQLTABLE:
> db.status_info.description.represent = lambda v: XML(v)
>
> On 9月4日, 午後12:38, tomt  wrote:
>
> > Kenji,
>
> > Thanks for contributing your great plugins.  I've started to use
> > solidtable and solidform and I expect that I will use them a lot
> > because they really improve the look and usability of the web2py apps
> > I've been working on.
>
> > I was wondering if solidtables has a formatting option that will
> > display a text field without escaping the html tags?
>
> > I'm currently doing this by building tables in a view and using:
> > {{=XML(row.status_info.description)}}
>
> > The following is an example of the html I want to display: Follow
> > procedure in station > u> notes
>
> > This works ok, but I just thought that if solidtable already has the
> > ability to do this, I'd try it instead.
>
> > Thanks - Tom
>
>


[web2py] Re: New Plugin: plugin_ckeditor

2011-09-03 Thread tomt
Hi,

Does plugin_ckeditor work with internet explorer? It works great with
firefox, but I have problems using it with IE.

When I call up the application with IE8 like this:
http://server:8000/application/default/editthis
  The text area doesn't load the ckeditor
  Surprisingly, when I call it like this:
http://192.168.1.1:8000/application/default/editthis
 ckeditor initalizes on the text field and works as desired.

Maybe this is a problem with the configuration on my network, but I'd
be interested to know if other users have problems with IE and
plugin_ckeditor.

 - Tom


[web2py] Re: Published my collection of plugins

2011-09-03 Thread tomt
Kenji,

Thanks for contributing your great plugins.  I've started to use
solidtable and solidform and I expect that I will use them a lot
because they really improve the look and usability of the web2py apps
I've been working on.

I was wondering if solidtables has a formatting option that will
display a text field without escaping the html tags?

I'm currently doing this by building tables in a view and using:
{{=XML(row.status_info.description)}}

The following is an example of the html I want to display: Follow
procedure in station notes

This works ok, but I just thought that if solidtable already has the
ability to do this, I'd try it instead.

Thanks - Tom


[web2py] Re: Published my collection of plugins

2011-08-30 Thread tomt
Hi,

I tried your update, and I can now successfully modify text color and
background color with IE7 and IE8. Unfortunately I still see the same
problem with 'Format', 'Font size' and 'Font' dropdown selections.
That is,
the dropdown selection is erased before I can select an option.

- Tom

On Aug 30, 4:05 am, kenji4569  wrote:
> Hi, Tom.
>
> Thank you for reporting the bug.
> I just fixed it.
> Please check:http://dev.s-cubism.com/plugin_elrte_widget
> (you might need to clear the browser cache)
>
> [modification detail]
> I upgraded theelrteversion from 1.2 to 1.3.
> Additionally, since the version 1.3 had a serious IE problem, I
> applied some patches for it.
> I also slightly modified the plugin css not to conflict with the site
> css.
> (https://github.com/kenji4569/sqlabs/issues/39)
>
> Kenji
>
> On 8月30日, 午前11:38, tomt  wrote:
>
>
>
> > Hi,
>
> > Thanks for the great contributions to web2py.  I'm looking forward to
> > trying them.
>
> > I implemented web2py.plugin.elrte_widget.w2p and while it worked great
> > with firefox, I had some problems using internet explorer.
> > Specifically, the dropdown boxes, such as the colorpicker, disappear
> > before I can make a selection.
>
> > This happened with IE7 and IE8.  I used the same IE browser to go to
> > thehttp://elrte.org/demoandthe problem didn't exist there. Does
> > anyone else see this problem?
>
> > - Tom- Hide quoted text -
>
> - Show quoted text -


[web2py] Re: Published my collection of plugins

2011-08-29 Thread tomt
Hi,

Thanks for the great contributions to web2py.  I'm looking forward to
trying them.

I implemented web2py.plugin.elrte_widget.w2p and while it worked great
with firefox, I had some problems using internet explorer.
Specifically, the dropdown boxes, such as the colorpicker, disappear
before I can make a selection.

This happened with IE7 and IE8.  I used the same IE browser to go to
the http://elrte.org/demo and the problem didn't exist there. Does
anyone else see this problem?

- Tom


[web2py] Re: New Plugin: plugin_ckeditor

2011-08-26 Thread tomt
FYI:  I ran into a problem using plugin_ckeditor when running web2py
on python 2.5.2.  It generates an error associated with modules/
plugin_ckeditor.py at line 44:

43  *self.settings.extra_fields.get(upload_name, []),
44  migrate = migrate,

When I upgraded python to 2.7.2 everything worked as designed with no
errors.

Just thought others might want to know. - Tom


[web2py] Problem with Oracle access and web2py database administration

2011-08-23 Thread tomt
I recently tried to access some legacy tables in an Oracle database
with web2py. The connection string and model I generated in db.py
allows successful connection and queries from the command line are
successful, when I try to use the web2py database administration
function I get the following error:

Invalid Query ORA-00907: missing right parenthesis

The connection string is:
db = DAL('oracle://username:password@database')

And a typical table in the model looks like this:
db.define_table('tablename',
 Field('column1','integer'),
 Field('column2','string'),
 Field('column3','integer'),
 Field('column4','integer'),
 primarykey=['column1'],
 migrate=False
)
(The first column is unique but it is NOT autoincrementing)

I don't expect to be able to edit these tables with the dbadmin tool,
but I thought I would be able to view the rows. (I have had success
with legacy tables in mysql)

Perhaps there is something unusual about my Oracle tables, but I'm not
sure where to start debugging this problem.  Any suggestions?

Thanks, -Tom


[web2py] Re: New Plugin: plugin_ckeditor

2011-08-05 Thread tomt
Hi,

I was having trouble editing existing data with web2py_ckeditor until
I applied Bruno's patch.

Before applying this patch, the plugin could save new data, but it
wouldn't edit existing data.  It always started with an empty
textarea.  Now it works as I would expect. (I'm using web2py Version
1.98.2 (2011-08-04 00:47:09 and Python 2.7.2)

Thanks for the great plugin Ross, and thanks to Bruno for the patch.

I looking forward to using this plugin a lot.

On Aug 3, 2:36 am, Bruno Rocha  wrote:
> I found an issue, as issues is disabled in your bitbucket, I created a wiki
> page.
>
> https://bitbucket.org/PhreeStyle/web2py_ckeditor/wiki/issue


[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-07-24 Thread tomt
Hello,

I tried a clean install of  web2py.app.PowerGrid.w2p and it didn't fix
any problems.

I upgraded my python from 2.5.2 to 2.7.2, and web2py no longer throws
an error on
line 446 in modules/plugin_PowerGrid/PowerGrid.py"
> with open(path ,"r") as f:

Web2py still complains about 'by' in db.py
db.define_table('comments',Field('by'),Field('comment','text'))
'by' is listed as a reserved word in mysql and sqlite, so I assume
that's the problem.

Anyways, with these changes everything is working fine now.

Thanks - Tom

On Jul 23, 10:02 pm, tomt  wrote:
> Bruno,
>
> Thanks for the feedback.  I was digging around and found that if I
> changed:
>   - to
>
> >db.define_table('comments',Field('byuser'),Field('comment','text'))
>
> That error went away. My version of web2py (Version 1.97.1) seems to
> be treating 'by' as a reserved word.
>
> After I changed this, the database tables where created successfully.
>
> My next step was to call up the default controller and web2py
> generated an error and complained about the syntax in the following:
>
> File "applications/pgrid2/modules/plugin_PowerGrid/PowerGrid.py", line
> 446
>     with open(path ,"r") as f:
>
> As a test, I simply deleted this line and the following 'pass' and
> powergrid started working.  I'm not suggesting that this is a
> resolution to my problem, but I just thought that I'd let you know.  I
> have already tried commenting out the auth.requires_membership line
> and a fresh new app with no success, but I'll try it out again with a
> clean install and let you know how it worked.
>
> Thanks again for the feedback, - Tom
>
> On Jul 23, 9:38 pm, Bruno Rocha  wrote:
>
> > On Sat, Jul 23, 2011 at 2:34 AM, tomt  wrote:
> > > DatabaseError: malformed database schema (comments) - near "by":
>
> > Hi Tom, I just tested it and works normally with latest web2py from download
> > link, I am using Ubuntu 11.04 and Python 2.7.
>
> > It seens to be a problem in auth.requires_membership, try to removeor
> > comment this line from default.py and see if it works.
>
> > Another thing is trying to run the plugin in a fresh new app, just follow
> > the template code used in the example app.
>
> > I am writing the documentation to be online by the end of this week.
>
> > Thanks..
>
>


[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-07-23 Thread tomt
Bruno,

Thanks for the feedback.  I was digging around and found that if I
changed:
db.define_table('comments',Field('byuser'),Field('comment','text'))

That error went away. My version of web2py (Version 1.97.1) seems to
be treating 'by' as a reserved word.

After I changed this, the database tables where created successfully.

My next step was to call up the default controller and web2py
generated an error and complained about the syntax in the following:

File "applications/pgrid2/modules/plugin_PowerGrid/PowerGrid.py", line
446
with open(path ,"r") as f:

As a test, I simply deleted this line and the following 'pass' and
powergrid started working.  I'm not suggesting that this is a
resolution to my problem, but I just thought that I'd let you know.  I
have already tried commenting out the auth.requires_membership line
and a fresh new app with no success, but I'll try it out again with a
clean install and let you know how it worked.

Thanks again for the feedback, - Tom


On Jul 23, 9:38 pm, Bruno Rocha  wrote:
> On Sat, Jul 23, 2011 at 2:34 AM, tomt  wrote:
> > DatabaseError: malformed database schema (comments) - near "by":
>
> Hi Tom, I just tested it and works normally with latest web2py from download
> link, I am using Ubuntu 11.04 and Python 2.7.
>
> It seens to be a problem in auth.requires_membership, try to removeor
> comment this line from default.py and see if it works.
>
> Another thing is trying to run the plugin in a fresh new app, just follow
> the template code used in the example app.
>
> I am writing the documentation to be online by the end of this week.
>
> Thanks..


[web2py] Re: The web2py grid/crud plugin you've always dreamed about!

2011-07-22 Thread tomt
Hi,

Your latest plugin looks great and I am eager to learn more about it.

However, I got some errors when I installed web2py.app.PowerGrid.w2p
and tried to run it:

Traceback (most recent call last):
  File "/home/xa21/workspace/web2py/gluon/restricted.py", line 192, in
restricted
exec ccode in environment
  File "/home/xa21/workspace/web2py/applications/pgrid/controllers/
default.py", line 982, in 
  File "/home/xa21/workspace/web2py/gluon/globals.py", line 137, in

self._caller = lambda f: f()
  File "/home/xa21/workspace/web2py/applications/pgrid/controllers/
default.py", line 18, in index
if auth.has_membership('admin'):
  File "/home/xa21/workspace/web2py/gluon/tools.py", line 2627, in
has_membership
group_id = self.id_group(group_id) # interpret group_id as a role
  File "/home/xa21/workspace/web2py/gluon/tools.py", line 2603, in
id_group
rows = self.db(self.settings.table_group.role == role).select()
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 5394, in
select
return self.db._adapter.select(self.query,fields,attributes)
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 1176, in
select
rows = response(sql)
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 1166, in
response
self.execute(sql)
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 1251, in
execute
return self.log_execute(*a, **b)
  File "/home/xa21/workspace/web2py/gluon/dal.py", line 1246, in
log_execute
ret = self.cursor.execute(*a,**b)
DatabaseError: malformed database schema (comments) - near "by":
syntax error

I'm running web2py Version 1.97.1 (2011-06-26 19:25:44) and Python
2.5.2: /usr/bin/python

- Any suggestions?

Thanks, - Tom

On Jul 22, 4:35 pm, Bruno Rocha  wrote:
> Hi,
>
> I present you PowerGrid Plugin (now in beta 0.1) 
> [http://labs.blouweb.com/PowerGrid/]
>
> What is it?
>
> A plugin to show, manage and paginate data
> It works with paginated JSON callbacks, you can use web2py DAL's Query or
> Table, or you can create your own callback returning the desired JSON or
> JSONP
>
> What is has in special?
> - Based on Jquery templates
> - Server side pagination loads records on demand
> - Ajax Caching option
> - Programable in pure Python & web2py
> - You can pass JS callbacks to the event handlers
> - Can show images with Virtual Fields
> - has button system
> - totally integrated with CRUD
> - Easy to integrate with Auth
> - Can be used to manage a site content (a CMS admin page)
> - can be used to create any kind of paginated data view
>
> Changelog:
> - Some issues solved
> - Tested in Windows, Linux, I.E, Opera, Chrome, FF
> - Better default layout
>
> Beta:
> - Needs tests with different datasources
> - Need to be tested on GAE
> - Need to test multiple on the same page
> - Need to test wotking with another UI libs
>
> EXAMPLES:
> images -http://labs.blouweb.com/PowerGrid/default/withimages
> dataGRid -http://labs.blouweb.com/PowerGrid/default/onlydata
> Buttons -http://labs.blouweb.com/PowerGrid/default/buttons
> Scrolling -http://labs.blouweb.com/PowerGrid/default/scroll
> Customization:http://labs.blouweb.com/PowerGrid/default/nocontrol/http://labs.blouweb.com/PowerGrid/default/noadd/http://labs.blouweb.com/PowerGrid/default/nosearch
> Default search 
> system:http://labs.blouweb.com/PowerGrid/default/defaultsearch?what=Ferrari&;...
> SubGrids:http://labs.blouweb.com/PowerGrid/default/gridinpopup
> JavaScript callbacks:http://labs.blouweb.com/PowerGrid/default/jscallbacks
> Custom templates:http://labs.blouweb.com/PowerGrid/default/blog(a blog
> created with it)
>
> DOCUMENTATION:
> Is being writen in home pagehttp://labs.blouweb.com/PowerGrid/default/index(in
> the grid)
> source example app is well commented with options.
>
> IT USES:http://labs.blouweb.com/PowerGrid/default/about
>
> Comments:http://labs.blouweb.com/PowerGrid/default/support
>
> Get it:http://labs.blouweb.com/PowerGrid/default/get
>
> !!! BETA VERSION, SOME THINGS CAN CRASH, THE SERVER IS A BIT SLOW, IT WILL
> BE VERY MORE QUICKLY IN A GOOD SERVER OR GAE !!!
>
> Thanks if you can test and report on BitBucker or omments page.
>
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
> [ Aprenda a programar:http://CursoDePython.com.br]
> [ O seu aliado nos cuidados com os animais:http://AnimalSystem.com.br]
> [ Consultoria em desenvolvimento web:http://www.blouweb.com]


[web2py] Re: Howto prepopulate a sqlform's drop-down field

2011-06-10 Thread tomt
Hello again,

I withdraw my question as I managed to get the obvious working:
form.vars.cpaid = 6   # or whatever id is required

I failed to get this working earlier, so I mistakenly assumed that the
solution was more complex.  I must have made some dumb mistake that
disabled proper operation.

Sorry for the wasted post...

On Jun 10, 8:05 pm, tomt  wrote:
> Hi,
>
> I've written a controller to add a record using sqlform, and I want to
> prepopulate several of the fields.  I've had some success using
> form.var.field = x, but I haven't been able to prepopulate the one
> field that uses a dropdown list.
>
> In the controller I listed below, I have success on the 'description'
> field, but not the 'cpaid' field.
>
> Any suggestions?
>
> Model:
> db.define_table('cpa',
>     Field('cpa','string'),
> ...
>
> db.define_table('task',
>     Field('cpaid'),
>     Field('cpaord'),
>     Field('cpa','string'),
>     Field('description','string'),
> ...
>
> db.task.cpaid.requires = IS_IN_DB(db,'cpa.id','cpa.cpa')
>
> Controller.
> def insert_task_cpa():
>     form = SQLFORM(db.task)
>     form.vars.description = 'Test Description'
>     form.vars.cpaid = IS_IN_DB(db,db.cpa.id, '6')
>     if form.accepts(request.vars,session):
>         response.flash='Task added'
>         redirect(URL('task_list_bycpa', args=cpa_id))
>     return dict(form=form)


[web2py] Howto prepopulate a sqlform's drop-down field

2011-06-10 Thread tomt
Hi,

I've written a controller to add a record using sqlform, and I want to
prepopulate several of the fields.  I've had some success using
form.var.field = x, but I haven't been able to prepopulate the one
field that uses a dropdown list.

In the controller I listed below, I have success on the 'description'
field, but not the 'cpaid' field.

Any suggestions?


Model:
db.define_table('cpa',
Field('cpa','string'),
...

db.define_table('task',
Field('cpaid'),
Field('cpaord'),
Field('cpa','string'),
Field('description','string'),
...

db.task.cpaid.requires = IS_IN_DB(db,'cpa.id','cpa.cpa')


Controller.
def insert_task_cpa():
form = SQLFORM(db.task)
form.vars.description = 'Test Description'
form.vars.cpaid = IS_IN_DB(db,db.cpa.id, '6')
if form.accepts(request.vars,session):
response.flash='Task added'
redirect(URL('task_list_bycpa', args=cpa_id))
return dict(form=form)



[web2py] Re: powertable question about bStateSave

2011-04-12 Thread tomt
Whoops, I made a mistake. Page position is lost when:
table.showkeycolumn = False

but the "solution" is the same... fnDraw(false)

On Apr 12, 8:02 pm, tomt  wrote:
> Hi,
>
> I discovered why pagination is lost.  When table.showkeycolumn = true
> then at line 733
>
> hidekeycolumnjs = "var hidekeycolumn =
> 200;oTable.fnSetColumnVis(0,false);oTable.fnDraw();"
>
> The datatable API says that fnDraw() has the side effect of resetting
> the pagination
>
> If the call is changed to "... oTable.fnDraw(false)" then pagination
> is not lost.
>
> I don't know if this change would have any negative effects, but so
> far it has worked for me.
>
> - Tom
>
> On Apr 7, 7:54 am, Bruno Rocha  wrote:
>
> > I,m Sorry. I am without time to dedicate to powerTable now. I hope to get
> > this project back soon and I will start to fix some issues and implement the
> > TODOs. (any volunteer?)
>
> > The state saving is a Java Script issue and it is explained 
> > here:http://datatables.net/examples/basic_init/state_save.html
>
> > I will take a look in to it.
> > --
> > Bruno Rocha
> > [ About me:http://zerp.ly/rochacbruno]
>
> > On Thu, Apr 7, 2011 at 12:49 AM, tomt  wrote:
> > > Hi,
>
> > > I'm using powertable and set table.dtfeatures['bStateSave'] = True
> > > The search parameters are saved successfully, but the page position
> > > is not being restored. The cookie created by powertable saves
> > > iStart and iEnd but they don't appear to be used.
>
> > > I looked at the plugin_powertable.py code, but it was not easy to
> > > determine how bStateSave was processed.
>
> > > Is it possible to restore page position with powertable?
>
> > > Any hints or suggestions would be appreciated.
>
> > > thx, - Tom
>
>


[web2py] Re: powertable question about bStateSave

2011-04-12 Thread tomt
Hi,

I discovered why pagination is lost.  When table.showkeycolumn = true
then at line 733

hidekeycolumnjs = "var hidekeycolumn =
200;oTable.fnSetColumnVis(0,false);oTable.fnDraw();"

The datatable API says that fnDraw() has the side effect of resetting
the pagination

If the call is changed to "... oTable.fnDraw(false)" then pagination
is not lost.

I don't know if this change would have any negative effects, but so
far it has worked for me.

- Tom






On Apr 7, 7:54 am, Bruno Rocha  wrote:
> I,m Sorry. I am without time to dedicate to powerTable now. I hope to get
> this project back soon and I will start to fix some issues and implement the
> TODOs. (any volunteer?)
>
> The state saving is a Java Script issue and it is explained 
> here:http://datatables.net/examples/basic_init/state_save.html
>
> I will take a look in to it.
> --
> Bruno Rocha
> [ About me:http://zerp.ly/rochacbruno]
>
> On Thu, Apr 7, 2011 at 12:49 AM, tomt  wrote:
> > Hi,
>
> > I'm using powertable and set table.dtfeatures['bStateSave'] = True
> > The search parameters are saved successfully, but the page position
> > is not being restored. The cookie created by powertable saves
> > iStart and iEnd but they don't appear to be used.
>
> > I looked at the plugin_powertable.py code, but it was not easy to
> > determine how bStateSave was processed.
>
> > Is it possible to restore page position with powertable?
>
> > Any hints or suggestions would be appreciated.
>
> > thx, - Tom
>
>


[web2py] powertable question about bStateSave

2011-04-06 Thread tomt
Hi,

I'm using powertable and set table.dtfeatures['bStateSave'] = True
The search parameters are saved successfully, but the page position
is not being restored. The cookie created by powertable saves
iStart and iEnd but they don't appear to be used.

I looked at the plugin_powertable.py code, but it was not easy to
determine how bStateSave was processed.

Is it possible to restore page position with powertable?

Any hints or suggestions would be appreciated.

thx, - Tom


[web2py] powertable question about get_category_name

2011-02-26 Thread tomt
Hi,

I was trying to learn more from the powertable example, specifically
how the represent options in the field definitions work.

db.define_table('products',
 
Field('category',db.category,label=T('CategoryW'),represent=lambda
c:get_category_name(c)),

I deleted the get_category_name function definition to see what would
happen  and I was surprised to see no difference, and no error was
generated. I don't understand this and I was wondering if there was
any explanation?


[web2py] Re: Customize search results table

2011-02-23 Thread tomt
I'm not sure if this will help, but you can display an array of rows
and not the whole table.  Example:

def task_powerlist_bycpa():
id=request.args(0)

tasks=db(db.task.cparef==id).select(db.task.ALL)
table = plugins.powerTable
table.datasource = tasks
table.keycolumn = 'task.id'
table.showkeycolumn = False
table.columns = ['task.title', 'task.ls_js', 'task.sc_js']
table.headers = 'labels'
table.extra = dict(autoresize={})
return dict(table=table.create())

In this case, I display a subset of the task table based on a query.



On Feb 18, 4:27 pm, Ialejandro  wrote:
> Hi everybody!! I have a new doubt, this time I'm trying to customize a
> table generated by a search, this is what I have:
>
> (Model)
>
> db.define_table('category',
>              Field('name','string'),format='%(name)s')
>
> db.define_table('book',
>              Field('name','string),
>              Field('code','string),
>              Field('category_id',db.category,requires= IS_IN_DB(db,
> db.category.id,'%(name)s'))
>
> def index():
>
>     form=SQLFORM(db.books,fields=['category'])
>
>     if FORM.accepts(form,request.vars,keepvalues=True):
>
> books=db(db.book.category==request.vars.project).select(db.category.ALL)
>     else:
>         books=None
>     return dict(form=form,books=books)
>
> So at the /default/index, I show up a dropdown with all the
> categories, so when a user selects one and press submit it will show a
> table with the results. What I need is use that result data to
> populate thepowerTableplugin considering that a user can search with
> many times, and every time the power table, must be refreshed and
> filled with the new result. How can I do that? Is there any easiest
> way?
>
> Thanks!!


[web2py] Re: New Widget and Slice - SELECT_OR_ADD_OPTION

2011-02-20 Thread tomt
I just tried your widget and it's a great idea.
I was wondering if this concept could be expanded to allow a user to
edit a record with a similar popup dialog.  At first glance it seems
that this might be possible, but I don't understand your code well
enough to say for sure.

A second question, I'd like to be able to use your widget on an server
without access to the internet. I suspect that I can download jquery-
ui.js and jquery-ui.css, but I'm not sure where to put them. Any hints
would be appreciated.

Thanks...

On Feb 20, 2:54 pm, Brian M  wrote:
> I've created a widget to augment the IS_IN_DB select widget with the ability
> to add a new option record within a dialog on the same page. Check it out;
> feedback is welcome.
>
> http://web2pyslices.com/main/slices/take_slice/121
>
> ~Brian


[web2py] Re: powertable: howto adjust table width

2011-02-15 Thread tomt
Thanks,

This worked nicely.

On Feb 15, 8:24 am, Bruno Rocha  wrote:
> Now I tested here and works.
>
> -
> {{extend 'layout.html'}}
>
> 
> .tablewrapper{
>  width:400px !important;}
>
> 
> 
> {{=table}}
> 
> --


[web2py] Re: powertable: howto adjust table width

2011-02-14 Thread tomt
Thanks for the response, but I had limited success. I can control the
width of the scroll area, but not the header or trailer. I used the
following options:

table = plugins.powerTable
...
table.dtfeatures['bAutoWidth'] = False
table._width='700'

(I wasn't quite sure what you meant by
plugins.powerTable._width='400' )

I wasn't aware that I could put css in the view and the following
attempt failed:

--
{{extend 'layout.html'}}
.powerTable{
 width:400px !important;
}
{{=table}}
--

Any pointers?


On Feb 13, 10:50 pm, Bruno Rocha  wrote:
> If you dont like to use CSS you can set it directly to the table.
>
> plugins.powerTable._width='400'


[web2py] powertable: howto adjust table width

2011-02-13 Thread tomt
Hello,

I would like to be able to change the width of the powertable output.
It seems to be set at a fixed value.  I was able to influence the
column width by setting
.dtfeatures['bAutoWidth'] = False but the header and trailer remain
the same width.  Is this controlled by an option?  Is it set in the
css?   Any suggestions?

Thanks in advance. - Tom


[web2py] Re: Question about powertable error

2011-02-13 Thread tomt
I got the same error when I tried ['task.title'] so I looked a little
closer at my controller and realized the problem started when I set
table.keycolumn = 'tasks.id'

Changing it to 'task.id' fixed the problem. Now table.columns=
['task.title']  works.

Thanks for the quick response.

On Feb 13, 3:57 pm, Bruno Rocha  wrote:
> 2011/2/13 tomt 
>
> >  table.columns = ['tasks.title']
>
> Try with:
>
>   table.columns = ['task.title']
>
> where 'task' is the name of the table, 'title' the name of the field.


[web2py] Question about powertable error

2011-02-13 Thread tomt
Hi,

I am using powertable to display a subset of a table's rows:
...
id=request.args(0)
tasks=db(db.task.cparef==id).select(db.task.ALL)
table = plugins.powerTable
table.datasource = tasks
...

This works just fine, but when I try to specify the columns
table.columns = ['tasks.title']

I receive the following error:   'something wrong in Rows object'

Any suggestions?


[web2py] Re: testing ldap communication?

2011-02-12 Thread tomt
When I tried to get ldap_auth working I used wireshark to look at the
protocol exchange.
I was able to see that I had the ou set incorrectly and when corrected
the authentication worked perfectly.

... some changes I made to db.py .
from gluon.contrib.login_methods.ldap_auth import ldap_auth
...
auth.define_tables(username=True)
...
auth.settings.login_methods.append(ldap_auth(mode='ad',
server='machine.domaincontroller.com',
base_dn='ou=users,dc=domaincontroller,dc=com'))
..


On Feb 11, 7:30 pm, Panupat  wrote:
> I'm really stuck here, would greatly appreciate any help.
>
> Is there a way to check or test if the DAL is communicating with the
> ldap "ad" host? It seems like no matter what settings I used to the
> server and base_dn, even ones that are obviously wrong, I am only
> getting the same "invalid login" error.
>
> I read in some older discussion that I should use
>
> auth.settings.login_methods = [ldap_auth(mode='ad', .
>
> instead of
>
> auth.settings.login_methods.append(ldap_auth(mode='ad', .
>
> Does this still apply to the current version? I'm trying them both
> without luck so far.


[web2py] Can I share web2py authorization db across multiple apps

2011-01-25 Thread tomt
Hi,

I have been building several small web2py apps and I was hoping that
there was a way of sharing the authorization information among these
apps.  Currently each app I create has it's own set of auth_ tables
requiring users to register for each app.  It would be a great time-
saver if these apps could share the same set of auth_ tables.  Is this
possible?  All of the apps I refer to are driven from one python
instance (python web2py.py &)

- Tom


[web2py] looking for advice on validation

2011-01-16 Thread tomt
Hi,

I have learned to use SQLFORM to generate forms.  The validation
defined in the db model works as expected, but there are times when I
want to write a controller that uses a different validation than what
is defined in the model.  (Specifically, I want to force a different
date validation)

>From what I've read in the manual, and in web2py-users, I can  define
the form manually using FORM and specify the validation on each field,
but I was hoping there was a way I could do this with SQLFORM.

I'd appreciate any recommendations and/or examples.

Thanks, - Tom


[web2py] Re: Powertable remarks

2011-01-01 Thread tomt
Hello,

In-line editing is listed as a feature of powertable.  Would it be
possible for you to include a working example of this in your demo?

Thanks, - Tom

On Dec 29 2010, 9:49 pm, Bruno Rocha  wrote:
> Here is a complete list of working powerTable 
> options:https://bitbucket.org/rochacbruno/powertable/src/e80ed190dea5/control...


[web2py] Re: Powertable remarks

2010-12-29 Thread tomt
Hi,

The 'full_numbers' option worked exactly as I had hoped.  Next, I
downloaded the code from bitbucket, and tried the column search
function and I'm happy to say it works very well.

Thanks, - Tom

On Dec 29, 5:50 am, rochacbruno  wrote:
> Hi,
>
> Thank you for testing, it is more updated in bitbucket. Now it has search by 
> column and a test version of server side processing.
>
> If you want to change the pager do:
>
> plugins.powerTable.dtfeatures['sPaginationType'] = 'full_numbers'
>
> Here is a demo:http://powertable.blouweb.com/products?pager=full_numbers
>
> Bruno.
>
> Em 29/12/2010, às 02:49, tomt  escreveu:
>
> > Hi Bruno,
>
> > I've just tried using your powertables plugin and I love it. The
> > general appearance is great and the default search function is exactly
> > what I was looking for.  I'm looking forward to trying out the
> > features you've planned.
>
> > One small concern I have is the example I implemented allows me to
> > page to 'next' and 'previous' but there is not a link for 'first' or
> > 'last' page.  It would be great if this was possible.
>
> > Keep up the good work.  - Tom
>
> > On Dec 18, 3:38 pm, Bruno Rocha  wrote:
> >>>  jqGrid also supports progressive loading (without paging , it
> >>> does ajax to load while scrolling down).
>
> >>> I do not see those features exist in datatables.
>
> >> Just got progressive loading working onpowerTableplugin
>
> >>powerTable.dtfeatures['bScrollInfinite'] = True
> >>powerTable.dtfeatures['iScrollLoadGap'] = 10 #number of rows to load by time
>
> >> I am still working hard to make server side load to work well.
>
> >> (I am having a good time with datatables library, the community in
> >> datatables.net forum is very helpful)
>
> >> Will update the plugin soon.
>
> >> --
>
> >> Bruno Rochahttp://about.me/rochacbruno/bio
>
>


[web2py] Re: Powertable remarks

2010-12-28 Thread tomt
Hi Bruno,

I've just tried using your powertables plugin and I love it. The
general appearance is great and the default search function is exactly
what I was looking for.  I'm looking forward to trying out the
features you've planned.

One small concern I have is the example I implemented allows me to
page to 'next' and 'previous' but there is not a link for 'first' or
'last' page.  It would be great if this was possible.

Keep up the good work.  - Tom


On Dec 18, 3:38 pm, Bruno Rocha  wrote:
> >  jqGrid also supports progressive loading (without paging , it
> > does ajax to load while scrolling down).
>
> > I do not see those features exist in datatables.
>
> Just got progressive loading working on powerTable plugin
>
> powerTable.dtfeatures['bScrollInfinite'] = True
> powerTable.dtfeatures['iScrollLoadGap'] = 10 #number of rows to load by time
>
> I am still working hard to make server side load to work well.
>
> (I am having a good time with datatables library, the community in
> datatables.net forum is very helpful)
>
> Will update the plugin soon.
>
> --
>
> Bruno Rochahttp://about.me/rochacbruno/bio


[web2py] Re: web2py 1.90.1 is OUT

2010-12-18 Thread tomt
Updating to 1.90.2 fixed all the mysql problems I listed and all my
apps are working again.

Thanks alot - Tom



On Dec 18, 7:13 pm, tomt  wrote:
> I upgraded to Version 1.90.1 and all of my applications that use mysql
> stopped working. The traceback shows:
>
> Traceback (most recent call last):
>   File "/home/xa21/workspace/webpy4/gluon/restricted.py", line 188, in
> restricted
>     exec ccode in environment
>   File "/home/xa21/workspace/webpy4/applications/myimages/models/
> db.py", line 15, in 
>     db = DAL('mysql://myimages:myima...@localhost/myimages')       #
> if not, use SQLite or other DB
>   File "/home/xa21/workspace/webpy4/gluon/dal.py", line 3237, in
> __init__
>     raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
> error
> RuntimeError: Failure to connect, tried 5 times:
> No module named ssl
>
> - startup shows:
> Version 1.90.1 (2010-12-18 19:40:48)
> Database drivers available: pysqlite2, pymysql
> - earlier version showed:
> Version 1.89.5 (2010-11-21 22:12:54)
> Database drivers available: pysqlite2, MySQL
>
> Do I need to install a new module to correct this problem or can I
> correct this with a modification to my database connection string?
>
> - Tom
>
> On Dec 18, 1:38 pm, mdipierro  wrote:
>
> > This is a major - major release mostly because it includes the new
> > DAL.
>
> > It is supposed to be 100% backward compatible but cleaner, and more
> > readable. We have fixed every known issue.  If 1.90.1 breaks you DAL
> > queries, please report it asap so that it can be addressed sooner.
>
> > It also includes a lot of new features as described below.
>
> > Changelog 1.90.1:
>
> > - new DAL (complete rewrite of the web2py DAL is more modular)
> > - rewrite has fail safe reload, thanks Jonathan
> > - better CAS with v2 support, thanks Olivier ROCH VILATO
> > - better markmin2latex
> > - session.connect(separate=True) to handle many session files, 
> > thanksVersion 1.89.5 supports pysqlite2, MySQL
> > huaiyu wang
> > - changed bahvior of impersonate (more secure, can generate form or
> > used as API)
> > - new rocket, thanks Tim
> > - new pyfpdf
> > - no more old style classes (we did some cleanup in the past sbut we
> > had missed a few).
> > - experimental couchdb support in new dal (only insert, select, update
> > by id)
> > - mysql support out of the box via pymysql
> > - SQLITABLE(...,headers='labels') thanks Bruno
> > - optional: digitally signed URLs, thanks Brian Meredyk
> > - minor bug fixes
>
>


[web2py] Re: web2py 1.90.1 is OUT

2010-12-18 Thread tomt
I upgraded to Version 1.90.1 and all of my applications that use mysql
stopped working. The traceback shows:

Traceback (most recent call last):
  File "/home/xa21/workspace/webpy4/gluon/restricted.py", line 188, in
restricted
exec ccode in environment
  File "/home/xa21/workspace/webpy4/applications/myimages/models/
db.py", line 15, in 
db = DAL('mysql://myimages:myima...@localhost/myimages')   #
if not, use SQLite or other DB
  File "/home/xa21/workspace/webpy4/gluon/dal.py", line 3237, in
__init__
raise RuntimeError, "Failure to connect, tried 5 times:\n%s" %
error
RuntimeError: Failure to connect, tried 5 times:
No module named ssl

- startup shows:
Version 1.90.1 (2010-12-18 19:40:48)
Database drivers available: pysqlite2, pymysql
- earlier version showed:
Version 1.89.5 (2010-11-21 22:12:54)
Database drivers available: pysqlite2, MySQL

Do I need to install a new module to correct this problem or can I
correct this with a modification to my database connection string?

- Tom




On Dec 18, 1:38 pm, mdipierro  wrote:
> This is a major - major release mostly because it includes the new
> DAL.
>
> It is supposed to be 100% backward compatible but cleaner, and more
> readable. We have fixed every known issue.  If 1.90.1 breaks you DAL
> queries, please report it asap so that it can be addressed sooner.
>
> It also includes a lot of new features as described below.
>
> Changelog 1.90.1:
>
> - new DAL (complete rewrite of the web2py DAL is more modular)
> - rewrite has fail safe reload, thanks Jonathan
> - better CAS with v2 support, thanks Olivier ROCH VILATO
> - better markmin2latex
> - session.connect(separate=True) to handle many session files, thanksVersion 
> 1.89.5 supports pysqlite2, MySQL

> huaiyu wang
> - changed bahvior of impersonate (more secure, can generate form or
> used as API)
> - new rocket, thanks Tim
> - new pyfpdf
> - no more old style classes (we did some cleanup in the past sbut we
> had missed a few).
> - experimental couchdb support in new dal (only insert, select, update
> by id)
> - mysql support out of the box via pymysql
> - SQLITABLE(...,headers='labels') thanks Bruno
> - optional: digitally signed URLs, thanks Brian Meredyk
> - minor bug fixes


[web2py] Re: Newbie question:add new record as a copy of an existing row in SQLFORM

2010-12-06 Thread tomt
Thanks for the example and the reference.   - Tom

On Dec 6, 5:58 pm, villas  wrote:
> Hi tomt
>
> I believe it takes the fields from the specified source table and
> lines them up with a target table.  Any fields which don't match and
> the id are discarded.
>
> What Denes means is that it wouldn't work when for example you use
> form.vars from multiple tables which have some identical field names.
> In that case, when it filters through the form.vars it doesn't know
> which field comes from which table.
>
> Hope that's right :)
>
> -D
>
> On Dec 5, 10:07 pm, tomt  wrote:
>
> > Hi,
>
> > I'm unfamiliar with _filter_fields. I couldn't find it in the manual
> > but eventually found it in the source in gluon/tools.py.
> > Am I correct in assuming it is intended to return everything but the
> > id field from a record? (I've just started to learn python)
>
> > Is there some documentation available for this? I've tried some of the
> > urls in the help and resources post:
> >  http://web2py.com/examples/default/dal
> >  http://web2py.com/examples/default/api
> >  http://web2py.com/examples/default/tools
>
> > But I just get "invalid function"
>
> > Thanks in advance,
> >   - Tom
>
> > On Dec 5, 7:00 am, villas  wrote:
>
> > > Hi Nathan
>
> > > Just a small point, I tried your code example and it seems you have to
> > > set id==None otherwise it tries to add a duplicate row with the same
> > > id.
>
> > > Anyway, I thought you also might like this alternative using
> > > _filter_fields, just because it's shorter. Maybe it's got other
> > > issues,  but it seems to work!
>
> > > def things():
> > >     form = SQLFORM(db.things)
> > >     if form.accepts(request.vars,session):
> > >         response.flash = 'Added a thing'
> > >     if request.vars.dupe:
>
> > > db.things.insert(**db.things._filter_fields(db.things(request.vars.dupe)))
> > >     things = db(db.things.id>0).select()
> > >     return dict(form=form,things=things)
>
> > > Best regards,
> > > -D
>
> > > On Dec 4, 3:30 am, "mr.freeze"  wrote:
>
> > > > Here is an example:
>
> > > > Model
> > > > -
> > > > db.define_table('things',Field('name',requires=IS_NOT_EMPTY()),
> > > >                 Field('age','integer'),Field('weight','double'))
> > > > db.things.id.represent = lambda v: A(v,_href=URL(vars=dict(dupe=v)),
> > > >                                      _onclick='return confirm("Copy
> > > > %s?")' % v)
>
> > > > Controller
> > > > --
> > > > def index():
> > > >     form = SQLFORM(db.things)
> > > >     if form.accepts(request.vars,session):
> > > >         response.flash = 'Added a thing'
> > > >     if request.vars.dupe:
> > > >         record = db.things(request.vars.dupe)
> > > >         vals = {}
> > > >         for k,v in record.items():
> > > >             if k in db.things.fields:
> > > >                 vals[k] = v
> > > >         db.things.insert(**vals)
> > > >     things = db(db.things.id>0).select()
> > > >     return dict(form=form,things=things)
>
> > > > On Dec 3, 6:12 pm, tomt  wrote:
>
> > > > > Hi,
>
> > > > > I've started to write a simple application to learn web2py. I am using
> > > > > SQLFORM to insert, modify and delete records. So far everything is
> > > > > working as planned.
>
> > > > > I would like to give the user the ability add a new record as a copy
> > > > > of an existing one.  The idea is that the user would view an existing
> > > > > record, modify a couple fields, and select 'copy' which result in
> > > > > adding a new record.
>
> > > > > I assume that this requires additional code, and I was hoping that
> > > > > someone would suggest an example, or let me know if SQLFORM can do
> > > > > this automatically.
>
> > > > > Thanks in advance,
>
> > > > > - Tom
>
>


  1   2   >