[web2py] response.stream

2012-10-18 Thread weheh
Is it possible to do a response.stream in the middle of an ajax callback?

I want to give users a button, which if pressed, will tar up all their 
files and initiate a download. Something like this:

TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % URL(c='mycontroller', 
f='mydownload'))

Then later, in mycontroller.py, 

def mydownload():
... create tarfile ...
return response.stream(tarfile, attachment=True)

I tried it, but (perhaps obviously to some) it doesn't work. So, how to get 
the mydownload() action to cause the browser to download the tarfile?

-- 





[web2py] Re: pythondiary

2012-10-18 Thread rif
I guess two out of the three cons would be eliminated by web2admin. 

Please take some time to review it and give it some visibility.

joi, 18 octombrie 2012, 00:58:24 UTC+3, Massimo Di Pierro a scris:

 http://www.pythondiary.com/reviews/web2pyV2.0.html


-- 





[web2py] fake_migrate help

2012-10-18 Thread lyn2py
Hello all, something went wrong with the database table files, and they 
were accidentally completely removed (the whole database folder).

I need to rebuild all the database files, so I did:
db = DAL('postgres://',fake_migrate_all=True,migrate_enabled=False)

According to the manual, this is supposed to rebuild the database table 
files, but I still don't see the database folder appearing in the app's 
folder.

May I know what I should do to fix migrations?

Thank you!

-- 





[web2py] Plugin_wiki, auth.wiki clarification and routing.

2012-10-18 Thread HittingSmoke
This is a sort of two part question, the second part being conditional on 
the answer to the first.

1. Is plugin_wiki deprecated for auth.wiki or am I misinterpreting what's 
going on? I can find some documentation on plugin_wiki but most current 
discussion seems to be on doing the same things with auth.wiki which I can 
find zero documentation on, only discussion. If so, where can I find more 
information on auth.wiki?

2. If plugin_wiki is not obsolete, I'm having an issue with domain routing 
on an app with plugin_wiki installed.

If I have domain routing set up to route blog.domain.com to my blog app, 
plugin_wiki will not work at all. If I try to load plugin_wiki with domain 
routing enabled by going to domain.com/welcome/plugin_wiki/index or any 
variant on that with any other app, I get an invalid controller error 
saying that domain.com/welcome/default/plugin_wiki/index is an invalid 
controller function. If I disable domain routing it otherwise loads the 
page.

-- 





[web2py] Re: Query with postgres

2012-10-18 Thread Paolo
Hi Massimo, 
thanks for the suggestions, at this point I have to understand what to do:
- use your last proposal but in this case the date is no longer a data 
object but three different columns, and this will lead to a more difficult 
logic
- put a date field in the table definition, this may simplify all the 
things, isn't it?
I will check it later this week-end.
Thanks
Paolo

On Wednesday, October 17, 2012 7:25:59 PM UTC+2, Massimo Di Pierro wrote:

 It should work with python 2.7 but not previous version. You can also do:

 s=db.club.created_on.year() | db.club.created_on.month() | 
 db.club.created_on.day() 
 dates = 
 db(query).select(db.club.created_on.year(),db.club.created_on.month(),db.club.created_on.day()
  ,
   count,orderby=~s, limitby=limitby, groupby=s)


 On Wednesday, 17 October 2012 11:54:29 UTC-5, Paolo wrote:

 Hi Massimo, thanks for the suggested query but unfortunately I got this 
 error:

 Traceback (most recent call last):
   File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 208, in 
 restricted
 ccode = compile2(code,layer)
   File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 193, in 
 compile2
 return compile(code.rstrip().replace('\r\n','\n')+'\n', layer, 'exec')
   File /home/paolo/Dropbox/git/web2py/applications/bikend/models/clubDB.py 
 http://127.0.0.1:8000/admin/default/edit/bikend/models/clubDB.py, line 29
 dates = db(query).select(*s,count,orderby=~join(s), limitby=limitby, 
 groupby=join(s))
 SyntaxError: only named arguments may follow *expression

 If that can help, I've tried without the wildcard but it failed, web2py 
 was blocked and python took 100% of the cpu.

 Paolo

 On Wednesday, October 17, 2012 2:35:23 PM UTC+2, Massimo Di Pierro wrote:


 s=db.club.created_on.year(),db.club.created_on.month(),db.club.created_on.day()
  
 def join(s): return reduce(lambda a,b:a|b,s)
 dates = db(query).select(*s,count,orderby=~join(s), limitby=limitby, 
 groupby=join(s))

 On Wednesday, 17 October 2012 01:31:55 UTC-5, Paolo wrote:

 Hi Cliff,
 I got the reasons of postgres, but I don't know how to fix it. The 
 query is actually very simple, I have several post, I want to group them 
 by 
 s, and get the number of post for each s. Where s is:
 s=db.club.created_on.year() | db.club.created_on.month() | 
 db.club.created_on.day() 
 In the select I may created_on and use s instead, something like that:
 dates = db(query).select(s,count,orderby=~s, limitby=limitby, groupby=s)

 but doing that I got this error:
 2012-10-17 08:27:59,210 - web2py - ERROR - Traceback (most recent call 
 last):
   File /home/paolo/Dropbox/git/web2py/gluon/restricted.py, line 209, 
 in restricted
 exec ccode in environment
   File 
 /home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py, 
 line 140, in module
   File /home/paolo/Dropbox/git/web2py/gluon/globals.py, line 184, in 
 lambda
 self._caller = lambda f: f()
   File 
 /home/paolo/Dropbox/git/web2py/applications/bikend/controllers/club.py, 
 line 3, in index
 d= dict(clubs = get_clubs())
   File 
 /home/paolo/Dropbox/git/web2py/applications/bikend/models/clubDB.py, 
 line 
 25, in get_clubs
 dates = db(query).select(s,count,orderby=~s, limitby=limitby, 
 groupby=s)
   File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 8787, in 
 select
 return adapter.select(self.query,fields,attributes)
   File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 2127, in 
 select
 return super(SQLiteAdapter, self).select(query, fields, attributes)
   File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1615, in 
 select
 return self._select_aux(sql,fields,attributes)
   File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1596, in 
 _select_aux
 return processor(rows,fields,self._colnames,cacheable=cacheable)
   File /home/paolo/Dropbox/git/web2py/gluon/dal.py, line 1974, in 
 parse
 fields[j].type,blob_decode)
 IndexError: list index out of range

 Paolo

 On Wednesday, October 17, 2012 4:45:35 AM UTC+2, Cliff Kachinske wrote:

 I don't know how it possibly worked in sqlite, but this is an 
 aggregate query combined with a non-aggregate query.

 In other words, the count is a property of an aggregation of rows in 
 the database, whereas created_on is a property of individual rows.

 This confuses Postgres.  It doesn't know if you want the aggregate 
 result (count) or the result for individual rows (created_on).  It cannot 
 deliver both from the same query.

 What are you trying to find out in your query?



 On Tuesday, October 16, 2012 4:59:36 PM UTC-4, Paolo wrote:

 Dear all, 
 I've just switched from sqlite to postgres, and now I have problems 
 with few queries.
 One query that works correctly on sqlite and fails on postgres is the 
 following:
 s=db.club.created_on.year() | db.club.created_on.month() | 
 db.club.created_on.day() 
 count = db.club.id.count()
 dates = 
 

Re: [web2py] Re: tags and speed

2012-10-18 Thread andrej burja
hi

system: it is on linode 512, os ubuntu, server apache, database postgresql
my initial design was using list:string, but than i saw example in the book 
(Application-Development-Cookbook) and i thought this is better
purpose of that code: user testing reveals, that the best way to search the 
data is with Datatables (+individual column filtering). i have 1000 games 
with different attributes: name, for what age, how big the group can be, 
equipment, tags, instructions. I have to put all the attributes in table.
 .. and there is another problem: tags and equipment have both the same 
implementation - so actualy i do 2000 selects :( 

andrej

On Thursday, October 18, 2012 4:09:59 AM UTC+2, rochacbruno wrote:

 I am using list:string for tags and it is working very well for my needs. 

-- 





[web2py] Re: response.stream

2012-10-18 Thread Leonel Câmara
I don't get it. Why do you need ajax for a download? Why not a simple link? 
If you want you can make it look like a button too.

Quinta-feira, 18 de Outubro de 2012 7:09:09 UTC+1, weheh escreveu:

 Is it possible to do a response.stream in the middle of an ajax callback?

 I want to give users a button, which if pressed, will tar up all their 
 files and initiate a download. Something like this:

 TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % 
 URL(c='mycontroller', f='mydownload'))

 Then later, in mycontroller.py, 

 def mydownload():
 ... create tarfile ...
 return response.stream(tarfile, attachment=True)

 I tried it, but (perhaps obviously to some) it doesn't work. So, how to 
 get the mydownload() action to cause the browser to download the tarfile?


-- 





[web2py] Re: pythondiary

2012-10-18 Thread lyn2py
As far as I am using web2py, I personally don't find the admin interface 
cons accurate. I use it daily and I personally think it's working fine for 
my needs. If a develop a software for others to use, I definitely will not 
make the admin interface available to them. Instead, I will write specific 
controllers for whoever-is-the-admin to access specific tables. 
SQLFORM.grid is after all, extremely convenient for this.

The reviewer's perspectives of what web2py admin interface is and what it 
can do is geared toward another angle. This angle is how most of what other 
popular frameworks' admin interface deliver. But web2py does what it does 
well, and the admin interface is sufficient for its purpose.

Thanks for sharing the review.

On Thursday, October 18, 2012 5:58:24 AM UTC+8, Massimo Di Pierro wrote:

 http://www.pythondiary.com/reviews/web2pyV2.0.html


-- 





[web2py] Re: response.stream

2012-10-18 Thread Niphlod
the first thing is: when you navigate to mycontroller/mydownload (no ajax) 
can you get the file downloaded ?
second thing missing from your code: if you want the content downloaded as 
an attachment, set the content-disposition header to attachment; 
filename=afilename.tar

On Thursday, October 18, 2012 8:09:09 AM UTC+2, weheh wrote:

 Is it possible to do a response.stream in the middle of an ajax callback?

 I want to give users a button, which if pressed, will tar up all their 
 files and initiate a download. Something like this:

 TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % 
 URL(c='mycontroller', f='mydownload'))

 Then later, in mycontroller.py, 

 def mydownload():
 ... create tarfile ...
 return response.stream(tarfile, attachment=True)

 I tried it, but (perhaps obviously to some) it doesn't work. So, how to 
 get the mydownload() action to cause the browser to download the tarfile?


-- 





[web2py] calling a library of files in a form

2012-10-18 Thread praveen krishna
I have two forms in two different functions which has a list of strings I 
want to want to query all the files in one form against other in another 
function what is the possible approach .For a single file I tried by 
using form = form_factory(Field('q', label='Query 
primer',requires=IS_NOT_EMPTY())) how to extend it for multiple files?

-- 





[web2py] IS_NOT_IN_DB() and update SQLFORM.factory

2012-10-18 Thread Annet
I defined the following table:

is_not_in_db=IS_NOT_IN_DB(db,'hub.name',error_message='name already in 
database')

db.define_table('hub',
Field(...),

Field('name',default='',IS_NOT_EMPTY(),is_not_in_db],notnull=True,unique=True),
...
migrate=False)


... and the following function:

def update():
form=SQLFORM.factory(db.hub,...)
 # prepopulate the form
if form.process(keepvalues=False).accepted:
...
is_not_in_db.set_self_id(hub.id)
hub.update_record(**db.hub._filter_fields(form.vars))
..
elif form.errors:
response.flash=response_flash('formerror',session)
elif not response.flash:
response.flash='...'
return dict(form=form)

Despite the is_not_in_db validator and is_not_in_db.set_self_id(hub.id) I 
get an error on field name  name already in database. This used the work, 
is this no longer supported? What's the correct way to get this to work.

Kind regards,

Annet

-- 





[web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread Hassan Alnatour
Dear Massimo , 

Is the Session and login issues are fixed ?

regards, 

On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro wrote:

 As far as I know it works but I will say experimental until more 
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro wrote:

 The book is now kind of in between versions it is correct but some 
 of the new features are not described and some example use old API while 
 there is a better way. I plan to finish update it and release the 5th 
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint: 
 can the book title be more descriptive of the related version of 
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro 
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N option 
 and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic, thanks 
 Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin and 
 Niphlod
 - better custom_import (works per app and is faster), thanks Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks 
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=True)
 - DAL, Row, and Rows object can now be pickled/unpickled, thanks to 
 zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with dropbox_account.py
 - many fixes to cache.ram, cache.disk, memcache and gae_memcache
 - cache.with_prefix(cache.ram,'prefix')
 - db.table.field.epoch() counts seconds from epoch
 - DAL support for SQL CASE, example: 
 db().select(...query.case('true','false))
 - DAL(...,do_connect=False) allows faking connections
 - DAL(...,auto_import=True) now retieves some fiel attributes
 - mail can specify a sender: mail.send(...,sender='Mr X 
 %(sender)s')
 - renamed gluon/contrib/comet_messaging.py - 
 gluon/contrib/websocket_messaging.py

 Please check it and report any problem.
 As usual, thanks to the many people who have contributed, in 
 particular Michele and Niphlod.

 Massimo



-- 





Re: [web2py] Re: pythondiary

2012-10-18 Thread Bruno Rocha
+1 web2admin is awesome! if we include query support it will be perfect to
replace appadmin
 Em 18/10/2012 03:23, rif feric...@gmail.com escreveu:

 I guess two out of the three cons would be eliminated by web2admin.

 Please take some time to review it and give it some visibility.

 joi, 18 octombrie 2012, 00:58:24 UTC+3, Massimo Di Pierro a scris:

 http://www.pythondiary.com/**reviews/web2pyV2.0.htmlhttp://www.pythondiary.com/reviews/web2pyV2.0.html

  --





-- 





Re: [web2py] Re: pythondiary

2012-10-18 Thread rif
One query support coming up!

joi, 18 octombrie 2012, 14:47:11 UTC+3, rochacbruno a scris:

 +1 web2admin is awesome! if we include query support it will be perfect to 
 replace appadmin
  Em 18/10/2012 03:23, rif feri...@gmail.com javascript: escreveu:

 I guess two out of the three cons would be eliminated by web2admin. 

 Please take some time to review it and give it some visibility.

 joi, 18 octombrie 2012, 00:58:24 UTC+3, Massimo Di Pierro a scris:

 http://www.pythondiary.com/**reviews/web2pyV2.0.htmlhttp://www.pythondiary.com/reviews/web2pyV2.0.html

  -- 
  
  
  



-- 





[web2py] Re: Looking for a tutor

2012-10-18 Thread apps in tables
I recommend Rocha Bruno.

https://plus.google.com/116110204708544946953/posts


On Thursday, October 18, 2012 2:40:53 AM UTC+3, mikech wrote:

 I would be interested in hooking up with someone for some tutoring online 
 for pay of course.  Anyone interested?  I'm in California so a similiar 
 time zone would be best.

 Mike


-- 





[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread Massimo Di Pierro
Can i get the complete traceback?

On Wednesday, 17 October 2012 22:59:43 UTC-5, Donatas Burba wrote:

 I have noticed another issue. With version 2.1.1 I can't use appy.pod 
 anymore. It means I can generate only one pdf file, every other try gives 
 me error (that I'm using python which can't access uno). I think that 
 problem is in custom_import.py, so I was forced to return back to 2.0.9, 
 where appy.pod works perfectly.

-- 





[web2py] Re: fake_migrate help

2012-10-18 Thread Massimo Di Pierro
You mean you do not see the .table files?

Try:
fake_migrate_all=True,migrate_enabled=True
could be an error in the book.

On Thursday, 18 October 2012 01:29:42 UTC-5, lyn2py wrote:

 Hello all, something went wrong with the database table files, and they 
 were accidentally completely removed (the whole database folder).

 I need to rebuild all the database files, so I did:
 db = DAL('postgres://',fake_migrate_all=True,migrate_enabled=False
 )

 According to the manual, this is supposed to rebuild the database table 
 files, but I still don't see the database folder appearing in the app's 
 folder.

 May I know what I should do to fix migrations?

 Thank you!


-- 





Re: [web2py] Re: tags and speed

2012-10-18 Thread Massimo Di Pierro
I understand you want to select all possible tags. I suggest you create a 
table that stores all posible tags and when a new tag is created you insert 
a new record there. You can get all possible tags with a single select from 
this table. You can also cache that select.


On Thursday, 18 October 2012 02:56:17 UTC-5, andrej burja wrote:

 hi

 system: it is on linode 512, os ubuntu, server apache, database postgresql
 my initial design was using list:string, but than i saw example in the 
 book (Application-Development-Cookbook) and i thought this is better
 purpose of that code: user testing reveals, that the best way to search 
 the data is with Datatables (+individual column filtering). i have 1000 
 games with different attributes: name, for what age, how big the group can 
 be, equipment, tags, instructions. I have to put all the attributes in 
 table.
  .. and there is another problem: tags and equipment have both the same 
 implementation - so actualy i do 2000 selects :( 

 andrej

 On Thursday, October 18, 2012 4:09:59 AM UTC+2, rochacbruno wrote:

 I am using list:string for tags and it is working very well for my needs. 



-- 





[web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread Massimo Di Pierro
Session and CSV yes. What login problem are you referring to?

On Thursday, 18 October 2012 05:51:30 UTC-5, Hassan Alnatour wrote:

 Dear Massimo , 

 Is the Session , login , CSV import/Export issues are fixed ?

 regards, 

 On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro wrote:

 As far as I know it works but I will say experimental until more 
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro wrote:

 The book is now kind of in between versions it is correct but 
 some of the new features are not described and some example use old API 
 while there is a better way. I plan to finish update it and release the 
 5th 
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint: 
 can the book title be more descriptive of the related version of 
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro 
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N 
 option and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic, thanks 
 Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin and 
 Niphlod
 - better custom_import (works per app and is faster), thanks 
 Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks 
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=True)
 - DAL, Row, and Rows object can now be pickled/unpickled, thanks 
 to zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with dropbox_account.py
 - many fixes to cache.ram, cache.disk, memcache and gae_memcache
 - cache.with_prefix(cache.ram,'prefix')
 - db.table.field.epoch() counts seconds from epoch
 - DAL support for SQL CASE, example: 
 db().select(...query.case('true','false))
 - DAL(...,do_connect=False) allows faking connections
 - DAL(...,auto_import=True) now retieves some fiel attributes
 - mail can specify a sender: mail.send(...,sender='Mr X 
 %(sender)s')
 - renamed gluon/contrib/comet_messaging.py - 
 gluon/contrib/websocket_messaging.py

 Please check it and report any problem.
 As usual, thanks to the many people who have contributed, in 
 particular Michele and Niphlod.

 Massimo



-- 





Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread hasan alnator
Dear Massino ,

the login  , i think it was a session problem  , when you get applications
from the old web2py to the 2.0.9 , the login blow up

TRACEBACK

1.
2.
3.
4.
5.
6.
7.

8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.

Traceback (most recent call last):

  File C:\web2py\gluon\main.py, line 565, in wsgibase


session._try_store_on_disk(request, response)


  File C:\web2py\gluon\globals.py, line 703, in _try_store_on_disk


cPickle.dump(dict(self), response.session_file)


  File C:\Python27\Lib\copy_reg.py, line 74, in _reduce_ex


getstate = self.__getstate__


  File C:\web2py\gluon\dal.py, line 7335, in __getattr__


self.__allocate()


  File C:\web2py\gluon\dal.py, line 7328, in __allocate


self._record = self._table[int(self)]


  File C:\web2py\gluon\dal.py, line 7615, in __getitem__


return self._db(self._id == key).select(limitby=(0,1)).first()


  File C:\web2py\gluon\dal.py, line 8768, in select


return adapter.select(self.query,fields,attributes)


  File C:\web2py\gluon\dal.py, line 2123, in select


return super(SQLiteAdapter, self).select(query, fields, attributes)


  File C:\web2py\gluon\dal.py, line 1612, in select


return self._select_aux(sql,fields,attributes)


  File C:\web2py\gluon\dal.py, line 1577, in _select_aux


self.execute(sql)


  File C:\web2py\gluon\dal.py, line 1689, in execute


return self.log_execute(*a, **b)


  File C:\web2py\gluon\dal.py, line 1683, in log_execute


ret = self.cursor.execute(*a, **b)

ProgrammingError: Cannot operate on a closed database.


Best Regards,


On Thu, Oct 18, 2012 at 3:23 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Session and CSV yes. What login problem are you referring to?


 On Thursday, 18 October 2012 05:51:30 UTC-5, Hassan Alnatour wrote:

 Dear Massimo ,

 Is the Session , login , CSV import/Export issues are fixed ?

 regards,

 On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro wrote:

 As far as I know it works but I will say experimental until more
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro
 wrote:

 The book is now kind of in between versions it is correct but
 some of the new features are not described and some example use old API
 while there is a better way. I plan to finish update it and release the 
 5th
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint:
 can the book title be more descriptive of the related version of
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N
 option and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic, thanks
 Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin and
 Niphlod
 - better custom_import (works per app and is faster), thanks
 Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=**True)
 - DAL, Row, and Rows object can now be pickled/unpickled, thanks
 to zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with dropbox_account.py
 - many fixes to cache.ram, cache.disk, memcache and gae_memcache
 - cache.with_prefix(cache.ram,'**prefix')
 - db.table.field.epoch() counts seconds from epoch
 - DAL support for SQL CASE, example: db().select(...query.case('*
 *true','false))
 - DAL(...,do_connect=False) allows faking connections
 - DAL(...,auto_import=True) now retieves some fiel attributes
 - mail can specify a sender: mail.send(...,sender='Mr X
 %(sender)s')
 - renamed gluon/contrib/comet_messaging.**py -
 gluon/contrib/websocket_**messaging.py

 Please check it and report any problem.
 As usual, thanks to the many people who have contributed, in
 

Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread Massimo Di Pierro
I am pretty sure this is solved in 2.1.1. Massimo

On Thursday, 18 October 2012 07:27:26 UTC-5, Hassan Alnatour wrote:

 Dear Massino , 

 the login  , i think it was a session problem  , when you get applications 
 from the old web2py to the 2.0.9 , the login blow up  

 TRACEBACK
  
 1.
 2.
 3.
 4.
 5.
 6.
 7.

 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.

 Traceback (most recent call last):


   File C:\web2py\gluon\main.py, line 565, in wsgibase



 session._try_store_on_disk(request, response)



   File C:\web2py\gluon\globals.py, line 703, in _try_store_on_disk



 cPickle.dump(dict(self), response.session_file)



   File C:\Python27\Lib\copy_reg.py, line 74, in _reduce_ex



 getstate = self.__getstate__



   File C:\web2py\gluon\dal.py, line 7335, in __getattr__



 self.__allocate()



   File C:\web2py\gluon\dal.py, line 7328, in __allocate



 self._record = self._table[int(self)]



   File C:\web2py\gluon\dal.py, line 7615, in __getitem__



 return self._db(self._id == key).select(limitby=(0,1)).first()



   File C:\web2py\gluon\dal.py, line 8768, in select



 return adapter.select(self.query,fields,attributes)



   File C:\web2py\gluon\dal.py, line 2123, in select



 return super(SQLiteAdapter, self).select(query, fields, attributes)



   File C:\web2py\gluon\dal.py, line 1612, in select



 return self._select_aux(sql,fields,attributes)



   File C:\web2py\gluon\dal.py, line 1577, in _select_aux



 self.execute(sql)



   File C:\web2py\gluon\dal.py, line 1689, in execute



 return self.log_execute(*a, **b)



   File C:\web2py\gluon\dal.py, line 1683, in log_execute



 ret = self.cursor.execute(*a, **b)


 ProgrammingError: Cannot operate on a closed database.


 Best Regards,


 On Thu, Oct 18, 2012 at 3:23 PM, Massimo Di Pierro 
 massimo@gmail.comjavascript:
  wrote:

 Session and CSV yes. What login problem are you referring to?


 On Thursday, 18 October 2012 05:51:30 UTC-5, Hassan Alnatour wrote:

 Dear Massimo , 

 Is the Session , login , CSV import/Export issues are fixed ?

 regards, 

 On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro wrote:

 As far as I know it works but I will say experimental until more 
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro 
 wrote:

 The book is now kind of in between versions it is correct but 
 some of the new features are not described and some example use old 
 API 
 while there is a better way. I plan to finish update it and release 
 the 5th 
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint: 
 can the book title be more descriptive of the related version of 
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro 
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N 
 option and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic, thanks 
 Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin and 
 Niphlod
 - better custom_import (works per app and is faster), thanks 
 Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks 
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=**True)
 - DAL, Row, and Rows object can now be pickled/unpickled, thanks 
 to zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with dropbox_account.py
 - many fixes to cache.ram, cache.disk, memcache and gae_memcache
 - cache.with_prefix(cache.ram,'**prefix')
 - db.table.field.epoch() counts seconds from epoch
 - DAL support for SQL CASE, example: db().select(...query.case('
 **true','false))
 - DAL(...,do_connect=False) allows faking connections
 - DAL(...,auto_import=True) now retieves some fiel attributes
 - mail can specify a sender: 

Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread hasan alnator
Dear Massimo ,

That Is great , Thank you a lot ...

Best Regards,



On Thu, Oct 18, 2012 at 3:34 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 I am pretty sure this is solved in 2.1.1. Massimo


 On Thursday, 18 October 2012 07:27:26 UTC-5, Hassan Alnatour wrote:

 Dear Massino ,

 the login  , i think it was a session problem  , when you get
 applications from the old web2py to the 2.0.9 , the login blow up

 TRACEBACK

 1.
 2.
 3.
 4.
 5.
 6.
 7.

 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.

 Traceback (most recent call last):


   File C:\web2py\gluon\main.py, line 565, in wsgibase



 session._try_store_on_disk(req**uest, response)



   File C:\web2py\gluon\globals.py, line 703, in _try_store_on_disk



 cPickle.dump(dict(self), response.session_file)



   File C:\Python27\Lib\copy_reg.py, line 74, in _reduce_ex



 getstate = self.__getstate__



   File C:\web2py\gluon\dal.py, line 7335, in __getattr__



 self.__allocate()



   File C:\web2py\gluon\dal.py, line 7328, in __allocate



 self._record = self._table[int(self)]



   File C:\web2py\gluon\dal.py, line 7615, in __getitem__



 return self._db(self._id == key).select(limitby=(0,1)).fir**st()



   File C:\web2py\gluon\dal.py, line 8768, in select



 return adapter.select(self.query,fiel**ds,attributes)



   File C:\web2py\gluon\dal.py, line 2123, in select



 return super(SQLiteAdapter, self).select(query, fields, attributes)



   File C:\web2py\gluon\dal.py, line 1612, in select



 return self._select_aux(sql,fields,at**tributes)



   File C:\web2py\gluon\dal.py, line 1577, in _select_aux



 self.execute(sql)



   File C:\web2py\gluon\dal.py, line 1689, in execute



 return self.log_execute(*a, **b)



   File C:\web2py\gluon\dal.py, line 1683, in log_execute



 ret = self.cursor.execute(*a, **b)


 ProgrammingError: Cannot operate on a closed database.


 Best Regards,


 On Thu, Oct 18, 2012 at 3:23 PM, Massimo Di Pierro massimo@gmail.com
  wrote:

 Session and CSV yes. What login problem are you referring to?


 On Thursday, 18 October 2012 05:51:30 UTC-5, Hassan Alnatour wrote:

 Dear Massimo ,

 Is the Session , login , CSV import/Export issues are fixed ?

 regards,

 On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro
 wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro
 wrote:

 As far as I know it works but I will say experimental until more
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro
 wrote:

 The book is now kind of in between versions it is correct but
 some of the new features are not described and some example use old 
 API
 while there is a better way. I plan to finish update it and release 
 the 5th
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint:
 can the book title be more descriptive of the related version of
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N
 option and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic, thanks
 Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin
 and Niphlod
 - better custom_import (works per app and is faster), thanks
 Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=**T**rue)
 - DAL, Row, and Rows object can now be pickled/unpickled,
 thanks to zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with dropbox_account.py
 - many fixes to cache.ram, cache.disk, memcache and gae_memcache
 - cache.with_prefix(cache.ram,'**p**refix')
 - db.table.field.epoch() counts seconds from epoch
 - DAL support for SQL CASE, example: db().select(...query.case('
 **tru**e','false))
 - 

[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread Massimo Di Pierro
Also, where is appy.pod installed? In python site-packages, in web2py 
site-packages, or in the app modules?

On Wednesday, 17 October 2012 22:59:43 UTC-5, Donatas Burba wrote:

 I have noticed another issue. With version 2.1.1 I can't use appy.pod 
 anymore. It means I can generate only one pdf file, every other try gives 
 me error (that I'm using python which can't access uno). I think that 
 problem is in custom_import.py, so I was forced to return back to 2.0.9, 
 where appy.pod works perfectly.

-- 





[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread Donatas Burba
In the app modules

2012 m. spalis 18 d., ketvirtadienis 15:36:17 UTC+3, Massimo Di Pierro rašė:

 Also, where is appy.pod installed? In python site-packages, in web2py 
 site-packages, or in the app modules?

 On Wednesday, 17 October 2012 22:59:43 UTC-5, Donatas Burba wrote:

 I have noticed another issue. With version 2.1.1 I can't use appy.pod 
 anymore. It means I can generate only one pdf file, every other try gives 
 me error (that I'm using python which can't access uno). I think that 
 problem is in custom_import.py, so I was forced to return back to 2.0.9, 
 where appy.pod works perfectly.



-- 





[web2py] Re: response.stream

2012-10-18 Thread weheh
Hi Niphlod - I modified my response.stream call to include the filename 
argument. When I call the controller, the file does get downloaded. 
However, when ajax calls the controller, the file isn't downloaded.

@Leonel, a simple link, like A('download tar file', _href='%?attachment' % 
path_to_download_file) won't work because the file to be downloaded doesn't 
exist at the time the link is created. It needs to be generated on the fly.


On Thursday, October 18, 2012 4:46:33 PM UTC+8, Niphlod wrote:

 the first thing is: when you navigate to mycontroller/mydownload (no ajax) 
 can you get the file downloaded ?
 second thing missing from your code: if you want the content downloaded as 
 an attachment, set the content-disposition header to attachment; 
 filename=afilename.tar (or if you're using recent web2py version 
 response.stream(file, attachment=True, filename=afilename.tar))

 On Thursday, October 18, 2012 8:09:09 AM UTC+2, weheh wrote:

 Is it possible to do a response.stream in the middle of an ajax callback?

 I want to give users a button, which if pressed, will tar up all their 
 files and initiate a download. Something like this:

 TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % 
 URL(c='mycontroller', f='mydownload'))

 Then later, in mycontroller.py, 

 def mydownload():
 ... create tarfile ...
 return response.stream(tarfile, attachment=True)

 I tried it, but (perhaps obviously to some) it doesn't work. So, how to 
 get the mydownload() action to cause the browser to download the tarfile?



-- 





[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread Donatas Burba


1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.

Traceback (most recent call last):
  File /var/www/advokatai/gluon/restricted.py, line 209, in restricted
exec ccode in environment
  File 
/home/web2py/advokatai/web2py/applications/bow_law/controllers/plugin_invoice.py
 
http://localhost:8001/admin/default/edit/bow_law/controllers/plugin_invoice.py,
 line 321, in module
  File /var/www/advokatai/gluon/globals.py, line 187, in lambda
self._caller = lambda f: f()
  File /var/www/advokatai/gluon/tools.py, line 2838, in f
return action(*a, **b)
  File 
/home/web2py/advokatai/web2py/applications/bow_law/controllers/plugin_invoice.py
 
http://localhost:8001/admin/default/edit/bow_law/controllers/plugin_invoice.py,
 line 301, in print_invoice
(series, number, file) = print_file(db, invoice_id, template_id, 
ooPort=OO_PORT)
  File applications/bow_law/modules/plugin_invoice.py, line 73, in print_file
filename='{0}{1}'.format(series, number))
  File applications/bow_law/modules/plugin_printer.py, line 25, in 
print_document
renderer.run()
  File applications/bow_law/modules/appy/pod/renderer.py, line 369, in run
self.finalize()
  File applications/bow_law/modules/appy/pod/renderer.py, line 486, in 
finalize
output = self.callOpenOffice(resultOdtName, resultType)
  File applications/bow_law/modules/appy/pod/renderer.py, line 443, in 
callOpenOffice
raise pe
PodError: Extension of result file is pdf. In order to perform conversion 
from ODT to this format we need to call OpenOffice. But the Python interpreter 
which runs the current script does not know UNO, the library that allows to 
connect to OpenOffice in server mode. If you can't install UNO in this Python 
interpreter, you can specify, in parameter pythonWithUnoPath, the path to a 
UNO-enabled Python interpreter. One such interpreter may be found in 
open_office_path/program.


Using appy.pod v0.8.0

-- 





[web2py] Re: response.stream

2012-10-18 Thread Niphlod
you can still use an href to the controller that returns finally your file, 
I don't see the problem (unless you want to fire something else, you can 
still animate the button in the middle). When you click on a link that 
returns an attachment you won't see the page change.
If you want to use an ajax function strictly, there are some tricks 
involved, because ajax is supposed to send/return only text responses.
Let us know what you need.

On Thursday, October 18, 2012 2:39:09 PM UTC+2, weheh wrote:

 Hi Niphlod - I modified my response.stream call to include the filename 
 argument. When I call the controller, the file does get downloaded. 
 However, when ajax calls the controller, the file isn't downloaded.

 @Leonel, a simple link, like A('download tar file', _href='%?attachment' % 
 path_to_download_file) won't work because the file to be downloaded doesn't 
 exist at the time the link is created. It needs to be generated on the fly.


 On Thursday, October 18, 2012 4:46:33 PM UTC+8, Niphlod wrote:

 the first thing is: when you navigate to mycontroller/mydownload (no 
 ajax) can you get the file downloaded ?
 second thing missing from your code: if you want the content downloaded 
 as an attachment, set the content-disposition header to attachment; 
 filename=afilename.tar (or if you're using recent web2py version 
 response.stream(file, attachment=True, filename=afilename.tar))

 On Thursday, October 18, 2012 8:09:09 AM UTC+2, weheh wrote:

 Is it possible to do a response.stream in the middle of an ajax callback?

 I want to give users a button, which if pressed, will tar up all their 
 files and initiate a download. Something like this:

 TAG.BUTTON(..., _onclick=ajax(%s, [], ':eval'); % 
 URL(c='mycontroller', f='mydownload'))

 Then later, in mycontroller.py, 

 def mydownload():
 ... create tarfile ...
 return response.stream(tarfile, attachment=True)

 I tried it, but (perhaps obviously to some) it doesn't work. So, how to 
 get the mydownload() action to cause the browser to download the tarfile?



-- 





Re: [web2py] [FYI] Pyodel is now a plugin

2012-10-18 Thread Alan Etkin
El martes, 16 de octubre de 2012 18:12:46 UTC-3, Bill Thayer escribió:Hi 
Alan. 
 I went through the registration process, got the Google sign in. Signed 
in with google too and then did not get re-directed back.

AFAIK, there's no need to authenticate with a Google account to use the 
demo. Are you able to authenticate with the registered Auth user?

-- 





[web2py] Re: auth.wiki usage - Another Oracle DB Gotcha

2012-10-18 Thread Alan Etkin


 DatabaseError: ORA-00904: WIKI_TAG.WIKI_PAGE: invalid identifier



I found the connection error to be related to conflicts with field names, 
at least for some web Oracle related threads. The problem is that the names 
of the error output are table names instead.

-- 





Re: [web2py] Re: web2py 2.1.1 is OUT!

2012-10-18 Thread Alec Taylor
Massimo: RE: *type 'exceptions.AttributeError' 'OracleAdapter' object has
no attribute 'cursor'*?

http://code.google.com/p/web2py/issues/detail?id=1085

On Thu, Oct 18, 2012 at 11:35 PM, hasan alnator
halna...@gardeniatelco.comwrote:

 Dear Massimo ,

 That Is great , Thank you a lot ...

 Best Regards,



 On Thu, Oct 18, 2012 at 3:34 PM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 I am pretty sure this is solved in 2.1.1. Massimo


 On Thursday, 18 October 2012 07:27:26 UTC-5, Hassan Alnatour wrote:

 Dear Massino ,

 the login  , i think it was a session problem  , when you get
 applications from the old web2py to the 2.0.9 , the login blow up

 TRACEBACK

 1.
 2.
 3.
 4.
 5.
 6.
 7.

 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
 23.
 24.
 25.
 26.
 27.

 Traceback (most recent call last):



   File C:\web2py\gluon\main.py, line 565, in wsgibase




 session._try_store_on_disk(req**uest, response)




   File C:\web2py\gluon\globals.py, line 703, in _try_store_on_disk




 cPickle.dump(dict(self), response.session_file)




   File C:\Python27\Lib\copy_reg.py, line 74, in _reduce_ex




 getstate = self.__getstate__




   File C:\web2py\gluon\dal.py, line 7335, in __getattr__




 self.__allocate()




   File C:\web2py\gluon\dal.py, line 7328, in __allocate




 self._record = self._table[int(self)]




   File C:\web2py\gluon\dal.py, line 7615, in __getitem__




 return self._db(self._id == key).select(limitby=(0,1)).fir**st()




   File C:\web2py\gluon\dal.py, line 8768, in select




 return adapter.select(self.query,fiel**ds,attributes)




   File C:\web2py\gluon\dal.py, line 2123, in select




 return super(SQLiteAdapter, self).select(query, fields, attributes)




   File C:\web2py\gluon\dal.py, line 1612, in select




 return self._select_aux(sql,fields,at**tributes)




   File C:\web2py\gluon\dal.py, line 1577, in _select_aux




 self.execute(sql)




   File C:\web2py\gluon\dal.py, line 1689, in execute




 return self.log_execute(*a, **b)




   File C:\web2py\gluon\dal.py, line 1683, in log_execute




 ret = self.cursor.execute(*a, **b)



 ProgrammingError: Cannot operate on a closed database.



 Best Regards,


 On Thu, Oct 18, 2012 at 3:23 PM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 Session and CSV yes. What login problem are you referring to?


 On Thursday, 18 October 2012 05:51:30 UTC-5, Hassan Alnatour wrote:

 Dear Massimo ,

 Is the Session , login , CSV import/Export issues are fixed ?

 regards,

 On Thursday, October 18, 2012 12:30:33 AM UTC+3, Massimo Di Pierro
 wrote:

 The line is:

 from distutils import dir_util

 I think you need to install distutils separately.


 On Tuesday, 16 October 2012 09:14:47 UTC-5, apps in tables wrote:

 when i click on deploy to openshift , I get the error :

   cannot import name dir_util

 On Tuesday, October 16, 2012 2:17:43 PM UTC+3, Massimo Di Pierro
 wrote:

 As far as I know it works but I will say experimental until more
 people have tried it.

 On Tuesday, 16 October 2012 04:07:37 UTC-5, apps in tables wrote:

 Thanks...

 is deploy to openshift experimental?

 On Tuesday, October 16, 2012 4:04:36 AM UTC+3, Massimo Di Pierro
 wrote:

 The book is now kind of in between versions it is correct but
 some of the new features are not described and some example use old 
 API
 while there is a better way. I plan to finish update it and release 
 the 5th
 editions within one month. Hopefully sooner.

 On Monday, 15 October 2012 20:01:33 UTC-5, apps in tables wrote:


 Fantastic.as usual.

 tiny hint:
 can the book title be more descriptive of the related version of
 web2py ?


 On Monday, October 15, 2012 8:30:42 PM UTC+3, martzi wrote:

 Many thanks Massimo web2py is here to stay !

 On Monday, October 15, 2012 1:55:39 PM UTC+2, Massimo Di Pierro
 wrote:

 Changelog:

 - overall faster web2py
 - when apps are deleted, a w2p copy left in deposit folder
 - change in cron (it is now disabled by default). removed -N
 option and introdu\
 ced -Y.
 - faster web2py_uuid() and request initialization logic,
 thanks Michele
 - static asset management, thanks Niphlod
 - improved mobile admin
 - request.requires_https and Auth(secure=True), thanks Yarin
 and Niphlod
 - better custom_import (works per app and is faster), thanks
 Michele
 - redis_sesssion.py, thanks Niphlod
 - allow entropy computation in IS_STRONG and web2py.js, thanks
 Jonathan and Nip\
 hlod
 - fixed many aith.wiki problems
 - support for auth.wiki(render='html')
 - better welcome layout, thanks Paolo
 - db.define_table(...,redefine=**T**rue)
  - DAL, Row, and Rows object can now be pickled/unpickled,
 thanks to zombie DAL.
 - admin uses codemirror
 - allow syntax auth = Auth(db).define_tables()
 - better auth.wiki with preview, thanks Alan
 - better auth.impersonate, thanks Alan
 - upgraded jQuery 1.8
 - upgraded Bootstrap 2.1
 - fixed problems with 

[web2py] Re: Web2Py on OpenShift

2012-10-18 Thread apps in tables
Hi,

Andew says:
For the admin app to work you must put your password hash in 
parameters_8080.py in wsgi/web2py/.

My Question:
  Which password? I mean that the password is defined upon the start of 
server, in openshift the server is started, so is it the password of the 
openshift account?
  And how to get the hash of it?

Regards,

Ashraf

On Wednesday, October 17, 2012 4:39:06 AM UTC+3, apps in tables wrote:

 Thank you ...for being so supportive.

 On Wednesday, October 17, 2012 4:21:43 AM UTC+3, greaneym wrote:

 Git was easy to install (on a mac) using this link,
 https://help.github.com/articles/set-up-git

 You need git to keep a copy of your repository somewhere else besides 
 on the openshift server.
  
 and the only change after that was to the parameters_xxx.py file which 
 one uses to access the admin
 page.  You will need to read this page to see how to set that up.
 https://github.com/prelegalwonder/openshift_web2py/issues/6

 That was the only change to the install. It will hopefully help you to 
 know this before you do the install.

 Margaret


 On Tuesday, October 16, 2012 8:07:01 PM UTC-5, apps in tables wrote:

 unfortunatelynope

 On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote:

 Ashraf,  I posted twice to your answer but don't see it on the list. 
 Maybe the answers went directly to you.
 margaret

 On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote:

 *Hi Margaret,*
 *

 I don't understand what you mean by using admin deploy to openshift.*
 I mean local admin, as in http://127.0.0.1:8000/admin/default/site , 
 it has a button called deploy to openshift.

 Since your way is working fine, I will try yours...)

 You have a good one.

 Last question: Do i have to use git? ( i did not use git before)

 Ashraf

 On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote:

 Hi Ashraf,

 I don't understand what you mean by using admin deploy to openshift, 
 but no, I've just used the rhc commands to create the python gear as 
 described in the openshift guide, then used Andrew's scripts to install 
 web2py. But that does create an admin interface accessible via https and 
 using that you can modify the install. Or you can modify the install by 
 using ssh to your account and using git to pull files.  

 Maybe others who have installed on openshift can help.

 Margaret

 On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote:

 Thank you Margaret,

 I am trying to use the admin (deploy to openshift). My understanding 
 is that you are not using that option for deployment.

 Do you know any requirements for using admin (deploy to openshift) ?

 Ashraf

 On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote:


 Ashraf,

 (reposting, as response did not show up on list)

 This morning I installed a web2py app using the github path to 
 Andrew's v2.0.9 web2py install on openshift and it worked fine. My 
 other 
 app install has been working for months, and it uses v2.0.2.  I did 
 receive 
 recently an e-mail from openshift stating that their directory 
 structure 
 has changed.  So far it has not affected my install. Just reporting. 

 Margaret



-- 





[web2py] Re: Web2Py on OpenShift

2012-10-18 Thread Andrew
Ashraf,

I apologize, this is the first message I've received since you started 
posting to this thread. I think something with the group is malfunctioning. 

In anycase;

Regarding which password, it's the web2py admin password hash. You can 
get this by starting a vanilla web2py instance with the -a password and 
then grab the line in parameters_8080.py that it creates.

I'd also be happy to assist with the Deploy to OpenShift issue you're 
seeing. I tried with 2.0.9 a while back and ran into some issues as well I 
believe but haven't had time to look at them. If you want to look at the 
open issues on the github repo and add info to the one that's relevant or 
open a new one, I'll do my best to help you get going.

Regards,
Andrew

On Thursday, October 18, 2012 9:10:50 AM UTC-5, apps in tables wrote:

 Hi,

 Andew says:
 For the admin app to work you must put your password hash in 
 parameters_8080.py in wsgi/web2py/.

 My Question:
   Which password? I mean that the password is defined upon the start of 
 server, in openshift the server is started, so is it the password of the 
 openshift account?
   And how to get the hash of it?

 Regards,

 Ashraf

 On Wednesday, October 17, 2012 4:39:06 AM UTC+3, apps in tables wrote:

 Thank you ...for being so supportive.

 On Wednesday, October 17, 2012 4:21:43 AM UTC+3, greaneym wrote:

 Git was easy to install (on a mac) using this link,
 https://help.github.com/articles/set-up-git

 You need git to keep a copy of your repository somewhere else besides 
 on the openshift server.
  
 and the only change after that was to the parameters_xxx.py file which 
 one uses to access the admin
 page.  You will need to read this page to see how to set that up.
 https://github.com/prelegalwonder/openshift_web2py/issues/6

 That was the only change to the install. It will hopefully help you to 
 know this before you do the install.

 Margaret


 On Tuesday, October 16, 2012 8:07:01 PM UTC-5, apps in tables wrote:

 unfortunatelynope

 On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote:

 Ashraf,  I posted twice to your answer but don't see it on the list. 
 Maybe the answers went directly to you.
 margaret

 On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote:

 *Hi Margaret,*
 *

 I don't understand what you mean by using admin deploy to openshift.*
 I mean local admin, as in http://127.0.0.1:8000/admin/default/site , 
 it has a button called deploy to openshift.

 Since your way is working fine, I will try yours...)

 You have a good one.

 Last question: Do i have to use git? ( i did not use git before)

 Ashraf

 On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote:

 Hi Ashraf,

 I don't understand what you mean by using admin deploy to openshift, 
 but no, I've just used the rhc commands to create the python gear as 
 described in the openshift guide, then used Andrew's scripts to install 
 web2py. But that does create an admin interface accessible via https 
 and 
 using that you can modify the install. Or you can modify the install by 
 using ssh to your account and using git to pull files.  

 Maybe others who have installed on openshift can help.

 Margaret

 On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables wrote:

 Thank you Margaret,

 I am trying to use the admin (deploy to openshift). My 
 understanding is that you are not using that option for deployment.

 Do you know any requirements for using admin (deploy to openshift) ?

 Ashraf

 On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote:


 Ashraf,

 (reposting, as response did not show up on list)

 This morning I installed a web2py app using the github path to 
 Andrew's v2.0.9 web2py install on openshift and it worked fine. My 
 other 
 app install has been working for months, and it uses v2.0.2.  I did 
 receive 
 recently an e-mail from openshift stating that their directory 
 structure 
 has changed.  So far it has not affected my install. Just reporting. 

 Margaret



-- 





[web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
hello web2py users,

I am looking for specifics when it comes to creating additional tables 
within a sub-directory of MODELS !

I am making significant progress on my app ! and I know that I will 
certainly have an overhead issue because in my db.py file I have about 20 
tables defined and some tables have more than 20 fields in them !
My approach was to build the app.. simply with no consideration for 
performance .. but as I am moving along ... considering how far I have gone 
... it is time that I do go  back and  move a few things around.

I really need to avoid the load of all these tables from the start and few 
variables that are only pertinent to specific tables in there  ! .. 
so I'm thinking to only keep  the auth_user table in my db.py file with 
certain important global variables ( it is safe to assume that it is the 
only table that will need to be loaded throughout )

The other tables, I want to move them to sub directories below the MODELS 
with their corresponding controller names in the CONTROLLERS and 
corresponding VIEWS !

As soon as I have started  ...

I get the error : 

class '_mysql_exceptions.OperationalError' (1005, Can't create table 
...bla bla bla ..

My Question or concern is this :  
when using sub directories in MODELS,
Do I need to redothese instructions ? from ()  import ( 
..*..)

Aren't they loaded already from db.py ? ... 
what do I need to declare before defining the tables I want in the 
MODELS/directoryname/file.py for example ?
what does the file.py in MODELS sub directory look like, I have looked at 
various examples, even in the book, and even throughout the threads here 
and could not find any suitable example

please enlighten me ...

please advise

thank you

-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
New feature lazy_table doesn't help?

I would go with lazy_table before use sub-directory since if you use
sub-directory depending of your app design your code will be less DRY. You
need to have the same function in controller sub-directory for each table.
So if all your table use the same function create() you will have 20 create
functions and the pain comes when you refactor these 20 functions. Maybe if
you have a single function per controller file it could be possible to make
symblinks and have only one master file, but I didn't try that and I don't
know how web2py would react.

Also, there is many other thing to optimize, like the length of your models
and controllers files. For example, let say you have create(), update(),
select() functions, you can split them in there own controller file and it
should speed up your app since there will be only a few lines of code to be
parsed when calling create() for example. Use cache.ram() were it is
possible, that speed up thing a lot.

Good luck.

Richard

On Thu, Oct 18, 2012 at 10:20 AM, Don_X don.clerm...@gmail.com wrote:

 hello web2py users,

 I am looking for specifics when it comes to creating additional tables
 within a sub-directory of MODELS !

 I am making significant progress on my app ! and I know that I will
 certainly have an overhead issue because in my db.py file I have about 20
 tables defined and some tables have more than 20 fields in them !
 My approach was to build the app.. simply with no consideration for
 performance .. but as I am moving along ... considering how far I have gone
 ... it is time that I do go  back and  move a few things around.

 I really need to avoid the load of all these tables from the start and few
 variables that are only pertinent to specific tables in there  ! ..
 so I'm thinking to only keep  the auth_user table in my db.py file with
 certain important global variables ( it is safe to assume that it is the
 only table that will need to be loaded throughout )

 The other tables, I want to move them to sub directories below the MODELS
 with their corresponding controller names in the CONTROLLERS and
 corresponding VIEWS !

 As soon as I have started  ...

 I get the error :

 class '_mysql_exceptions.OperationalError' (1005, Can't create table
 ...bla bla bla ..

 My Question or concern is this :
 when using sub directories in MODELS,
 Do I need to redothese instructions ? from ()  import (
 ..*..)

 Aren't they loaded already from db.py ? ...
 what do I need to declare before defining the tables I want in the
 MODELS/directoryname/file.py for example ?
 what does the file.py in MODELS sub directory look like, I have looked at
 various examples, even in the book, and even throughout the threads here
 and could not find any suitable example

 please enlighten me ...

 please advise

 thank you

 --





-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
Richard .. at this stage ! ... the controller file  for each sub directory 
table files are not the issue ... for now ...

the tables are not getting created at all ! ...

what I did to start fresh
1) i delete the database files  in the database directory
2) delete the session files in the session directory
3) delete the MySQL db and recreate a new one with no tables
4) I moved the tables and certain variables definitions from the db.py 
MODELS ( except for auth_user and other variables related to these other 
tables ) to 4 different sub directories in MODELS
5) I moved certain def functions related to these tables to 
New_Name_directory.py in controller, just like their related MODELS file 
( same name as their MODELS/New_Name_directory/new_name.py
6) moved the corresponding view files and renamed them according to the the 
directory scheme, so it can respond appropriately.

the first launch was ok ! .. auth_user table is created in the db ... good !
when I call on the view related to its related controller action ... i get 
the error described above ... and  I realized that the tables did not even 
get to be created ! ..

so the problem is with the MODELS/New_Name_directory/new_name.py

There is something that I am not doing !!?? ... I don't know what it is ? 
... 
so i want to have an example of how does the new_name.py of ( in 
MODELS/sub_directory/new_name.py )  should present itself, what does it 
need to say before db.table_define, what does it contain besides the table 
definition and variables ...??? ...

thank you

Don

-- 





Re: [web2py] [FYI] Pyodel is now a plugin

2012-10-18 Thread Bill Thayer
Just tried it again. Logged in with my email and password then it took me 
to a blank page with one line on top that says to sign in with google 
password.

On Thursday, October 18, 2012 8:23:58 AM UTC-5, Alan Etkin wrote:

 El martes, 16 de octubre de 2012 18:12:46 UTC-3, Bill Thayer escribió:Hi 
 Alan. 
  I went through the registration process, got the Google sign in. Signed 
 in with google too and then did not get re-directed back.

 AFAIK, there's no need to authenticate with a Google account to use the 
 demo. Are you able to authenticate with the registered Auth user?



-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
I don't understand you last sentence... Even if you move your db into sub
folder the need to be defined with db.table_define(...)?!

Also, maybe you just had set migrate_enabled=False in your db connection
string??

Richard

On Thu, Oct 18, 2012 at 11:22 AM, Don_X don.clerm...@gmail.com wrote:

 Richard .. at this stage ! ... the controller file  for each sub directory
 table files are not the issue ... for now ...

 the tables are not getting created at all ! ...

 what I did to start fresh
 1) i delete the database files  in the database directory
 2) delete the session files in the session directory
 3) delete the MySQL db and recreate a new one with no tables
 4) I moved the tables and certain variables definitions from the db.py
 MODELS ( except for auth_user and other variables related to these other
 tables ) to 4 different sub directories in MODELS
 5) I moved certain def functions related to these tables to
 New_Name_directory.py in controller, just like their related MODELS file
 ( same name as their MODELS/New_Name_directory/new_name.py
 6) moved the corresponding view files and renamed them according to the
 the directory scheme, so it can respond appropriately.

 the first launch was ok ! .. auth_user table is created in the db ... good
 !
 when I call on the view related to its related controller action ... i get
 the error described above ... and  I realized that the tables did not even
 get to be created ! ..

 so the problem is with the MODELS/New_Name_directory/new_name.py

 There is something that I am not doing !!?? ... I don't know what it is ?
 ...
 so i want to have an example of how does the new_name.py of ( in
 MODELS/sub_directory/new_name.py )  should present itself, what does it
 need to say before db.table_define, what does it contain besides the table
 definition and variables ...??? ...

 thank you

 Don

 --





-- 





[web2py] Re: auth.wiki usage - Another Oracle DB Gotcha

2012-10-18 Thread Bill Thayer

Oh. 

So that's why a reference field should not be named the same as the table 
it's referencing. In this case I didn't make the name but generally I do 
that all the time. Didn't realize that it makes error messages clearer. Duh.

-Bill

-- 





Re: [web2py] [FYI] Pyodel is now a plugin

2012-10-18 Thread Alan Etkin
 El jueves, 18 de octubre de 2012 12:29:17 UTC-3, Bill Thayer 
escribió:Just tried it again. Logged in with my email and password 
 then 
 it took me to a blank page with one line on top that says to sign in with 
google password.

I must admit this is some kind of app issue. However, I have created a fake 
user and authenticated without a Google account. I'll have to check how GAE 
handles app users so I can fix this somehow.

-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X

in 0.db 
I have : settings.migrate = True

in db.py  I have  db.define_table('auth_user', Field (.,Field(), ... 
Field...
 bla bla bla
.

LAST_Field('...',),  migrate=settings.migrate)


I moved the other  db.define_table  declarations in  subdirectory files

I am trying to implement and use the conditional models approach ! and the 
tables in the sub directories are not being created when their related 
controller is called upon !

:(

How does that conditional models approach work exactly ..? ... I need a 
good example !

in parallel, I will be using the modules approach for the functions  
classes associated with each Model / controller .. i simply want to keep my 
models in the MODELS and not move them to modules
 ... modules will have only custom functions and classes, that will be 
called upon ( imported )  by the controllers when needed.

Don


-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread mikech
Thanks Bill.
What I'm trying to find out is how do I access the tables involved with 
security.  Do I need to create views, or is there already some associated 
with the appadmin?

On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial it 
 mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members of 
 the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just shows 
 the two tables of the application - image and comment.



-- 





[web2py] Re: Web2Py on OpenShift

2012-10-18 Thread apps in tables
Thank you Andrew...

There is no need for apology.

The most thing i like about web2py is the community...very supportive.

After adding the hashed password, the admin works fine.

Now, to the github issues

Regards,

Ashraf

On Thursday, October 18, 2012 5:18:32 PM UTC+3, Andrew wrote:

 Ashraf,

 I apologize, this is the first message I've received since you started 
 posting to this thread. I think something with the group is malfunctioning. 

 In anycase;

 Regarding which password, it's the web2py admin password hash. You can 
 get this by starting a vanilla web2py instance with the -a password and 
 then grab the line in parameters_8080.py that it creates.

 I'd also be happy to assist with the Deploy to OpenShift issue you're 
 seeing. I tried with 2.0.9 a while back and ran into some issues as well I 
 believe but haven't had time to look at them. If you want to look at the 
 open issues on the github repo and add info to the one that's relevant or 
 open a new one, I'll do my best to help you get going.

 Regards,
 Andrew

 On Thursday, October 18, 2012 9:10:50 AM UTC-5, apps in tables wrote:

 Hi,

 Andew says:
 For the admin app to work you must put your password hash in 
 parameters_8080.py in wsgi/web2py/.

 My Question:
   Which password? I mean that the password is defined upon the start of 
 server, in openshift the server is started, so is it the password of the 
 openshift account?
   And how to get the hash of it?

 Regards,

 Ashraf

 On Wednesday, October 17, 2012 4:39:06 AM UTC+3, apps in tables wrote:

 Thank you ...for being so supportive.

 On Wednesday, October 17, 2012 4:21:43 AM UTC+3, greaneym wrote:

 Git was easy to install (on a mac) using this link,
 https://help.github.com/articles/set-up-git

 You need git to keep a copy of your repository somewhere else besides 
 on the openshift server.
  
 and the only change after that was to the parameters_xxx.py file which 
 one uses to access the admin
 page.  You will need to read this page to see how to set that up.
 https://github.com/prelegalwonder/openshift_web2py/issues/6

 That was the only change to the install. It will hopefully help you to 
 know this before you do the install.

 Margaret


 On Tuesday, October 16, 2012 8:07:01 PM UTC-5, apps in tables wrote:

 unfortunatelynope

 On Wednesday, October 17, 2012 4:02:33 AM UTC+3, greaneym wrote:

 Ashraf,  I posted twice to your answer but don't see it on the list. 
 Maybe the answers went directly to you.
 margaret

 On Tuesday, October 16, 2012 5:35:04 PM UTC-5, apps in tables wrote:

 *Hi Margaret,*
 *

 I don't understand what you mean by using admin deploy to openshift.
 *
 I mean local admin, as in http://127.0.0.1:8000/admin/default/site , 
 it has a button called deploy to openshift.

 Since your way is working fine, I will try yours...)

 You have a good one.

 Last question: Do i have to use git? ( i did not use git before)

 Ashraf

 On Wednesday, October 17, 2012 12:56:59 AM UTC+3, greaneym wrote:

 Hi Ashraf,

 I don't understand what you mean by using admin deploy to 
 openshift, but no, I've just used the rhc commands to create the 
 python 
 gear as described in the openshift guide, then used Andrew's scripts 
 to 
 install web2py. But that does create an admin interface accessible via 
 https and using that you can modify the install. Or you can modify the 
 install by using ssh to your account and using git to pull files.  

 Maybe others who have installed on openshift can help.

 Margaret

 On Tuesday, October 16, 2012 12:31:32 PM UTC-5, apps in tables 
 wrote:

 Thank you Margaret,

 I am trying to use the admin (deploy to openshift). My 
 understanding is that you are not using that option for deployment.

 Do you know any requirements for using admin (deploy to openshift) 
 ?

 Ashraf

 On Tuesday, October 16, 2012 5:57:13 PM UTC+3, greaneym wrote:


 Ashraf,

 (reposting, as response did not show up on list)

 This morning I installed a web2py app using the github path to 
 Andrew's v2.0.9 web2py install on openshift and it worked fine. My 
 other 
 app install has been working for months, and it uses v2.0.2.  I did 
 receive 
 recently an e-mail from openshift stating that their directory 
 structure 
 has changed.  So far it has not affected my install. Just reporting. 

 Margaret



-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Marin Pranjić
On Thu, Oct 18, 2012 at 4:20 PM, Don_X don.clerm...@gmail.com wrote:

 hello web2py users,


 I get the error :

 class '_mysql_exceptions.OperationalError' (1005, Can't create table
 ...bla bla bla ..


It's hard to say without any code but from your error, I guess problem is
with foreign keys.
Are all the related tables created? Can you post some code?

Marin

-- 





[web2py] Re: Error on OpenShift deploy

2012-10-18 Thread apps in tables
Hi,

I had a similar issue.

try:
  https://groups.google.com/forum/?fromgroups=#!topic/web2py/DJvC9FMNohE

Regards,

Ashraf

On Wednesday, October 17, 2012 10:11:32 PM UTC+3, Relsi Hur wrote:

 Hello, 

 I try to deploy a app int the OpenShift using this option in the admin, 
 but I have a error. Someone has the inside track for this operation?

 The error is:

 Traceback (most recent call last):
   File /home/locatto/Downloads/site-locatto/gluon/restricted.py, line 209, 
 in restricted
 exec ccode in environment
   File 
 /home/locatto/Downloads/site-locatto/applications/admin/controllers/openshift.py
  http://localhost:8000/admin/default/edit/admin/controllers/openshift.py, 
 line 58, in module
   File /home/locatto/Downloads/site-locatto/gluon/globals.py, line 187, in 
 lambda
 self._caller = lambda f: f()
   File 
 /home/locatto/Downloads/site-locatto/applications/admin/controllers/openshift.py
  http://localhost:8000/admin/default/edit/admin/controllers/openshift.py, 
 line 33, in deploy
 index = repo.index
 AttributeError: 'Repo' object has no attribute 'index'




-- 





[web2py] auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread villas
I want to read the content of a wiki page into my view:  
views/mycontroller/mypage.html
using:  {{=auth.wiki(my-wiki-slug') }}

auth.wiki is on a function in:   controllers/default.py

If the wiki page is found then it works OK.
If the wiki page is not found,  then it redirects to:   
mycontroller/mypage/_create/my-wiki-slug

This redirect does not go to the correct place. 

-- 





[web2py] Cron task help

2012-10-18 Thread Mike Anson
I would like to have posted my question right here but with I was unable to 
post it perhaps due to character count of the question being +800

So I posted it on 
Stackoverflowhttp://stackoverflow.com/questions/12960138/web2py-cron-task-debug
.

Any help would be greatly appreciated.

-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread Bill Thayer
Sounds like those auth_ tables are not defined. If you already have those 
lines in your db.py then the tables should be listed in your apadmin. If so 
then you just follow the instructions in my other post. 
https://groups.google.com/d/msg/web2py/AEBFWeS8YSA/2LWC4NqdaiAJ to get the 
permissions set correctly.




On Thursday, October 18, 2012 11:21:39 AM UTC-5, mikech wrote:

 Thanks Bill.
 What I'm trying to find out is how do I access the tables involved with 
 security.  Do I need to create views, or is there already some associated 
 with the appadmin?

 On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial it 
 mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members of 
 the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just shows 
 the two tables of the application - image and comment.



-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread mikech
Hi Bill don't want to take up much of your time.  I've verified that the 
auth_* tables are defined using a sqllite2009 pro.  I've included a screen 
shot attached.  And I've also included a screenshot of the appadmin page 
which shows just 2 files image and comment.   This is consistent with the 
image in the book by the way. 



On Thursday, October 18, 2012 9:21:39 AM UTC-7, mikech wrote:

 Thanks Bill.
 What I'm trying to find out is how do I access the tables involved with 
 security.  Do I need to create views, or is there already some associated 
 with the appadmin?

 On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial it 
 mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members of 
 the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just shows 
 the two tables of the application - image and comment.



-- 



attachment: images.pngattachment: images-appadmin.png

[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread villas
I guess we don't need {{=auth.wiki('slug')}} to read a wiki page into a 
view because we can just use LOAD().

So maybe we should just deprecate it (if it was ever official).

-- 





[web2py] REF: Active Directory with group support

2012-10-18 Thread Teddy Nyambe
I have a problem with group support with web2py. The following basic
AD configuration works fine:

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
   server='xxx.xxx.xxx.xxx',  # IP Address
   base_dn='dc=example,dc=co,dc=zm')] # Base DN

but problem comes in when i introduced parameters to support group
capabilities as follows I am getting an error Invalid Login:

from gluon.contrib.login_methods.ldap_auth import ldap_auth
auth.settings.login_methods = [ldap_auth(mode='ad',
   allowed_groups = ['Domain Group1','ict_dept'],
   bind_dn = 'CN=Admin,DC=example,DC=co,DC=zm',
   bind_pw = 'ADPASSWORD',
   group_dn = 'OU=XXOU,OU=ICTUsers,DC=example,DC=co,DC=zm',
   group_name_attrib = 'cn',
   group_member_attrib = 'member',
   group_filterstr = 'objectClass=Group',
   server='xxx.xxx.xxx.xxx',
   base_dn='dc=example,dc=co,dc=zm')]

What could I be missing? Any help will be appreciated

Kind regards,

Teddy L.

-- 





[web2py] SQLFORM.grid 2.1.1 backward compatibility issue

2012-10-18 Thread weheh
I have a datetime field I want to represent differently using a lambda 
function. Instead of datetime, I want a timedelta. This was not a problem 
with version 1.99.x but is a problem with 2.1.1 because grid tries to do a 
row.year, which throws this ticket:

Traceback (most recent call last):
  File N:\web2py\gluon\restricted.py, line 209, in restricted
exec ccode in environment
  File N:/web2py/applications/mya/controllers/myc.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py, line 663, in 
module
  File N:\web2py\gluon\globals.py, line 187, in lambda
self._caller = lambda f: f()
  File N:\web2py\gluon\tools.py, line 2838, in f
return action(*a, **b)
  File N:/web2py/applications/mya/controllers/myc.py 
http://127.0.0.1:8000/admin/edit/YAKiToMe/controllers/yak.py, line 191, in 
list_stuff
ui='web2py',
  File N:\web2py\gluon\sqlhtml.py, line 2108, in grid
value = field.formatter(value)
  File N:\web2py\gluon\dal.py, line 8605, in formatter
value = item.formatter(value)
  File N:\web2py\gluon\validators.py, line 2529, in formatter
return self.other.formatter(value)
  File N:\web2py\gluon\validators.py, line 2220, in formatter
year = value.year
AttributeError: 'datetime.timedelta' object has no attribute 'year'


Are we no longer supposed to use lambda functions to reformat our tables 
when grid is involved?

-- 





[web2py] Re: unable to submit auth forms

2012-10-18 Thread Rohan Malhotra

On Thursday, 18 October 2012 02:51:52 UTC+5:30, Massimo Di Pierro wrote:

 What is the code? Is this something that worked before? using a custom 
 form?

 On Wednesday, 17 October 2012 09:17:57 UTC-5, Rohan Malhotra wrote:

 Version 2.1.1 (2012-10-15 12:44:40) stable

 Hi,

 I am not able to submit an auth form. I am using default auth code. On 
 submitting the form, password is shown as invalid and 'enter from 0 to 
 512 characters' error is thrown. Input

 td class=w2p_fw
 input class=password invalidinput id=auth_user_password 
 name=password type=password 
 value=passwod_value_entered_before_submitting_form
 div class=error_wrapper
 div class=error id=password__error style=display: block;enter 
 from 0 to 512 characters/div
 /div
 /td


 Please advice.

 Thanks


It is default code copied from scaffolding app with no customization.

I downgraded web2py to 1.99 version and things started to work again 
without any change in code.

-Ro 

-- 





[web2py] Loading modules fails - web2py 2.1.1(and earlier) / python 2.7.1 / Mac OS X

2012-10-18 Thread Luciano Laporta Podazza
Hello, first of all thank you Massimo and you people for this awesome 
framework! I'm in love with it! :D

I've tried to load some facebook modules and none of them works, at least 
on Mac OS.

This is what I did:

1. Get facebook api from one of these repos:
https://github.com/sciyoshi/pyfacebook/
https://github.com/jgorset/facepy
https://github.com/pythonforfacebook/facebook-sdk

2. Copy them on modules/ like this:
modules/facebook-api-folder/files.py

3. Load it from the controller, e.g. facepy module:
def index():
from facepy import graph_api

It doesn't matter what I try, I always get some errors:
- type 'exceptions.ImportError' No module named facepy (or other module's 
name)
- With facebook-sdk it says that simplejson can't be loaded 'cause it 
doesn't exists(and it exists and works!)
- it doesn't matter the way I put the module folder under modules/, for 
example modules/facebookmodule/sub-dir/module.py and then from 
facebookmodule.subdir import module. I always get the error that the module 
does not exists.
- I even tried copying the module under site-packages and it seems to load 
the module(I get no errors about it) but then I get the error that 
simplejson doesn't exists(and this is not true).

A friend of mine tried this on GNU/Linux and modules works perfectly, so it 
seems the issue is related with Mac OS.

Any ideas?. please note that I'm a newbie with python and web2py.

LOT of thanks in advance :)

-- 





[web2py] Form, with Dropbox and distinct values from db.

2012-10-18 Thread Jason Jeremias
So I'm trying out Web2py, I'm a complet newbie.  I've been using python to 
write CGI for years, I have python cgi that I use to display data from 
mysql db.  Its pretty simple and I thought I'd trying to recreate it using 
web2py.   Basically its a simple html form that has a drop box and a submit 
button.  The drop box is filled with mac addresses from a database.  So 
basically you select the mac address, hit submit and it brings back all the 
data in the db related to that mac address.  

My current cgi program uses a simple function to grab the distinct mac 
addresses from the db and put them in to a dropdown.

def PrintSelectMAC():
  db = MySQLdb.connect(localhost,myuser,mypass,wifi_usage)
  cursor = db.cursor()
  sql = 'SELECT DISTINCT(mac_addr) from wifi_usage'
  cursor.execute(sql)
  data = cursor.fetchall()

  print (bSelect MAC Addresses:/BBR \n)
  print (SELECT NAME=\mac_addr\)

  for row in sorted(data):
macaddr = row[0]
print (OPTION VALUE=\%s\%s) %(macaddr, macaddr)

  print (/SELECT)


I'm trying to get just this far with Web2py and I'm running into a learning 
curve or something.  Here's what I've done so far..

in my Model (db.py) I have added..

db = DAL(mysql://myuser:mypass@localhost/wifi_usage)
db.define_table('wifiusage', 
Field('u_date', 'date'),
Field('account_id', 'string', length=16),
Field('mac_addr', 'string', length=20),
Field('upstream', 'integer'),
Field('downstream', 'integer'),
Field('total', 'integer'),
Field('location', 'string'),
Field('package', 'string')
   )

So this worked well.  I then populated this database with data.

in my controller (index) I added:

def get_macaddr():
# Grab distinct MAC addresses from DB
macaddr = db(db.wifiusage).select(db.wifiusage.mac_addr, 
distinct=True)   

form = SQLFORM.factory(
  Field('macaddr', label='Select a MAC Address', 
requires=IS_IN_SET(macaddr)))

return dict(form=form)


I created a get_macaddr.html view.  It looks like this.
{{extend 'layout.html'}}
h1This is the get_macaddr.html template/h1
{{=form}


Here's the issue.  My Form dropdown box. contains entries that look like 
this.

Row {'mac_addr': '0123456789ab'}

What I want is it to contain just the macaddress ''0123456789ab' for the 
value

I have to admit the syntax is messing with me.  I'm sure I'm doing 
something silly, Perhaps I've been doing cgi to long.  I want to stick with 
it and learn web2py, what am I doing wrong?

Thanks

-- 





Re: [web2py] buttons=['submit','reset','cancel'] and INPUT helpers

2012-10-18 Thread Richard Vézina
Hello Annet,

Don't know if it relevant, but Massimo add this recently :

https://groups.google.com/d/msg/web2py/X5RCYHpckh0/Ut3ijuxiLqAJ

from = SQLFORM(...)
form.add_button(Cancel,URL(r=request,f='new_contact'))

You can do that to : form.add_button(T('Cancel'),
javascript:void(history.go(-1)))
It will go back of one page, not very good if the user come from the login
page thougth, to be consider if the form is present on the index page for
example, considering user is redirect to index after logon.

Richard

On Sun, Sep 2, 2012 at 3:01 AM, Annet anneve...@googlemail.com wrote:

 The signatyre for the SQLFORM constructor has an attribute buttons =
 ['submit']

 At the moment I add a cancel and/or reset button to my forms this way:

 form=SQLFORM.factory(..)
 addReserButton(form)
 addCancelButton(form)


 def addCancelButton(form):

 form[0][-1][1].append(INPUT(_type=button,_value=Annuleer,_onclick=javascript:history.go(-1);))
 return None

 def addResetButton(form):
 form[0][-1][1].append(INPUT(_type=reset,_value=Reset))
 return None

 Is it possible to replace this with something like:

 form=SQLFORM.factory(

 Field('subClass',...,formstyle='divs',buttons=['submit','reset','cancel'])

 ... and replace the functions with a reset and cancel INPUT helper. Where
 would the definition of the INPUT helpers go in my code?


 Kind regards,

 Annet

  --





-- 





[web2py] Re: Cron task help

2012-10-18 Thread Massimo Di Pierro
Since web2py 2.1. you need -Y to enable cron, it is now disabled by default.

On Thursday, 18 October 2012 12:18:07 UTC-5, Mike Anson wrote:

 I would like to have posted my question right here but with I was unable 
 to post it perhaps due to character count of the question being +800

 So I posted it on 
 Stackoverflowhttp://stackoverflow.com/questions/12960138/web2py-cron-task-debug
 .

 Any help would be greatly appreciated.


-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread Massimo Di Pierro
Is it possible you have two db = DAL(...) in your code (perhaps in 
different model files)?

On Thursday, 18 October 2012 12:36:00 UTC-5, mikech wrote:

 Hi Bill don't want to take up much of your time.  I've verified that the 
 auth_* tables are defined using a sqllite2009 pro.  I've included a screen 
 shot attached.  And I've also included a screenshot of the appadmin page 
 which shows just 2 files image and comment.   This is consistent with the 
 image in the book by the way. 



 On Thursday, October 18, 2012 9:21:39 AM UTC-7, mikech wrote:

 Thanks Bill.
 What I'm trying to find out is how do I access the tables involved with 
 security.  Do I need to create views, or is there already some associated 
 with the appadmin?

 On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial 
 it mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members 
 of the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just shows 
 the two tables of the application - image and comment.



-- 





[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread Massimo Di Pierro
Can I see your controller?

On Thursday, 18 October 2012 12:11:21 UTC-5, villas wrote:

 I want to read the content of a wiki page into my view:  
 views/mycontroller/mypage.html
 using:  {{=auth.wiki(my-wiki-slug') }}

 auth.wiki is on a function in:   controllers/default.py

 If the wiki page is found then it works OK.
 If the wiki page is not found,  then it redirects to:   
 mycontroller/mypage/_create/my-wiki-slug

 This redirect does not go to the correct place. 



-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X
Let me try to keep it simple .. because I don't want to pollute this thread 
with many tables and fields

OK ...

initially everything was working OK !
I had 3 models files like the followings :
0.py, db.py  menu.py

in 0.dy I had :
from gluon.storage import Storage
settings = Storage()

settings.migrate = True
settings.title = 'SoccerApp'
settings.author = 'Don Clermont'
settings.author_email = 'em...@adress.com'
settings.database_uri = 'mysql://msqldbuser:password@localhost:3306/dbname'
settings.email_server = 'localhost'
settings.email_sender = 'em...@adress.com'
settings.email_login = 'em...@adress.com'
settings.login_method = 'local'

in db.py I had many tables and variables defined ( I will try to keep it 
short ):
# -*- coding: utf-8 -*-
T.current_languages=['en','en-us']
if request.vars._language: session._language=request.vars._language
if session._language: T.force(session._language)


if not request.env.web2py_runtime_gae:
db = DAL('mysql://w2pdbuser:letme1n@localhost:3306/w2pspdb202')
else:
db = DAL('google:datastore')
session.connect(request, response, db = db)
   
response.generic_patterns = ['*'] if request.is_local else []

#

from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
auth = Auth(db, hmac_key=Auth.get_or_create_key())
crud, service, plugins = Crud(db), Service(), PluginManager()

user_lang =('French','English','Other')

Canada_Provinces = ('AB - Alberta',T('BC - British Columbia'),'MB - 
Manitoba',T('NB - New Brunswick'),T('NL - Newfoundland and Labrador'),T('NS 
- Nova Scotia'),T('NT - Northwest Territories'),'NU - Nunavut','ON - 
Ontario',T('PE - Prince Edward Island'),'QC - Quebec','SK - 
Saskatchewan','YT - Yukon')

group_type =(T('League'),T('Club, School or Team 
Promoter'),T('Player'),T('Coach'),T('Referee'),T('Parent or Supporting 
guardian'),T('Soccer worker, Volunteer or Fan'),T('OTHER (ex:Business, 
Health pro, Agent or Misc. other)'))

defaultfoto = ( 'defaultuser.png','defaulthumb.png')

defaultuserpics =   { 0:IMG(_src=URL('static','images/'+ 
defaultfoto[0])), 
  1:DIV(_class='previewpic')}   

import re
from gluon.validators import Validator
class IS_CANADIAN_ZIP(Validator):
regex = re.compile('^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} 
*\d{1}[A-Z]{1}\d{1}$')
def __init__(self,error_message='Invalid!'):
 self.error_message = error_message
def __call__(self,value):
 value = str(value).upper()
 if self.regex.match(value): return value, None
 else: return value, self.error_message

from plugin_hradio_widget import hradio_widget
import os 

db.define_table('auth_user',
Field('first_name', type='string',length=50,
  label=T('First Name')),
Field('last_name', type='string',length=50,
  label=T('Last Name')),
Field('email', type='string',unique=True,
  label=T('E-mail')),
Field('email_check', 
type='string',requires=IS_EQUAL_TO(request.vars.email),
  label=T('Re-enter E-mail')),
Field('password', type='password',
  readable=False,
  label=T('Password')),
Field('sex',requires=IS_IN_SET((T('male'),T('female'))),label=T('My Sex 
is')),
Field('usertype',requires=IS_IN_SET((0,1,2,3,4,5,6,7),group_type),
  label=T('I am a')),
Field('birth_date','date',label=T('Birth Date')),
Field('Iagreeto','boolean',requires=IS_NOT_EMPTY(error_message='you 
must agree to this !'),
label=T('I agree to the Terms of service, Privacy policy, and 
Codes of conduct.')),

Field('full_profile','boolean',default=False,writable=False,readable=False),   

Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
Field('registration_key',default='',
  writable=False,readable=False),
Field('reset_password_key',default='',
  writable=False,readable=False), 
Field('user_adress', type='string',length=100,default=' ',
  label=T('Street address'),writable=True,readable=True),
Field('user_city', type='string',length=30,default=' ',
  label=T('City'),writable=True,readable=True),
Field('user_prov',default=' ',label=T('Province')),
Field('user_postalcode',default=' ',label=T('Zip / Postalcode')),

Field('Country',default='Canada',writable=False,readable=True,comment=T('default
 
is Canada for now !'),label=T('Country of Residence')),
Field('user_speaks',label=T('I speak'),writable=True,readable=True, 
  requires=IS_IN_SET((0,1,2),user_lang, multiple=True), 
widget=SQLFORM.widgets.checkboxes.widget,default='0'),
Field('more_Lang',label=T('Specify other Languages '),comment=T('Please 
List other 

Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Marin Pranjić


  If MySQL reports an error number 1005 from a CREATE TABLE statement, and 
 the error message refers to error 150, table creation failed because a 
 foreign key constraint was not correctly formed. Similarly, if an ALTER 
 TABLE fails and it refers to error 150, that means a foreign key 
 definition would be incorrectly formed for the altered table.  
 (source)http://dev.mysql.com/doc/refman/5.1/en/innodb-foreign-key-constraints.html
  


Error suggests the problem with table team. It creates references to:

   - auth_user
   - team_owners
   - soc_league
   - the_player
   - the_coach
   
Since MySQL is trying to create table, it seems that you have deleted all 
the tables from database.
I guess you're trying to define a table with a reference (FK) to a table 
that is not yet defined.

Where are soc_league and team_owners defined?
Did you try running everything in db.py and after the tables are defined, 
moving some of them to conditional models?


And answer to your question.
On each request, models from these directories are executed:

   - models/*
   - models/controller_name/*
   - models/controller_name/function_name/*
   


-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Niphlod
Let's make it one step futher in being explicit in explanations. 
There are no much specifics to discuss about conditional models because 
it's easy to understand the flow logic.

assuming you have

controllers/default.py
controllers/test.py
controllers/foo.py
controllers/bar.py
models/db.py
models/default/model_one.py
models/default/model_two.py
models/foo/model_one.py

You have the following execution scheme:
- if /app/default/somefunction is called models executed before 
controllers/default.py are : models/db.py -- models/default/model_one.py 
-- models/default/models_two.py
- if /app/test/somefunction is called, only models/db.py will be executed
- if /app/foo/somefunction is called, then models/db.py -- 
models/foo/model_one.py

What is that you are missing ?

-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread mikech
I uninstalled the images app and reinstalled it using the wizard rather 
than the new simple app option.  The auth tables show up now.
So, it depends on how the app is setup
Mike

On Thursday, October 18, 2012 10:59:02 AM UTC-7, Massimo Di Pierro wrote:

 Is it possible you have two db = DAL(...) in your code (perhaps in 
 different model files)?

 On Thursday, 18 October 2012 12:36:00 UTC-5, mikech wrote:

 Hi Bill don't want to take up much of your time.  I've verified that the 
 auth_* tables are defined using a sqllite2009 pro.  I've included a screen 
 shot attached.  And I've also included a screenshot of the appadmin page 
 which shows just 2 files image and comment.   This is consistent with the 
 image in the book by the way. 



 On Thursday, October 18, 2012 9:21:39 AM UTC-7, mikech wrote:

 Thanks Bill.
 What I'm trying to find out is how do I access the tables involved with 
 security.  Do I need to create views, or is there already some associated 
 with the appadmin?

 On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial 
 it mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members 
 of the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just 
 shows the two tables of the application - image and comment.



-- 





[web2py] Re: Problems compiling

2012-10-18 Thread rick817
Hi all,

I've finally had the chance to track down the source of the problem.

The simple explanation is that gluon/compileapp.py attempts to compile all 
the files in the
project's view directory regardless of whether they are:

 a) .html files
 b) part of the current project

I occasionally like to leave copies of heavily modified source files lying 
around
'just in case'. It seems that the missing pass error referred to one or 
more of these 'fragments'.
I spent a not inconsiderable amount of time carefully checking all of my 
views before I realised
what was going on.

Even if the faulty file is part of the project no useful error message 
(that allows the source to
be identified or even narrowed down) is output by the compiler.

As a temporary workaround adding the line:

print file

or similar immediately prior to line 440 in compileapp.py helps to identify 
the problem file in such situations.

I've not looked into it but I suspect similar problems might occur when the 
controllers and models directories
are processed by the compiler.

Hope this helps any one else who runs into similar problems.

Rick.

-- 





[web2py] Is this possible?

2012-10-18 Thread Richard
Hello,

Is it possible to do that? 
db.define_table(...
Field(...
label=T(dblabels_en[db.table._tablename+db.table.field.name])

I can do 
db.define_table(...)
db.table.field.lable=T(dblabels_en[db.table._tablename+db.table.field.name])

Inside table model definition table is not yet define then I can refer to 
it.

I try with lambda with no succes.

Do you see a way to refer to the db.table._tablename in order to make it 
execute only once that the model is defined?

Thanks

Richard

-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Don_X


Thank you gentlemen for your input !

Niphlod .. i understood the flow logic from the start .. even before I 
tried it, that is why I tried it !

 ... what kept my attention is the response above yours !

The flow logic was easy to comprehend ! ... but :

It seems From Marin's answer, the tables had to be created before the 
shuffle  ( i.e moving the additional db.define_table  to subdirectories 
of MODELS )  which I did not do ... I deleted the db and created a new db 
with no tables !

and .. if I have tables in that shufles that are referencing other tables, 
the table refered to have to exist in the db .. ! ... so the lesson learned 
here is :  to go back to my previous flow  ..let the app run at least once 
... so the db and all the necessary tables get created .. and only then .. 
I can do on and seperate my db.py file into 4 different files under 4 
different sub directories with their related controller actions defined ! 
...

there is no where that was explained that way ...  the flow logic was 
properly explain in different threads here .. but did not mentionned that 
the tables had to exist before  ! ... i thought the  tables would have been 
created just like before when everything was in the main MODELS directory 
under one file ( db.py )

OK .. let me do some more cooking  and see ! ...

thanks .. and thank you Marin !

Don

-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Richard Vézina
I think you just need to make sure that each model you refer get defined
before it get refer. Since web2py parse model files in alphanumeric you
have to make sure the model file that contain your table definition is at
the right place. I am not sure how web2py parse the sub-folder, it may
parse all the models/files.py and then parse the sub-folder in alphanumeric
order and so on. But as I said I am not sure about that, more reading or
little dummy test could let you figure how web2py parse the models/ folder
and sub-folders.

Richard

On Thu, Oct 18, 2012 at 4:12 PM, Don_X don.clerm...@gmail.com wrote:



 Thank you gentlemen for your input !

 Niphlod .. i understood the flow logic from the start .. even before I
 tried it, that is why I tried it !

  ... what kept my attention is the response above yours !

 The flow logic was easy to comprehend ! ... but :

 It seems From Marin's answer, the tables had to be created before the
 shuffle  ( i.e moving the additional db.define_table  to subdirectories
 of MODELS )  which I did not do ... I deleted the db and created a new db
 with no tables !

 and .. if I have tables in that shufles that are referencing other tables,
 the table refered to have to exist in the db .. ! ... so the lesson learned
 here is :  to go back to my previous flow  ..let the app run at least once
 ... so the db and all the necessary tables get created .. and only then ..
 I can do on and seperate my db.py file into 4 different files under 4
 different sub directories with their related controller actions defined !
 ...

 there is no where that was explained that way ...  the flow logic was
 properly explain in different threads here .. but did not mentionned that
 the tables had to exist before  ! ... i thought the  tables would have been
 created just like before when everything was in the main MODELS directory
 under one file ( db.py )

 OK .. let me do some more cooking  and see ! ...

 thanks .. and thank you Marin !

 Don

 --





-- 





Re: [web2py] I am looking for specifics : how to db.define_table in sub directories in the MODELS directory !

2012-10-18 Thread Niphlod
so you were missing the table logic creation.
There are two methods:
db.define_table('test1',
  Field('foo')
)
db.define_table('test2',
  Field('bar', db.test1)
)

or

db.define_table('test2',
 Field('bar', 'reference test1')
)

So. 1st method needs db.test1 defined in the environment. If you move test1 
definition in another model, test2 'bar' column can't know what db.test1 
is, so it fails (python issue, it can't find the variable referenced as 
db.test1). It will always fail if db.test1 isn't defined (read, the model 
it's written into is not executed) when test2 definition is called.

You're using the 2nd method (GOOD, it's the recommended one). If you move 
test1 definition in another model, as soon as test2 definition is reached, 
web2py will try to create the test2 table, and then fires the command to 
create the reference in the db between test1.id and test2.bar . This is 
done without knowing what db.table1 is, so it can be safely used in this 
kind of environments.

But, if your table1 isn't in the db (I'm NOT talking about the python side, 
but the database side), then the command issued by web2py fails, and you 
get that traceback.

So, 'reference something' allows you to have working references (even 
circular ones, that would be impossible with the 1st notation), as long as 
the table you are referencing exists yet in the DB, shortcutting the limits 
of the python interpreter. 

Clearer ?

-- 





Re: [web2py] Re: tags and speed

2012-10-18 Thread andrej burja
hi

for all possible tags i use:
all_tags = db().select(db.t_tag.f_name,distinct=True)

in database i have first table games with filds title, age, group, 
instruction
and i have also two other tables: tags and equipment
and when i show the data, i'm using Datatables (with general search and 
searching in columns). 
in Datatables ( plug-in for the jQuery http://www.jquery.com/) i have 
columns: title, age, group, instruction, tags, equipment. 

id  | title | age | group | instruction | tags | equipment
--- 
1  ||   |  | | |  

and for Datatables (and efficient search) i have to get all the games 
(1000) with all attributes including equipment and tags for every game. and 
there i have 1 select for all games and 1000 selects for tags (for every 
game one select) and 1000 selects for equipment (for every game one) 

if it possible to make this faster with joins, how?
do you recomend to chache this select?
do you recomend going back to list:string for tags and equipment. what is 
the advantage of example in the book (what i'm using, tags in different 
table) over tags in  list:string field

andrej

On Thursday, October 18, 2012 2:20:21 PM UTC+2, Massimo Di Pierro wrote:

 I understand you want to select all possible tags. I suggest you create a 
 table that stores all posible tags and when a new tag is created you insert 
 a new record there. You can get all possible tags with a single select from 
 this table. You can also cache that select.


 On Thursday, 18 October 2012 02:56:17 UTC-5, andrej burja wrote:

 hi

 system: it is on linode 512, os ubuntu, server apache, database postgresql
 my initial design was using list:string, but than i saw example in the 
 book (Application-Development-Cookbook) and i thought this is better
 purpose of that code: user testing reveals, that the best way to search 
 the data is with Datatables (+individual column filtering). i have 1000 
 games with different attributes: name, for what age, how big the group can 
 be, equipment, tags, instructions. I have to put all the attributes in 
 table.
  .. and there is another problem: tags and equipment have both the same 
 implementation - so actualy i do 2000 selects :( 

 andrej

 On Thursday, October 18, 2012 4:09:59 AM UTC+2, rochacbruno wrote:

 I am using list:string for tags and it is working very well for my 
 needs. 



-- 





Re: [web2py] Is this possible?

2012-10-18 Thread Niphlod
you are asking to python to evaluate a variable that doesn't exists. 
It seems that you know the tablename and fields in advance (because 
dblabels_en is somewhat filled already) so why can't you just

tablename = 'test1'
db.define_table(tablename,
Field('foo', label=T(dblabels_en[%s_foo % tablename])))

?

On Thursday, October 18, 2012 9:57:09 PM UTC+2, Richard wrote:

 Hello,

 Is it possible to do that? 
 db.define_table(...
 Field(...
 label=T(dblabels_en[db.table._tablename+db.table.field.name])

 I can do 
 db.define_table(...)
 db.table.field.lable=T(dblabels_en[db.table._tablename+db.table.field.name
 ])

 Inside table model definition table is not yet define then I can refer 
 to it.

 I try with lambda with no succes.

 Do you see a way to refer to the db.table._tablename in order to make it 
 execute only once that the model is defined?

 Thanks

 Richard


-- 





[web2py] Re: Problems compiling

2012-10-18 Thread Niphlod
You're right, but you're asking that web2py knows in advance all the 
possible combinations of your view fragments your app uses and what your 
app doesn't.
I'd say we can only make the error message clearer, but we can't know what 
is to be considered trash or not in your views folder

On Thursday, October 18, 2012 9:39:29 PM UTC+2, rick817 wrote:

 Hi all,

 I've finally had the chance to track down the source of the problem.

 The simple explanation is that gluon/compileapp.py attempts to compile all 
 the files in the
 project's view directory regardless of whether they are:

  a) .html files
  b) part of the current project

 I occasionally like to leave copies of heavily modified source files lying 
 around
 'just in case'. It seems that the missing pass error referred to one or 
 more of these 'fragments'.
 I spent a not inconsiderable amount of time carefully checking all of my 
 views before I realised
 what was going on.

 Even if the faulty file is part of the project no useful error message 
 (that allows the source to
 be identified or even narrowed down) is output by the compiler.

 As a temporary workaround adding the line:

 print file

 or similar immediately prior to line 440 in compileapp.py helps to 
 identify the problem file in such situations.

 I've not looked into it but I suspect similar problems might occur when 
 the controllers and models directories
 are processed by the compiler.

 Hope this helps any one else who runs into similar problems.

 Rick.


-- 





[web2py] Re: Problems compiling

2012-10-18 Thread Niphlod
If Massimo agrees, I opened an issue an posted a patch here 
http://code.google.com/p/web2py/issues/detail?id=1101

-- 





Re: [web2py] Is this possible?

2012-10-18 Thread Richard Vézina
I still gettype 'exceptions.AttributeError' 'DAL' object has no attribute
'table1'

You right that I didn't need call db.table._tablename and
db.table.field.name... I was just trying something else before then I
forget I didn't need to call those attributes.

Anyway, I think it is not possible since model is not yet define.

FYI dblables_en is a dict like this one {'table1field1':
'field1LableStoreInDb'}

Thanks.

Richard

On Thu, Oct 18, 2012 at 4:40 PM, Niphlod niph...@gmail.com wrote:

 you are asking to python to evaluate a variable that doesn't exists.
 It seems that you know the tablename and fields in advance (because
 dblabels_en is somewhat filled already) so why can't you just

 tablename = 'test1'
 db.define_table(tablename,
 Field('foo', label=T(dblabels_en[%s_foo % tablename])))

 ?


 On Thursday, October 18, 2012 9:57:09 PM UTC+2, Richard wrote:

 Hello,

 Is it possible to do that?
 db.define_table(...
 Field(...
 label=T(dblabels_en[db.table._**tablename+db.table.field.name]**)

 I can do
 db.define_table(...)
 db.table.field.lable=T(**dblabels_en[db.table._**tablename+
 db.table.field.name]**)

 Inside table model definition table is not yet define then I can refer
 to it.

 I try with lambda with no succes.

 Do you see a way to refer to the db.table._tablename in order to make it
 execute only once that the model is defined?

 Thanks

 Richard

  --





-- 





[web2py] Re: cron not work in 2.0.9

2012-10-18 Thread Márcio
I upgraded to version 2.1.1 and still did not work. Any idea?
In version 1.99.7 works perfect.

Em quinta-feira, 11 de outubro de 2012 18h48min21s UTC-3, Massimo Di Pierro 
escreveu:

 Sorry this took forever. This is now fixed.

 On Tuesday, 2 October 2012 21:51:46 UTC-5, Márcio wrote:

 Massimo, help please.



-- 





[web2py] is there a way to do something like that (tooltip and label)

2012-10-18 Thread Richard
Hello,

I would like to append a tooltip beside labels, something like that :

db.table.field.label =  T(dblabels[concat]), A(I(_class='icon-info-sign'), 
_href=##, _id=example1, _rel=popover, **{'_data-content': 'Help 
comment here!', '_data-original-title': 'Help comment title...'})

Not working... It return a tuple, the other test I did, I could only get a 
text out of that.

I would avoid to have to manipulate form once created to insert those 
tooltip...

Anyone have a idea?

Thanks

Richard


-- 





Re: [web2py] is there a way to do something like that (tooltip and label)

2012-10-18 Thread Bruno Rocha
Try this:

db.table.field.label =  *CAT(*T(dblabels[concat]),
A(I(_class='icon-info-sign'), _href=##, _id=example1, _rel=popover,
**{'_data-content': 'Help comment here!', '_data-original-title': 'Help
comment title...'})*)*

-- 





[web2py] Re: Problems compiling

2012-10-18 Thread rick817


On Thursday, October 18, 2012 10:06:03 PM UTC+1, Niphlod wrote:

 If Massimo agrees, I opened an issue an posted a patch here 
 http://code.google.com/p/web2py/issues/detail?id=1101


Thanks for opening the issue Niphlod. While I realise that not all files 
defining views will end in .html I think it is not
unreasonable that files ending in .bak or ~ be excluded from compilation. 
The web2py IDE already seems to know
that such files should be ignored since they are not displayed within the 
IDE.

Rick



-- 





Re: [web2py] Is this possible?

2012-10-18 Thread Niphlod
you are calling db.table1 somewhere. In my code there is no db.table1 at 
alljust tried, works. Readable example

tablename = 'test1'
labels = dict(test1_foo='test1label')
db.define_table(tablename,
Field('foo', label=labels[%s_foo % tablename])
)

BTW: you'd be better off separating table name and field name in your 
labels dict (or even, structure it as 
dict(table=tablename,fields=dict(fieldname=label))). 
If you have a table named *foo* with a field *bar* and a table *foob* with 
a column *ar* you are going to display the same label for both ;-)

On Thursday, October 18, 2012 11:09:56 PM UTC+2, Richard wrote:

 I still get type 'exceptions.AttributeError' 'DAL' object has no 
 attribute 'table1' 

 You right that I didn't need call db.table._tablename and 
 db.table.field.name... I was just trying something else before then I 
 forget I didn't need to call those attributes.

 Anyway, I think it is not possible since model is not yet define.

 FYI dblables_en is a dict like this one {'table1field1': 
 'field1LableStoreInDb'}

 Thanks.

 Richard

 On Thu, Oct 18, 2012 at 4:40 PM, Niphlod nip...@gmail.com 
 javascript:wrote:

 you are asking to python to evaluate a variable that doesn't exists. 
 It seems that you know the tablename and fields in advance (because 
 dblabels_en is somewhat filled already) so why can't you just

 tablename = 'test1'
 db.define_table(tablename,
 Field('foo', label=T(dblabels_en[%s_foo % tablename])))

 ?


 On Thursday, October 18, 2012 9:57:09 PM UTC+2, Richard wrote:

 Hello,

 Is it possible to do that? 
 db.define_table(...
 Field(...
 label=T(dblabels_en[db.table._**tablename+db.table.field.name]**)

 I can do 
 db.define_table(...)
 db.table.field.lable=T(**dblabels_en[db.table._**tablename+
 db.table.field.name]**)

 Inside table model definition table is not yet define then I can refer 
 to it.

 I try with lambda with no succes.

 Do you see a way to refer to the db.table._tablename in order to make it 
 execute only once that the model is defined?

 Thanks

 Richard

  -- 
  
  
  




-- 





[web2py] auth.wiki documentation?

2012-10-18 Thread HittingSmoke
I'm trying to build a simple blog with web2py. I see auth.wiki and 
plugin_wiki are two different entities which as far as I can tell fulfill 
much the same functions.

Is there any advanced documentation on auth.wiki similar to the plugin_wiki 
chapter in the book?

-- 





[web2py] Subdomain routing with plugin_wiki

2012-10-18 Thread HittingSmoke
I tried installing plugin_wiki for a simple blog app and I can't get it to 
work with subdomain routing.

I had routes.py setup to direct blog.domain.com to my app 'blog'. When I 
installed plugin_wiki in the blog app I couldn't access it though. Whenever 
I tried to load blog.domain.com/plugin_wiki/index or 
domain.com/blog/plugin_wiki/index I would get an invalid function error as 
web2py would try to load domain.com/blog/default/plugin_wiki/index instead 
of the plugin controller.

I've since tried to move on to an auth.wiki setup but with such a lack of 
documentation* *I'm having problems as I'm still learning.

Is there something I need to do to get plugin_wiki to work with domain 
routing?

-- 





Re: [web2py] Re: tags and speed

2012-10-18 Thread Niphlod
old mean bad thing about normalized vs denormalized model.
Don't know what you read in the cookbok, but here's the thing.
You have a game pacman that is tagged as arcade, and a game invaders tagged 
as horror

First things first: you may want to change horror to needs parent 
around later in the future. That's why you may want to create an external 
tags table and reference it in your games one.
tags table
1 arcade
2 horror

game_name tags
pacman   1
invaders  2

To display
pacman arcade
invaders horror
you just need a simple join. Changing record 2 of the tags table allows you 
to have
pacman arcade
invaders needs parents around

Next problem on the line: you want multiple tags for a single game 
(invaders needs both arcade and horror tags). 
Welcome to normalization hell. Books have been written about it in the last 
60-70 years, with terms like 3NF and Cardinality all around ^_^

Let's take this by examples

1) you change the tags table like this
id tag_name game_id
1 arcade 1
1 arcade 2
2 horror 2
getting tags for a single game is fast, change horror to needs parents 
around is fast, getting all possible tags is enough fast (depending on the 
number of rows of the tags table)
but
fetch the right tags for every game can be slow

2) you create a games table like this 
id game_name tags
1 pacman |arcade|
2 invaders |arcade|horror|
getting tags for a single game is fast, updating a tag for a game is quite 
fast
but
changing all horror to needs parents around can be fast only if done 
outside web2py with a manual replace, getting all possible tags can be slow

3) you create a games table like this
id game_name tags_id
1 pacman |1|
2 invaders |1|2|
getting tags for a single game is fast, updating a tag for a game is quite 
fast, changing horrors is fast
but
changing all horror to needs parents around can be fast only if done 
outside web2py with a manual replace, getting all possible tags can be slow

So, with no need to change tag names from horror to needs parents 
around, I'd say the right way for displaying your table is 2) 
(list:string), else 3) (list:reference). 
If you need to suggest previously entered tags (i.e. you don't want to 
end having arcade, arcady, arcadian, 'rcade spat all around), I'd 
still go for 2) + one separate table (or a cached list) holding all 
previously entered tags, just to speedup the suggestion phase (hoping 
users won't screw up).
 
Method 1) is faster only when:
- tags are more than the games
- cleaning normalization logics are heavy
- you need to update tag names often
- the only need is displaying tags for a single game (direct query on a 
single table, the tags one)
- you need to compute something like how many times the arcade tag is 
applied to all my games (i.e. for a tag cloud)

There are several other methods, and all of them in the end do the job. 
You just need to see what are your requirements and choose carefully. Your 
agenda is:
- spend the less time possible with queries you have to invoke often
- pay the price of your model in high computations for other things (or, 
let's save the results of those computations externally once every hour)
 


-- 





[web2py] Re: How to access the auth tables in appadmin?

2012-10-18 Thread Massimo Di Pierro
I think you simply had some additional model files that override the db 
variable.

On Thursday, 18 October 2012 14:36:15 UTC-5, mikech wrote:

 I uninstalled the images app and reinstalled it using the wizard rather 
 than the new simple app option.  The auth tables show up now.
 So, it depends on how the app is setup
 Mike

 On Thursday, October 18, 2012 10:59:02 AM UTC-7, Massimo Di Pierro wrote:

 Is it possible you have two db = DAL(...) in your code (perhaps in 
 different model files)?

 On Thursday, 18 October 2012 12:36:00 UTC-5, mikech wrote:

 Hi Bill don't want to take up much of your time.  I've verified that the 
 auth_* tables are defined using a sqllite2009 pro.  I've included a screen 
 shot attached.  And I've also included a screenshot of the appadmin page 
 which shows just 2 files image and comment.   This is consistent with the 
 image in the book by the way. 



 On Thursday, October 18, 2012 9:21:39 AM UTC-7, mikech wrote:

 Thanks Bill.
 What I'm trying to find out is how do I access the tables involved with 
 security.  Do I need to create views, or is there already some associated 
 with the appadmin?

 On Wednesday, October 17, 2012 7:55:02 PM UTC-7, Bill Thayer wrote:

 Try this:
 In db.py:
 from gluon.tools import Auth, Crud, Service, PluginManager, prettydate
 auth = Auth(db)
 crud, service, plugins = Crud(db), Service(), PluginManager()

 auth.define_tables(username=True) # arg makes it so you can use a 
 username instead of email to login



 On Wednesday, October 17, 2012 6:20:48 PM UTC-5, mikech wrote:

 I'm working thru the book again, and when I get to the image tutorial 
 it mentions adding a manager group to the auth tables in appadmin: 

 Using appadmin create a group manager and make some users members 
 of the group. They will not be able to access  

 I cannot find where this is, when I bring up the appadmin it just 
 shows the two tables of the application - image and comment.



-- 





[web2py] Re: Auth Wiki functionality?

2012-10-18 Thread villas
Hi Bill

If you are considering creating table relationships with auth.wiki,  I 
think you should design and implement your own ideas.  In the end you will 
not have spent any more time,  but the difference is that you will 
thoroughly understand all your own code and be able to fix and extend it 
with new features. I mean you shouldn't be compromising your design to 
accommodate auth.wiki,  for that would be the wrong way around.. 

Kind regards,  D


On Wednesday, October 17, 2012 1:20:35 AM UTC+1, Bill Thayer wrote:

 Hello everyone,

 Thanks to Allen, Villas, of course Massimo among a few others I have 
 web2py auth.wiki with Oracle storing the media blobs and all the pages.  I 
 believe I can use the wiki features in a structure way to improv 
 productivity and cross department functionality in my workplace.

 Now what in the heck to do with it?

 The app wizard created a bunch of controllers like
 @auth.requires_login()
 def part_manage():
 form = SQLFORM.smartgrid(db.part)
 return locals()



 but if I add
 @{component:default/part_manage}
 to my markmin I get a page with my SQLFORM.smartgrid inside a page so I 
 get two footers and two headers. Not to mention the add and edit pages 
 should really be a wiki page with my table attributes added.

 Looks like auth-wiki is for creating web pages but what caught my 
 attention was the media and tagging capability built in so I don't have to 
 write my own app to do what's already there. However, I have a bunch of 
 tables (parts, sub parts, orders, samples, testing, analyses for tested 
 samples, etc...) defined for my application and  basically 75% of the items 
 have attachments, images, files, user references and tags too. 

 Unless someone says different I guess I should be adding a wiki_page 
 column to all of my tables? Then create separate edit/show/create 
 controllers that generate the proper...slug...and return a wiki page? 
 That shouldn't break my relationships I don't think.

 Just kind of wondering if there's already a know technique for my 
 application that you know of?

 Regards,
 Bill


-- 





[web2py] Re: cron not work in 2.0.9

2012-10-18 Thread Massimo Di Pierro
In 2.1.1 you need to use the -Y option since cron is off by default. 

On Thursday, 18 October 2012 16:11:55 UTC-5, Márcio wrote:

 I upgraded to version 2.1.1 and still did not work. Any idea?
 In version 1.99.7 works perfect.

 Em quinta-feira, 11 de outubro de 2012 18h48min21s UTC-3, Massimo Di 
 Pierro escreveu:

 Sorry this took forever. This is now fixed.

 On Tuesday, 2 October 2012 21:51:46 UTC-5, Márcio wrote:

 Massimo, help please.



-- 





[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread villas
I already posted a longer answer,  which appears to have disappeared.  
However,  my controller was simply something like
def article():
   auth.wiki()

BTW if I start a commandline session like this:

python web2py.py -S myapp -M
 db.tables

Then none of my auth.wiki tables are defined.  Can I place something in a 
model which would force them to be defined.  Thanks.




On Thursday, October 18, 2012 6:59:49 PM UTC+1, Massimo Di Pierro wrote:

 Can I see your controller?

 On Thursday, 18 October 2012 12:11:21 UTC-5, villas wrote:

 I want to read the content of a wiki page into my view:  
 views/mycontroller/mypage.html
 using:  {{=auth.wiki(my-wiki-slug') }}

 auth.wiki is on a function in:   controllers/default.py

 If the wiki page is found then it works OK.
 If the wiki page is not found,  then it redirects to:   
 mycontroller/mypage/_create/my-wiki-slug

 This redirect does not go to the correct place. 



-- 





[web2py] Wiki Body CLOB class 'cx_Oracle.DatabaseError' ORA-01704: string literal too long?

2012-10-18 Thread Bill Thayer

Using the auth.wiki I am defining my menu. When I hit submit I get the 
error below. The menu I wrote in is currently long I guess but it couldn't 
be more than 4000 bytes (oracle CLOB length) could it? Perhaps it's the 
HTML that gets stored in the DB?...That's what I suspected then I 
remembered that in WIKI_MEDIA I added a blob field to store files on the 
database and the 3 jpg images all larger that 4kb loaded with no problem.



Traceback (most recent call last):
 File C:\web2py_src_2.1.1\web2py\gluon\restricted.py, line 209, inrestricted
 exec ccode in environment
 File 
C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.pyhttp://127.0.0.1:8000/admin/default/edit/TAMOTO/controllers/default.py
, line 283, in module
 File C:\web2py_src_2.1.1\web2py\gluon\globals.py, line 187, in lambda
 self._caller = lambda f: f()
 File 
C:/web2py_src_2.1.1/web2py/applications/TAMOTO/controllers/default.pyhttp://127.0.0.1:8000/admin/default/edit/TAMOTO/controllers/default.py
, line 22, in index
 return auth.wiki()
 File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 3227, in wiki
 return self._wiki.read(slug)['content'] if slug else self._wiki()
 File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4697, in __call__
 return self.edit(request.args(1) or 'index')
 File C:\web2py_src_2.1.1\web2py\gluon\tools.py, line 4791, in edit
 formstyle='table2cols',showid=False).process()
 File C:\web2py_src_2.1.1\web2py\gluon\html.py, line 2135, in process
 self.validate(**kwargs)
 File C:\web2py_src_2.1.1\web2py\gluon\html.py, line 2075, in validate
 if self.accepts(**kwargs):
 File C:\web2py_src_2.1.1\web2py\gluon\sqlhtml.py, line 1439, in accepts
 self.table._db(self.table._id == self.record[self.id_field_name]).update(**
fields)
 File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 8814, in update
 ret = db._adapter.update(tablename,self.query,fields)
 File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1371, in update
 self.execute(sql)
 File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 2856, in execute
 return self.log_execute(command, args)
 File C:\web2py_src_2.1.1\web2py\gluon\dal.py, line 1687, in log_execute
 ret = self.cursor.execute(*a, **b)
DatabaseError: ORA-01704: string literal too long




This article explains how to define a LOB field 
http://www.dba-oracle.com/t_table_blob_lob_storage.htm in SQL. The SQL I am 
reading in SQL developer from tables created by web2py is different but 
should work. Then I got to messing with my menu markmin and discovered if I 
remove the @ from two of my menu items then it submits fine.

- Request  @request
- - Measurement  @order-measurment
- - Model  @model
- Product  @Product
- - Measurements  Measurements
- - - S-Parameters  @S-Parameters
- - - DC-IV  DC-IV
- - - Load Pull  @Load-Pull
- - Models  @Models
.
.
.



https://groups.google.com/d/msg/web2py/f66R-f3QvDo/gZR40A87SJ4J - 
Discussion from September 09 where Massimo posted a fix to sql.py (a file 
only used for backward compatibility) but I'm not convinced it's a CLOB 
problem.

-Bill

-- 





[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread Bill Thayer
This is in my db.py. Allen told me to add the second line after calling 
auth.define_tables



auth.define_tables(username=True, signature=False, migrate=True,fake_migrate
=True)
auth.wiki(resolve=False)
 the second line calls the wiki() function to create the tables.

Regards,
Bill

-- 





[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread Bill Thayer
Back on the original topic. When I click on a menu item I also get 
re-directed back to the _create page. Is this a permission thing perhaps? 
Now that I mention it, isn't there supposed to be a field to select the 
permission level for the page?

-- 





[web2py] Re: auth.wiki() '_create' doesn't redirect properly

2012-10-18 Thread villas
I tried it and that defined the tables.  
Thanks Bill!  


On Friday, October 19, 2012 1:24:45 AM UTC+1, Bill Thayer wrote:

 This is in my db.py. Allen told me to add the second line after calling 
 auth.define_tables



 auth.define_tables(username=True, signature=False, migrate=True,fake_migrate
 =True)
 auth.wiki(resolve=False)
  the second line calls the wiki() function to create the tables.

 Regards,
 Bill


-- 





[web2py] Re: response.stream

2012-10-18 Thread weheh
This thread seems to have the answer: 
https://groups.google.com/forum/?fromgroups=#!searchin/web2py/content$20disposition/web2py/61vbQQ6_-vk/zqfK4qCXxdEJ

The key is to use _onclick='window.open(%s);' % URL(...download script 
...)

This works OK, but, to be blunt, it's fugly the way it performs when it 
opens the window. I must find a better way.

-- 





[web2py] Re: IS_NOT_IN_DB() and update SQLFORM.factory

2012-10-18 Thread villas
The validators do not seem correct.  Maybe try them separately:

  Field('name',default='',notnull=True,unique=True),

Then after the table defined...

is_not_in_db=IS_NOT_IN_DB(db,'hub.name',error_message='name already in 
database')
db.hub.name.requires= [IS_NOT_EMPTY(),is_not_in_db]



On Thursday, October 18, 2012 10:14:21 AM UTC+1, Annet wrote:

 I defined the following table:

 is_not_in_db=IS_NOT_IN_DB(db,'hub.name',error_message='name already in 
 database')

 db.define_table('hub',
 Field(...),
 
 Field('name',default='',IS_NOT_EMPTY(),is_not_in_db],notnull=True,unique=True),
 ...
 migrate=False)


 ... and the following function:

 def update():
 form=SQLFORM.factory(db.hub,...)
  # prepopulate the form
 if form.process(keepvalues=False).accepted:
 ...
 is_not_in_db.set_self_id(hub.id)
 hub.update_record(**db.hub._filter_fields(form.vars))
 ..
 elif form.errors:
 response.flash=response_flash('formerror',session)
 elif not response.flash:
 response.flash='...'
 return dict(form=form)

 Despite the is_not_in_db validator and is_not_in_db.set_self_id(hub.id) I 
 get an error on field name  name already in database. This used the work, 
 is this no longer supported? What's the correct way to get this to work.

 Kind regards,

 Annet


-- 





[web2py] Has anyone seen any difference with response.flash since upgrading to 2.1.1?

2012-10-18 Thread weheh
Has anyone seen any difference with response.flash since upgrading to 2.1.1?

-- 





[web2py] Re: Reloading modules stops working after some time ...

2012-10-18 Thread weheh
I am now seeing this issue again on 2.1.1. I'm getting True from 
is_tracking_changes() but a change in one of my modules isn't showing in 
the browser.

On Tuesday, October 16, 2012 4:15:42 AM UTC+8, David Marko wrote:

 I have a module in my app that i was working on extensively today. I 
 realised that web2py doesnt reload it correctly when change tracking 
 enabled. I did some changes to module, after some 4 or 5 save/reload cycles 
 wbe2py stopped reloading the module so old code runned. I could see old 
 messages printed on console. After web2py restarted things went fine but 
 after some time the same behaviour reappeared ... Module reloading stopped 
 or i had to resave module 3-4 times to reflect in browser. Entire behaviour 
 is rather weird as one is not sure with version of my code is actualy 
 running ...

 David


-- 





[web2py] Is this possible: html link with ajax response?

2012-10-18 Thread weheh
I want to follow a link AND get a response from an ajax request. Something 
like this:

A('link text', _href=URL(...), _onclick='alert(test); 
jQuery(somediv).html(foobar).show();')

Is that possible?

--