[web2py] Hide menu until after authentication.

2011-10-21 Thread Mike Veltman

Gentle people,

First a remark I started playing with SQLFORM.grid and it was very ugly, until 
I did throw away my application and recreated it with the wizard, and then it  
was fine. ;-)

Second, I would like my response.menu to show up after authentication. What is 
the most elegant way of doing that ?

Thanks in advance.


With regards,
Mike Veltman




[web2py] Re: FluxFlex hosting

2011-10-21 Thread Lazarof

https://github.com/nus/web2py-for-fluxflex/blob/master/README.md

On Oct 20, 8:07 pm, raven ravenspo...@yahoo.com wrote:
 free FluxFlex hostinghttp://vimeo.com/28112026 seems to work well,
 except that it will not install a packed application.   James


[web2py] Re: Hide menu until after authentication.

2011-10-21 Thread annet
Hi Mike,

In the corresponding view you could do:

{{if auth.is_logged_in():}}
  {{=MENU(response.menu)}}
{{pass}}


Kind regards,

Annet.


Re: [web2py] Re: Hide menu until after authentication.

2011-10-21 Thread Mike Veltman

Thanks Annet,

Yes I was thinking about it. But that means that I have to remove the menu.py 
out of the models and place it in each view individually.

Thanks for the answer btw.

 Hi Mike,
 
 In the corresponding view you could do:
 
 {{if auth.is_logged_in():}}
   {{=MENU(response.menu)}}
 {{pass}}
 
 
 Kind regards,
 
 Annet.

With regards,
Mike Veltman




[web2py] MongoDB testing and development

2011-10-21 Thread Mark Breedveld
Dear Massimo,

I downloaded the trunk and I am currently testing the MongoDB Adapter
and I can tell that inserting currently isn't working. Also the
creation of tables doesn't work.

First question, shall I put the bugs and improvements that I find in
the Issue list or just in this discussion?

Secondly, the create_table method, is it possible to just skip the
function with a pass command? Cause collection in mongodb are created
on first insert of an document. There are capped collections in
MongoDB which offer better performance, but there data size is fixed.
My advise would be that by default the model is just passed(if not
needed somewhere else in web2py) and we could later implement the
capped collections. Because I want to have the adapter working first.

def create_table(self, table, migrate=True, fake_migrate=False,
polymodel=None):
pass
#May capped collection here? 
http://www.mongodb.org/display/DOCS/Capped+Collections
#because pymongo create collection on first insert (inserting a
document) http://api.mongodb.org/python/2.0/tutorial.html

Regards Mark,


Re: [web2py] Re: Hide menu until after authentication.

2011-10-21 Thread Manuele

On 21/10/2011 09:31, Mike Veltman wrote:

Thanks Annet,

Yes I was thinking about it. But that means that I have to remove the menu.py
out of the models and place it in each view individually.



I don't think so... the menu is inside the part that every view import 
from the main layout... so make the modification directly in your 
layout.html file and you'll see the result in every view that extend 
this file


my 2¢

Manuele


Thanks for the answer btw.




[web2py] Re: SOLVED join and sum - display in view

2011-10-21 Thread andrej burja
with
row[sum] 
it doesn't work
type 'exceptions.KeyError'('built-in function sum')

Actually, the above will only work if the controller returns 'sum' in the 
dictionary -- otherwise it will be undefined in the view.
what shoul i change in the controller?


Re: [web2py] Re: SOLVED join and sum - display in view

2011-10-21 Thread Martín Mulone
I think is row['sum']

2011/10/21 andrej burja andrej.bu...@gmail.com

 with
 row[sum]
 it doesn't work
 type 'exceptions.KeyError'('built-in function sum')

 Actually, the above will only work if the controller returns 'sum' in the
 dictionary -- otherwise it will be undefined in the view.
 what shoul i change in the controller?




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: @auth.requires_login problem

2011-10-21 Thread brushek


On 21 Paź, 04:33, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 This is not fixed in trunk. Please check it.

I don't know if You realy want to write is 'not fixed', but.. yes,
this not fixed, but error is diffrent right now.
Version of web2py:

Version 1.99.3 (2011-10-20 22:43:34) dev

Traceback (most recent call last):
  File /home/users/brushek/web2py/gluon/restricted.py, line 192, in
restricted
exec ccode in environment
  File /home/users/brushek/web2py/applications/test/controllers/
default.py, line 72, in module
  File /home/users/brushek/web2py/gluon/globals.py, line 149, in
lambda
self._caller = lambda f: f()
  File /home/users/brushek/web2py/applications/test/controllers/
default.py, line 34, in user
return dict(form=auth())
  File /home/users/brushek/web2py/gluon/tools.py, line 1130, in
__call__
return getattr(self,args[0])()
  File /home/users/brushek/web2py/gluon/tools.py, line 1648, in
login
user = self.db(table_user[username] ==
form.vars[username]).select().first()
  File /home/users/brushek/web2py/gluon/dal.py, line 5777, in select
return self.db._adapter.select(self.query,fields,attributes)
  File /home/users/brushek/web2py/gluon/dal.py, line 1264, in select
sql = self._select(query, fields, attributes)
  File /home/users/brushek/web2py/gluon/dal.py, line 1651, in
_select
sql = super(SQLiteAdapter, self)._select(query, fields,
attributes)
  File /home/users/brushek/web2py/gluon/dal.py, line 1178, in
_select
if self.can_select_with_update is False and for_update is True:
AttributeError: 'SQLiteAdapter' object has no attribute
'can_select_with_update'


[web2py] Running web2py in an apache directory

2011-10-21 Thread José L .
Hi,
I've been running successfully web2py under apache in a directory following 
the slice at http://www.web2pyslices.com/slices/take_slice/56 . I need it 
running in a subdirectory because this apache server is running some other 
apps, some of them in php.

It worked perfectly with version 1.95.1, but after trying to update web2py 
to versions =1.96.1, it doesn't work.

I see this behaviour when going to the url where web2py should work:
http://miserver/mysubdir
with 1.95.1, it redirects to:
http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init/default/index
but with versions =1.96.1 it redirects to:
http://miserver/init/default/user/login?_next=/init/default/index

So, web2py it's removing the /mysubdir/ part somewhere.

After checking the changelog between both versions I can not find anything 
related to this routes changes. Running under apache I'm not using the 
routes.py file nor changing apache configuration between web2py versions.

Any idea?
Thanks


[web2py] Re: SOLVED join and sum - display in view

2011-10-21 Thread Anthony


On Friday, October 21, 2011 5:49:50 AM UTC-4, andrej burja wrote:

 with
 row[sum] 
 it doesn't work
 type 'exceptions.KeyError'('built-in function sum')

 Actually, the above will only work if the controller returns 'sum' in the 
 dictionary -- otherwise it will be undefined in the view.
 what shoul i change in the controller?


You define 'sum' in the controller, so you have to pass it to the view in 
order to reference it in the view. So, in the controller, instead of:

return dict(rows=rows)

do

return dict(sum=sum, rows=rows)

Actually, because 'sum' is a Python builtin, you might be better off naming 
it something else.

Anthony 


Re: [web2py] Re: SOLVED join and sum - display in view

2011-10-21 Thread Anthony
On Friday, October 21, 2011 6:03:53 AM UTC-4, Martin.Mulone wrote:

 I think is row['sum']


The actual dict key is 'SUM(t_payement.f_value)', so 'sum' (in quotes) won't 
work in this case. It turns out that str(sum) equals 
'SUM(t_payement.f_value)', though, so you can do row[str(sum)]. However, the 
row object automatically applies str() to any keys, so row[sum] is 
equivalent to row[str(sum)]. row is also a callable object, so you can do 
row(sum).

Note, 'SUM(t_payement.f_value)' is the actual SQL expression generated by 
the DAL Expression (i.e., db.t_payement.f_value.sum() generates the SQL
 'SUM(t_payement.f_value)', at least in the particular DB adapter being 
used). str(expression) returns this SQL, and it is also used as the key to 
access the result in the Row object.

Anthony


Re: [web2py] Hide menu until after authentication.

2011-10-21 Thread Anthony
On Friday, October 21, 2011 2:05:29 AM UTC-4, Gwayne aka Mike Veltman wrote:


 Gentle people,

 First a remark I started playing with SQLFORM.grid and it was very ugly, 
 until 
 I did throw away my application and recreated it with the wizard, and then 
 it  
 was fine. ;-)

Along with SQLFORM.grid, the 'welcome' app was updated with some new CSS in 
base.css to style the grid. If you add a grid to an older app without 
updating the CSS, it probably won't look right. Creating a new app (with the 
wizard or otherwise) will use the new CSS, so should look fine. You can find 
the new grid-related CSS at the bottom of base.css and copy it into the CSS 
file of your older app to get the grid to display properly.

Anthony



[web2py] Registration_key ='pending' bug

2011-10-21 Thread Indigenous_Information_Technology
When i set registration requires approval=True (and requires
verification=False), the key is not set to 'pending', but web2py_uuid
i suspect.
Unfortunately on first tests this worked, so not sure why now changed
Any ideas


[web2py] wsgihandler and images bug

2011-10-21 Thread Indigenous_Information_Technology
Running web2py on apache with wsgihandler.py
 i have loaded a few images as attachments, then insert them in the
page. When viewing the page i see one image. I reload a see anther
one. Next reload about two others!
They are all there in the page source code
Any ideas?


[web2py] Is there something like an optional requires

2011-10-21 Thread Calycé
Hi all,

I have created a table with a self reference as described below:
db.define_table('category',
Field('parent_category', 'reference category'),
Field('name', 'string', length=40, required=True),
Field('description', 'text', required=True),
Field('small_image', 'upload'))

Now I'd like to have an optional requires clause. For example, if I
add the following clause store.category.parent_category.requires = 0
or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo
whenever I use the appdadmin to insert rows BUT I have to select
something from the combo. In my case, the parent_category field should
be optional. In extenso, categories without parent_category would be
root categories so selecting a parent_category is optional.

Is there a way to present a combo as does the requires but without
enforcing the field ? Do I have to create a specific form for that ?


[web2py] SQLite checkpoint

2011-10-21 Thread Calycé
Hi all,

A small question: Is there a way to force a checkpoint for SQLite
databases ?


Re: [web2py] Re: Hide menu until after authentication.

2011-10-21 Thread Anthony
On Friday, October 21, 2011 3:31:22 AM UTC-4, Gwayne aka Mike Veltman wrote:


 Thanks Annet,

 Yes I was thinking about it. But that means that I have to remove the 
 menu.py 
 out of the models and place it in each view individually.

How are you doing it now? Typically, menu.py simply defines response.menu. 
You then display the menu in a view (typically layout.html) via:

{{=MENU(response.menu)}}

Making the above line conditional within the view (again, presumably 
layout.html) shouldn't have any impact on menu.py or where you define 
response.menu.

Anthony 


[web2py] Re: Is there something like an optional requires

2011-10-21 Thread Anthony
IS_EMPTY_OR(IS_IN_DB(...))

See http://web2py.com/book/default/chapter/07#Validators.

Anthony

On Friday, October 21, 2011 3:35:06 AM UTC-4, Calycé wrote:

 Hi all, 

 I have created a table with a self reference as described below: 
 db.define_table('category', 
 Field('parent_category', 'reference category'), 
 Field('name', 'string', length=40, required=True), 
 Field('description', 'text', required=True), 
 Field('small_image', 'upload')) 

 Now I'd like to have an optional requires clause. For example, if I 
 add the following clause store.category.parent_category.requires = 0 
 or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo 
 whenever I use the appdadmin to insert rows BUT I have to select 
 something from the combo. In my case, the parent_category field should 
 be optional. In extenso, categories without parent_category would be 
 root categories so selecting a parent_category is optional. 

 Is there a way to present a combo as does the requires but without 
 enforcing the field ? Do I have to create a specific form for that ? 



[web2py] Re: Is there something like an optional requires

2011-10-21 Thread DenesL
Hi Calycé,

note that:
store.category.parent_category.requires = 0 or IS_IN_DB(db,
db.category.id, '%(name)s')
is equivalent to:
store.category.parent_category.requires = IS_IN_DB(db, db.category.id,
'%(name)s')
since 0 evaluates to False.

I believe that what you want is:
store.category.parent_category.requires = IS_EMPTY_OR(IS_IN_DB(db,
db.category.id, '%(name)s'))

Denes.

On Oct 21, 3:35 am, Calycé welcome.to.dev.n...@gmail.com wrote:
 Hi all,

 I have created a table with a self reference as described below:
 db.define_table('category',
     Field('parent_category', 'reference category'),
     Field('name', 'string', length=40, required=True),
     Field('description', 'text', required=True),
     Field('small_image', 'upload'))

 Now I'd like to have an optional requires clause. For example, if I
 add the following clause store.category.parent_category.requires = 0
 or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo
 whenever I use the appdadmin to insert rows BUT I have to select
 something from the combo. In my case, the parent_category field should
 be optional. In extenso, categories without parent_category would be
 root categories so selecting a parent_category is optional.

 Is there a way to present a combo as does the requires but without
 enforcing the field ? Do I have to create a specific form for that ?


Re: [web2py] Contribution

2011-10-21 Thread António Ramos
May i suggest a workflow framework in web2py?
Django has one
I want one :(

2011/10/21 Hong-Khoan Quach hongkhoanqu...@googlemail.com

 Hi there.

 We would like to contribute to web2py for a university open source
 practical course. Does anyone have an idea for an important/cool feature
 that we could propose to our supervisor?
 Furthermore, are there any low hanging fruits, we can start with?

 Regards

 Matteo and Hong-Khoan




[web2py] Re: wsgihandler and images bug

2011-10-21 Thread Anthony
Are you saying this only happens when running on apache with wsgihandler.py 
(i.e., not with Rocket)? What is your code?

On Friday, October 21, 2011 12:59:48 AM UTC-4, 
Indigenous_Information_Technology wrote:

 Running web2py on apache with wsgihandler.py 
  i have loaded a few images as attachments, then insert them in the 
 page. When viewing the page i see one image. I reload a see anther 
 one. Next reload about two others! 
 They are all there in the page source code 
 Any ideas?



[web2py] Re: Is there something like an optional requires

2011-10-21 Thread Calycé
Thanks a lot to both of you the IS_EMPTY_OR() was indeed what I was
needing (note to self: reread the book...)

Could anyone of you tell me when the the combo is populated ? I'm just
asking because now, when I enter a record using the appadmin
interface, the new record is not appearing in the combo but is
correctly inserted in the table. I have to reload the page in order to
see the last inserted category in the combo.


For the 0 or it's a bad cut 'n paste... my bad.



On Oct 21, 2:56 pm, DenesL denes1...@yahoo.ca wrote:
 Hi Calycé,

 note that:
 store.category.parent_category.requires = 0 or IS_IN_DB(db,
 db.category.id, '%(name)s')
 is equivalent to:
 store.category.parent_category.requires = IS_IN_DB(db, db.category.id,
 '%(name)s')
 since 0 evaluates to False.

 I believe that what you want is:
 store.category.parent_category.requires = IS_EMPTY_OR(IS_IN_DB(db,
 db.category.id, '%(name)s'))

 Denes.

 On Oct 21, 3:35 am, Calycé welcome.to.dev.n...@gmail.com wrote:







  Hi all,

  I have created a table with a self reference as described below:
  db.define_table('category',
      Field('parent_category', 'reference category'),
      Field('name', 'string', length=40, required=True),
      Field('description', 'text', required=True),
      Field('small_image', 'upload'))

  Now I'd like to have an optional requires clause. For example, if I
  add the following clause store.category.parent_category.requires = 0
  or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo
  whenever I use the appdadmin to insert rows BUT I have to select
  something from the combo. In my case, the parent_category field should
  be optional. In extenso, categories without parent_category would be
  root categories so selecting a parent_category is optional.

  Is there a way to present a combo as does the requires but without
  enforcing the field ? Do I have to create a specific form for that ?


[web2py] Re: Opera : web2py IDE : CTRL+S not working

2011-10-21 Thread Vineet
I also tried to run web2py from the source.
With IE / Mozilla, CTRL+S is OK.
With Opera, save as dialog box appears.

--- Vineet

On Oct 19, 6:09 pm, Vineet vineet.deod...@gmail.com wrote:
 OS: Win7
 web2py 1.99.2 windows version
 Browser: Opera ver. 11.51

 After CTRL+S, a dialog box for save file is displayed.
 In IE and firefox, No problem.

 I read in earlier posts that this issue was addressed.
 Do I need to grab anything from the trunk?

  Vineet


[web2py] Re: SQLFORM.grid / Powergrid

2011-10-21 Thread Massimo Di Pierro
On Oct 20, 11:07 pm, greenpoise danel.sega...@gmail.com wrote:
 I have a few questions regarding the grids.

 1. Is SQLFORM.grid the implementation of Powergrid?

No but was inspired but it

 meaning, does
 SQLFORM.grid has all the features of Powergrid?

Not sure. martin should answer that.

 2. Is there an option to edit a value on the fly rather than using an
 edit button? sort of like edit in place pyslice.

No. because it uses no ajax.

 3. Is search as you type an option (type ahead)?

No.

 Thanks

 Dan


[web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-21 Thread Massimo Di Pierro
Can you provide an example to reproduce the problem?

On Oct 21, 12:38 am, Robin Marshall robin.d.marsh...@gmail.com
wrote:
 Hi,

 Just wanted to say that we found a bug in 1.99.2 when using XMLRPC
 services with the @auth.requires_login decorator using basic
 authentication.

 It looks like some code was refactored out of requires_login into a
 generic requires method which might be the cause of the problem.

 A quick hack was to change the following code, but obviously that
 won't work very well for people who aren't using basic authentication.

     def is_logged_in(self):
         
         checks if the user is logged in and returns True/False.
         if so user is in auth.user as well as in session.auth.user
         
         if self.user:
             return True
         return False

 to:

     def is_logged_in(self):
         
         checks if the user is logged in and returns True/False.
         if so user is in auth.user as well as in session.auth.user
         
         if self.basic() and self.user:
             return True
         return False

 Cheers,
 Robin


[web2py] Re: MongoDB testing and development

2011-10-21 Thread Massimo Di Pierro
yes.

On Oct 21, 2:55 am, Mark Breedveld m.breedv...@solcon.nl wrote:
 Dear Massimo,

 I downloaded the trunk and I am currently testing the MongoDB Adapter
 and I can tell that inserting currently isn't working. Also the
 creation of tables doesn't work.

 First question, shall I put the bugs and improvements that I find in
 the Issue list or just in this discussion?

 Secondly, the create_table method, is it possible to just skip the
 function with a pass command? Cause collection in mongodb are created
 on first insert of an document. There are capped collections in
 MongoDB which offer better performance, but there data size is fixed.
 My advise would be that by default the model is just passed(if not
 needed somewhere else in web2py) and we could later implement the
 capped collections. Because I want to have the adapter working first.

 def create_table(self, table, migrate=True, fake_migrate=False,
 polymodel=None):
         pass
                 #May capped collection 
 here?http://www.mongodb.org/display/DOCS/Capped+Collections
                 #because pymongo create collection on first insert (inserting 
 a
 document)http://api.mongodb.org/python/2.0/tutorial.html

 Regards Mark,


[web2py] Re: @auth.requires_login problem

2011-10-21 Thread Massimo Di Pierro
typo in last commit. fixed now in trunk

On Oct 21, 5:16 am, brushek luk...@chrustek.net wrote:
 On 21 Paź, 04:33, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

  This is not fixed in trunk. Please check it.

 I don't know if You realy want to write is 'not fixed', but.. yes,
 this not fixed, but error is diffrent right now.
 Version of web2py:

 Version 1.99.3 (2011-10-20 22:43:34) dev

 Traceback (most recent call last):
   File /home/users/brushek/web2py/gluon/restricted.py, line 192, in
 restricted
     exec ccode in environment
   File /home/users/brushek/web2py/applications/test/controllers/
 default.py, line 72, in module
   File /home/users/brushek/web2py/gluon/globals.py, line 149, in
 lambda
     self._caller = lambda f: f()
   File /home/users/brushek/web2py/applications/test/controllers/
 default.py, line 34, in user
     return dict(form=auth())
   File /home/users/brushek/web2py/gluon/tools.py, line 1130, in
 __call__
     return getattr(self,args[0])()
   File /home/users/brushek/web2py/gluon/tools.py, line 1648, in
 login
     user = self.db(table_user[username] ==
 form.vars[username]).select().first()
   File /home/users/brushek/web2py/gluon/dal.py, line 5777, in select
     return self.db._adapter.select(self.query,fields,attributes)
   File /home/users/brushek/web2py/gluon/dal.py, line 1264, in select
     sql = self._select(query, fields, attributes)
   File /home/users/brushek/web2py/gluon/dal.py, line 1651, in
 _select
     sql = super(SQLiteAdapter, self)._select(query, fields,
 attributes)
   File /home/users/brushek/web2py/gluon/dal.py, line 1178, in
 _select
     if self.can_select_with_update is False and for_update is True:
 AttributeError: 'SQLiteAdapter' object has no attribute
 'can_select_with_update'


[web2py] Re: Running web2py in an apache directory

2011-10-21 Thread Massimo Di Pierro
Can you show us your routes?

On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks


[web2py] Re: Is there something like an optional requires

2011-10-21 Thread Anthony
I *think* if you submit a form and immediately reload a new form (as part of 
the same action), the new form's dropdown is populated (via the IS_IN_DB 
validator) before the db insert of the submitted form, so the new form 
doesn't have the most up-to-date set of values. If that's the case, it 
should probably be fixed.

On Friday, October 21, 2011 9:28:38 AM UTC-4, Calycé wrote:

 Thanks a lot to both of you the IS_EMPTY_OR() was indeed what I was 
 needing (note to self: reread the book...) 

 Could anyone of you tell me when the the combo is populated ? I'm just 
 asking because now, when I enter a record using the appadmin 
 interface, the new record is not appearing in the combo but is 
 correctly inserted in the table. I have to reload the page in order to 
 see the last inserted category in the combo. 


 For the 0 or it's a bad cut 'n paste... my bad. 



 On Oct 21, 2:56 pm, DenesL dene...@yahoo.ca wrote: 
  Hi Calycé, 
  
  note that: 
  store.category.parent_category.requires = 0 or IS_IN_DB(db, 
  db.category.id, '%(name)s') 
  is equivalent to: 
  store.category.parent_category.requires = IS_IN_DB(db, db.category.id, 
  '%(name)s') 
  since 0 evaluates to False. 
  
  I believe that what you want is: 
  store.category.parent_category.requires = IS_EMPTY_OR(IS_IN_DB(db, 
  db.category.id, '%(name)s')) 
  
  Denes. 
  
  On Oct 21, 3:35 am, Calycé welcome.t...@gmail.com wrote: 
  
  
  
  
  
  
  
   Hi all, 
  
   I have created a table with a self reference as described below: 
   db.define_table('category', 
   Field('parent_category', 'reference category'), 
   Field('name', 'string', length=40, required=True), 
   Field('description', 'text', required=True), 
   Field('small_image', 'upload')) 
  
   Now I'd like to have an optional requires clause. For example, if I 
   add the following clause store.category.parent_category.requires = 0 
   or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo 
   whenever I use the appdadmin to insert rows BUT I have to select 
   something from the combo. In my case, the parent_category field should 
   be optional. In extenso, categories without parent_category would be 
   root categories so selecting a parent_category is optional. 
  
   Is there a way to present a combo as does the requires but without 
   enforcing the field ? Do I have to create a specific form for that ?



[web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard
Hello,

I would like to make sure the inner join syntax was available in
1.98.2 ?

Thanks.

Richard


[web2py] fields attribute on SQLFORM.grid

2011-10-21 Thread Omi Chiba
I have a following entry in controller and this works fine to list all
the fields in a table.
When I specify fields=['name'], then I got an error. What did I do
wrong ?

Here's my table:
-
db.define_table('special',
Field('restaurant_id', db.restaurant),
Field('name'),
Field('price','double'),
Field('image','upload'),
format='%(name)s')

Controller (This works)
---
def update():
grid = SQLFORM.grid(db.special.restaurant_id==request.args(0),
deletable=False,paginate=10,details=False,csv=False,searchable=False)
return dict(grid=grid)

Controller(This doesn't)

def update():
grid =
SQLFORM.grid(db.special.restaurant_id==request.args(0),fields=['name'],deletable=False,
paginate=10,details=False,csv=False,searchable=False)
return dict(grid=grid)

Error:
---
Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 194, in restricted
exec ccode in environment
  File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
line 88, in module
  File C:\web2py\gluon\globals.py, line 149, in lambda
self._caller = lambda f: f()
  File C:\web2py\gluon\tools.py, line 2456, in f
return action(*a, **b)
  File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
line 23, in update
grid =
SQLFORM.grid(db.special.restaurant_id==request.args(0),deletable=False,
paginate=10,details=False,csv=False,searchable=False,fields=['id'])
  File C:\web2py\gluon\sqlhtml.py, line 1588, in grid
if not field.readable: continue
AttributeError: 'str' object has no attribute 'readable'


[web2py] Re: Registration_key ='pending' bug

2011-10-21 Thread Massimo Di Pierro
I cannot reproduce the problem. Can you show us the code and a test
case?

On Oct 20, 11:05 pm, Indigenous_Information_Technology
cat.ku...@gmail.com wrote:
 When i set registration requires approval=True (and requires
 verification=False), the key is not set to 'pending', but web2py_uuid
 i suspect.
 Unfortunately on first tests this worked, so not sure why now changed
 Any ideas


[web2py] Re: is inner join syntax available in 1.98.2

2011-10-21 Thread Massimo Di Pierro
it was

On Oct 21, 9:15 am, Richard ml.richard.vez...@gmail.com wrote:
 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard


[web2py] Re: fields attribute on SQLFORM.grid

2011-10-21 Thread Massimo Di Pierro
...grid(fields=['name']...)

should be

...grid(fields=[db.special.name]...)

which web2py version? I though we support both syntaxes. Please open a
ticket.

On Oct 21, 9:19 am, Omi Chiba ochib...@gmail.com wrote:
 I have a following entry in controller and this works fine to list all
 the fields in a table.
 When I specify fields=['name'], then I got an error. What did I do
 wrong ?

 Here's my table:
 -
 db.define_table('special',
     Field('restaurant_id', db.restaurant),
     Field('name'),
     Field('price','double'),
     Field('image','upload'),
     format='%(name)s')

 Controller (This works)
 ---
 def update():
     grid = SQLFORM.grid(db.special.restaurant_id==request.args(0),
 deletable=False,paginate=10,details=False,csv=False,searchable=False)
     return dict(grid=grid)

 Controller(This doesn't)
 
 def update():
     grid =
 SQLFORM.grid(db.special.restaurant_id==request.args(0),fields=['name'],dele 
 table=False,
 paginate=10,details=False,csv=False,searchable=False)
     return dict(grid=grid)

 Error:
 ---
 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 194, in restricted
     exec ccode in environment
   File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
 line 88, in module
   File C:\web2py\gluon\globals.py, line 149, in lambda
     self._caller = lambda f: f()
   File C:\web2py\gluon\tools.py, line 2456, in f
     return action(*a, **b)
   File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
 line 23, in update
     grid =
 SQLFORM.grid(db.special.restaurant_id==request.args(0),deletable=False,
 paginate=10,details=False,csv=False,searchable=False,fields=['id'])
   File C:\web2py\gluon\sqlhtml.py, line 1588, in grid
     if not field.readable: continue
 AttributeError: 'str' object has no attribute 'readable'


Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Anthony
Yes, I think you could always do inner joins, and the new select(join=...) 
syntax was introduced in 1.96.1.

On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello, 

 I would like to make sure the inner join syntax was available in 
 1.98.2 ? 

 Thanks. 

 Richard



[web2py] Is it possible to compress the output html before rendering out?

2011-10-21 Thread Farsheed Ashouri
Is it possible to compress the output html before rendering out? I mean
using tools like compressors or tiddy to clean/compress the output code
automatically on output not on our source. 



Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard Vézina
Ok, but I am pretty much confuse with the syntax...

I try with my own tables by kind of translating person and dog to adapt to
my need but it failed...

This work :

rows = db(db.t1.t2_id == db.t2.id).select()
for row in rows:
print row.t2.f1 + '-' + row.t1.f1

But this don't work :

rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
So can't execute the lines below since the upper line has failed...
#for row in rows1:
#print row.t2.f1 + '-' + row.t1.f1

In console I get those errors :

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1376, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1386, 0))

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (1306, 0))


The only way I can execute the query (db().select()) :
rows1 = db(db.t1).select(join=db.t2.on(db.t2.id == db.t1.t2_id))
for row in rows1:
print row.t2.f1 + '-' + row.t1.f1

In this case the for failed with with the t2.f1 since there is only t1 rows
in the output of the request (print(rows1))...

Where's my mystake?!

Richard

On Fri, Oct 21, 2011 at 10:35 AM, Anthony abasta...@gmail.com wrote:

 Yes, I think you could always do inner joins, and the new select(join=...)
 syntax was introduced in 1.96.1.

 On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard




[web2py] Re: fields attribute on SQLFORM.grid

2011-10-21 Thread Omi Chiba
Thank you. I posted as issue #482.
Yes, fields=[db.special.id,db.special.name] works !

def update():
grid =
SQLFORM.grid(db.special.restaurant_id==request.args(0),fields=[db.special.id,db.special.name],dele
table=False,
paginate=10,details=False,csv=False,searchable=False)
return dict(grid=grid)

On Oct 21, 9:33 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 ...grid(fields=['name']...)

 should be

 ...grid(fields=[db.special.name]...)

 which web2py version? I though we support both syntaxes. Please open a
 ticket.

 On Oct 21, 9:19 am, Omi Chiba ochib...@gmail.com wrote:







  I have a following entry in controller and this works fine to list all
  the fields in a table.
  When I specify fields=['name'], then I got an error. What did I do
  wrong ?

  Here's my table:
  -
  db.define_table('special',
      Field('restaurant_id', db.restaurant),
      Field('name'),
      Field('price','double'),
      Field('image','upload'),
      format='%(name)s')

  Controller (This works)
  ---
  def update():
      grid = SQLFORM.grid(db.special.restaurant_id==request.args(0),
  deletable=False,paginate=10,details=False,csv=False,searchable=False)
      return dict(grid=grid)

  Controller(This doesn't)
  
  def update():
      grid =
  SQLFORM.grid(db.special.restaurant_id==request.args(0),fields=['name'],dele 
  table=False,
  paginate=10,details=False,csv=False,searchable=False)
      return dict(grid=grid)

  Error:
  ---
  Traceback (most recent call last):
    File C:\web2py\gluon\restricted.py, line 194, in restricted
      exec ccode in environment
    File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
  line 88, in module
    File C:\web2py\gluon\globals.py, line 149, in lambda
      self._caller = lambda f: f()
    File C:\web2py\gluon\tools.py, line 2456, in f
      return action(*a, **b)
    File C:/web2py/applications/Kyono_Lunch/controllers/default.py,
  line 23, in update
      grid =
  SQLFORM.grid(db.special.restaurant_id==request.args(0),deletable=False,
  paginate=10,details=False,csv=False,searchable=False,fields=['id'])
    File C:\web2py\gluon\sqlhtml.py, line 1588, in grid
      if not field.readable: continue
  AttributeError: 'str' object has no attribute 'readable'


Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard Vézina
To me the book example is not logic :

 rows = db(db.person).select(join=db.person.on(db.person.id==db.dog.owner))
 for row in rows:
print row.person.name, 'has', row.dog.name
Alex has Skipper
Alex has Snoopy
Bob has Puppy


How I understand the syntax is that I will do a join on the table already in
the from db(db.person)... And it's what the console seems to failed with...

What I need is :

SELECT *
FROM t1
INNER JOIN t2
  ON(t2.id = t1.t2_id)

But what rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
return that failed seems to be :

SELECT *
FROM t1
INNER JOIN t1
  ON(t2.id = t1.t2_id)

Richard


On Fri, Oct 21, 2011 at 10:48 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Ok, but I am pretty much confuse with the syntax...

 I try with my own tables by kind of translating person and dog to adapt to
 my need but it failed...

 This work :

 rows = db(db.t1.t2_id == db.t2.id).select()
 for row in rows:
 print row.t2.f1 + '-' + row.t1.f1

 But this don't work :

 rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 So can't execute the lines below since the upper line has failed...
 #for row in rows1:
 #print row.t2.f1 + '-' + row.t1.f1

 In console I get those errors :

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1376, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1386, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1306, 0))


 The only way I can execute the query (db().select()) :
 rows1 = db(db.t1).select(join=db.t2.on(db.t2.id == db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 In this case the for failed with with the t2.f1 since there is only t1 rows
 in the output of the request (print(rows1))...

 Where's my mystake?!

 Richard

 On Fri, Oct 21, 2011 at 10:35 AM, Anthony abasta...@gmail.com wrote:

 Yes, I think you could always do inner joins, and the new select(join=...)
 syntax was introduced in 1.96.1.

 On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard





Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard Vézina
Helpful thread :
https://groups.google.com/group/web2py/browse_thread/thread/a033d703deba3712/dcbd912788cdbec4?lnk=raotpli=1

On Fri, Oct 21, 2011 at 11:08 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Ok I had to do this :

 rows1 = db(db.t1).select(*db.t1.ALL, db.t2.ALL*, join=db.t2.on(db.t2.id ==
 db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 And now I get the field of t2...

 Could the example in the book wrong??

 Richard

 On Fri, Oct 21, 2011 at 11:00 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 To me the book example is not logic :

  rows = 
  db(db.person).select(join=db.person.on(db.person.id==db.dog.owner))


  for row in rows:
 print row.person.name, 'has', row.dog.name


 Alex has Skipper
 Alex has Snoopy
 Bob has Puppy


 How I understand the syntax is that I will do a join on the table already
 in the from db(db.person)... And it's what the console seems to failed
 with...

 What I need is :

 SELECT *
 FROM t1
 INNER JOIN t2
   ON(t2.id = t1.t2_id)

 But what rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 return that failed seems to be :

  SELECT *
 FROM t1
 INNER JOIN t1
   ON(t2.id = t1.t2_id)

 Richard


 On Fri, Oct 21, 2011 at 10:48 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok, but I am pretty much confuse with the syntax...

 I try with my own tables by kind of translating person and dog to adapt
 to my need but it failed...

 This work :

 rows = db(db.t1.t2_id == db.t2.id).select()
 for row in rows:
 print row.t2.f1 + '-' + row.t1.f1

 But this don't work :

 rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 So can't execute the lines below since the upper line has failed...
 #for row in rows1:
 #print row.t2.f1 + '-' + row.t1.f1

 In console I get those errors :

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1376, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1386, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1306, 0))


 The only way I can execute the query (db().select()) :
 rows1 = db(db.t1).select(join=db.t2.on(db.t2.id == db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 In this case the for failed with with the t2.f1 since there is only t1
 rows in the output of the request (print(rows1))...

 Where's my mystake?!

 Richard

 On Fri, Oct 21, 2011 at 10:35 AM, Anthony abasta...@gmail.com wrote:

 Yes, I think you could always do inner joins, and the new
 select(join=...) syntax was introduced in 1.96.1.

 On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard







Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard Vézina
Ok I had to do this :

rows1 = db(db.t1).select(*db.t1.ALL, db.t2.ALL*, join=db.t2.on(db.t2.id ==
db.t1.t2_id))
for row in rows1:
print row.t2.f1 + '-' + row.t1.f1

And now I get the field of t2...

Could the example in the book wrong??

Richard

On Fri, Oct 21, 2011 at 11:00 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 To me the book example is not logic :

  rows = db(db.person).select(join=db.person.on(db.person.id==db.dog.owner))

  for row in rows:
 print row.person.name, 'has', row.dog.name

 Alex has Skipper
 Alex has Snoopy
 Bob has Puppy


 How I understand the syntax is that I will do a join on the table already
 in the from db(db.person)... And it's what the console seems to failed
 with...

 What I need is :

 SELECT *
 FROM t1
 INNER JOIN t2
   ON(t2.id = t1.t2_id)

 But what rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 return that failed seems to be :

  SELECT *
 FROM t1
 INNER JOIN t1
   ON(t2.id = t1.t2_id)

 Richard


 On Fri, Oct 21, 2011 at 10:48 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok, but I am pretty much confuse with the syntax...

 I try with my own tables by kind of translating person and dog to adapt to
 my need but it failed...

 This work :

 rows = db(db.t1.t2_id == db.t2.id).select()
 for row in rows:
 print row.t2.f1 + '-' + row.t1.f1

 But this don't work :

 rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 So can't execute the lines below since the upper line has failed...
 #for row in rows1:
 #print row.t2.f1 + '-' + row.t1.f1

 In console I get those errors :

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1376, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1386, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1306, 0))


 The only way I can execute the query (db().select()) :
 rows1 = db(db.t1).select(join=db.t2.on(db.t2.id == db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 In this case the for failed with with the t2.f1 since there is only t1
 rows in the output of the request (print(rows1))...

 Where's my mystake?!

 Richard

 On Fri, Oct 21, 2011 at 10:35 AM, Anthony abasta...@gmail.com wrote:

 Yes, I think you could always do inner joins, and the new
 select(join=...) syntax was introduced in 1.96.1.

 On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard






Re: [web2py] is inner join syntax available in 1.98.2

2011-10-21 Thread Richard Vézina
It's really mystify me, both request pass when I specify the data I want :

Works too...
rows1 = db(db.t1).select(db.t1.ALL, db.t2.ALL, join=db.t1.on(db.t1.t2_id ==
db.t2.id))
for row in rows1:
print row.t2.f1 + '-' + row.t1.f1

Richard

On Fri, Oct 21, 2011 at 11:09 AM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 Helpful thread :
 https://groups.google.com/group/web2py/browse_thread/thread/a033d703deba3712/dcbd912788cdbec4?lnk=raotpli=1


 On Fri, Oct 21, 2011 at 11:08 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok I had to do this :

 rows1 = db(db.t1).select(*db.t1.ALL, db.t2.ALL*, join=db.t2.on(db.t2.id== 
 db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 And now I get the field of t2...

 Could the example in the book wrong??

 Richard

 On Fri, Oct 21, 2011 at 11:00 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 To me the book example is not logic :

  rows = 
  db(db.person).select(join=db.person.on(db.person.id==db.dog.owner))



  for row in rows:
 print row.person.name, 'has', row.dog.name



 Alex has Skipper
 Alex has Snoopy
 Bob has Puppy


 How I understand the syntax is that I will do a join on the table already
 in the from db(db.person)... And it's what the console seems to failed
 with...

 What I need is :

 SELECT *
 FROM t1
 INNER JOIN t2
   ON(t2.id = t1.t2_id)

 But what rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id
 ))
 return that failed seems to be :

  SELECT *
 FROM t1
 INNER JOIN t1
   ON(t2.id = t1.t2_id)

 Richard


 On Fri, Oct 21, 2011 at 10:48 AM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Ok, but I am pretty much confuse with the syntax...

 I try with my own tables by kind of translating person and dog to adapt
 to my need but it failed...

 This work :

 rows = db(db.t1.t2_id == db.t2.id).select()
 for row in rows:
 print row.t2.f1 + '-' + row.t1.f1

 But this don't work :

 rows1 = db(db.t1).select(join=db.t1.on(db.t1.t2_id == db.t2.id))
 So can't execute the lines below since the upper line has failed...
 #for row in rows1:
 #print row.t2.f1 + '-' + row.t1.f1

 In console I get those errors :

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1376, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1386, 0))

 ERROR: An unexpected error occurred while tokenizing input
 The following traceback may be corrupted or invalid
 The error message is: ('EOF in multi-line statement', (1306, 0))


 The only way I can execute the query (db().select()) :
 rows1 = db(db.t1).select(join=db.t2.on(db.t2.id == db.t1.t2_id))
 for row in rows1:
 print row.t2.f1 + '-' + row.t1.f1

 In this case the for failed with with the t2.f1 since there is only t1
 rows in the output of the request (print(rows1))...

 Where's my mystake?!

 Richard

 On Fri, Oct 21, 2011 at 10:35 AM, Anthony abasta...@gmail.com wrote:

 Yes, I think you could always do inner joins, and the new
 select(join=...) syntax was introduced in 1.96.1.

 On Friday, October 21, 2011 10:15:09 AM UTC-4, Richard wrote:

 Hello,

 I would like to make sure the inner join syntax was available in
 1.98.2 ?

 Thanks.

 Richard








[web2py] SQLFORM.factory not respecting IS_NOT_EMPTY() for list:string?

2011-10-21 Thread TheSweetlink
I have a SQLFORM.factory that is respecting IS_NOT_EMPTY() for a field
with type='string' but not respecting it for a diffirent field of
type='list:string'.

If the list:string type field is left empty the form validates.

Confirmed with firebug.

Tested with form.accepts, form.process(...).accepted, and
form.validate.

I tried removing all other conditions in the list:string field's
requirements as well as setting it manually after the form is created
with:

form.element('#no_table_yayweb2py')['requires']=IS_NOT_EMPTY()

The form uses an onvalidation= and again, it works for the plain
string but not a field of list:string

The form is validated no matter what I do.

Your thoughts are most appreciated.

David


[web2py] jQuery UI tabs selected tab.

2011-10-21 Thread annet
I am working on a timetable app using jQuery UI tab.


This is the timetable view:

!-- Tabs --
 h2 class=demoHeadersLesrooster/h2
   div id=tabs
  ul
lia href={{=URL('classtimes',args=[1])}}Monday/a/li
 lia href={{=URL('classtimes',args=[2])}}Tuesday/a/
li
 lia href={{=URL('classtimes',args=[3])}}Wednesday/a/
li
 lia href={{=URL('classtimes',args=[4])}}Thursday/a/
li
 lia href={{=URL('classtimes',args=[5])}}Friday/a/li
  lia href={{=URL('classtimes',args=[6])}}Saturday/a/
li
  lia href={{=URL('classtimes',args=[7])}}Sunday/a/
li
   lia href={{=URL('classtimes',args=['week'])}}Week/
a/li
 /ul
/div !-- tabs --


This the controller:

def timetable():
return dict()

def classtimes():
if request.args(0)=='week':
weekday='all'
rows=db(db.lesrooster.bedrijf_id==1).select(db.lesrooster.ALL,
\
orderby=db.lesrooster.dag_id|db.lesrooster.tijd)
else:
weekday=[]
 
rows=db((db.lesrooster.bedrijf_id==1)(db.lesrooster.dag_id==request.args(0))).select(db.lesrooster.ALL
\
,orderby=db.lesrooster.tijd)
return dict(rows=rows)

The classtimes view is a table based view.

This all works, what I don't get to work is the selected tab being
today's tab, i.e. when today is Friday, Friday's classes should be
displayed in the Friday tab.

I hope one of you will be able to help me solve this problem.

Kind regards,

Annet


[web2py] Re: Is there something like an optional requires

2011-10-21 Thread Calycé
That's exactly what I'm experiencing. Do I need to file a bug ?

On Oct 21, 4:11 pm, Anthony abasta...@gmail.com wrote:
 I *think* if you submit a form and immediately reload a new form (as part of
 the same action), the new form's dropdown is populated (via the IS_IN_DB
 validator) before the db insert of the submitted form, so the new form
 doesn't have the most up-to-date set of values. If that's the case, it
 should probably be fixed.







 On Friday, October 21, 2011 9:28:38 AM UTC-4, Calycé wrote:

  Thanks a lot to both of you the IS_EMPTY_OR() was indeed what I was
  needing (note to self: reread the book...)

  Could anyone of you tell me when the the combo is populated ? I'm just
  asking because now, when I enter a record using the appadmin
  interface, the new record is not appearing in the combo but is
  correctly inserted in the table. I have to reload the page in order to
  see the last inserted category in the combo.

  For the 0 or it's a bad cut 'n paste... my bad.

  On Oct 21, 2:56 pm, DenesL dene...@yahoo.ca wrote:
   Hi Calycé,

   note that:
   store.category.parent_category.requires = 0 or IS_IN_DB(db,
   db.category.id, '%(name)s')
   is equivalent to:
   store.category.parent_category.requires = IS_IN_DB(db, db.category.id,
   '%(name)s')
   since 0 evaluates to False.

   I believe that what you want is:
   store.category.parent_category.requires = IS_EMPTY_OR(IS_IN_DB(db,
   db.category.id, '%(name)s'))

   Denes.

   On Oct 21, 3:35 am, Calycé welcome.t...@gmail.com wrote:

Hi all,

I have created a table with a self reference as described below:
db.define_table('category',
    Field('parent_category', 'reference category'),
    Field('name', 'string', length=40, required=True),
    Field('description', 'text', required=True),
    Field('small_image', 'upload'))

Now I'd like to have an optional requires clause. For example, if I
add the following clause store.category.parent_category.requires = 0
or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo
whenever I use the appdadmin to insert rows BUT I have to select
something from the combo. In my case, the parent_category field should
be optional. In extenso, categories without parent_category would be
root categories so selecting a parent_category is optional.

Is there a way to present a combo as does the requires but without
enforcing the field ? Do I have to create a specific form for that ?


[web2py] How to use SQLFORM.widgets.checkboxes.widget to insert multiple values to DB? Is this even the correct widget to use? The correct way to do what I want to do?

2011-10-21 Thread Nate Atkinson
Hi,

I have a question on using the checkboxes widget, and the correct way
to go about what I want to do. Here's some background:

The company I work for places environmental monitoring equipment in
the field. I recently made a small database application to keep track
of where we have equipment. My boss has asked if I can include payment
details in the database. I said sure.

The business logic goes about like this--
Someone called a sitefinder finds a place where we can put some
equipment. Every so often, the sitefinder will send an invoice to the
head office for his sites. Head office sends the sitefinder a check.
Usually the first check is for the value of (# of sites) * (price per
site) * 70%. After the equipment has been on site for a month, the
sitefinder will get another check for the additional 30%. Sometimes,
the check will be mixed-- for example 5 new sites @ 70% and 4 old
sites @ 30%.

So, I already had a table for the sites where we have equipment. It's
db.plads (name is for legacy reasons). There's also a table for the
sitefinders (db.wards-- also for legacy reasons). There are a few
other tables (status, state, etc.).

I added two tables. They are db.payments and db.payment details.


The models for the two new tables look like this:

db.define_table('payments',
Field('sitefinder', db.wards),
Field('date', 'date'),
Field('amount', 'double'),
Field('comments', 'text'),
format = '%(sitefinder.wardname)s, %(date)s')

db.payments.sitefinder.requires = IS_IN_DB(db, db.wards.id, '%
(wardname)s')
db.payments.date.requires = IS_DATE()

db.define_table('paymentdetails',
Field('payment', db.payments),
Field('plads', db.plads),
Field('percentage', 'integer'))

db.paymentdetails.payment.requires = IS_IN_DB(db, db.payments.id, '%
(sitefinder)s, %(date)s')
db.paymentdetails.plads.requires = IS_IN_DB(db, db.plads.id, '%
(name)s, %(address)s')


The idea is that when we pay someone the boss (or more likely, me
doing the data entry) will create a new payment showing who we are
paying, the date, amount we're paying, and various notes (like check
#, etc.). Once the payment is created, we add sites to the payment
(paymentdetails table).

The most straightforward way I can think of to do this is to have a
page showing a list of all sites from a sitefinder that are eligible
for payment. There should be a checkbox next to each site, and box at
the bottom to enter the percentage of payment. So, I can check 5
sites, enter 70 in the percentage box, hit submit, and 5 rows will be
added to the paymentdetails table containing the payment id, place id,
and percentage of payment.

Here's the code that I've written to implement this (not the
prettiest, still a work in progress):

Controller:

def paymentdetails():

def gettotalpercent(somesite):
#Calculates total percentage of payments on a site
percentset = [x.percentage for x in
somesite.paymentdetails.select()]
return sum(percentset)

#Query database for already existing paymentdetails on this
payment
payment = db.payments(request.args(0))
details = db(db.paymentdetails.payment == db.payments.id).select()

#Generate the list of sites from sitefinder w/ less than 100%
payment for checkboxes widget
placedbysitefinder = db(db.plads.sitefinder ==
payment.sitefinder).select()
placedlessthan100 = filter(lambda a: gettotalpercent(a)  100,
placedbysitefinder)
placeddict = {}
for place in placedlessthan100:
placeddict[place.id] = place.name + ', ' +
str(gettotalpercent(place)) + '%'

#create a the SQL form. Shows a checkbox widget with all sites
from sitefinder that haven't been fully paid
#user can check which sites to add to a payment, and input the
percentage of payment
addform = SQLFORM.factory(
Field('Add', requires=IS_EMPTY_OR(IS_IN_SET(placeddict,
zero=T('Choose One'))),
widget=SQLFORM.widgets.checkboxes.widget),
Field('Percentage',
requires=IS_EMPTY_OR(IS_INT_IN_RANGE(0,101)))
)

#step through all of the checked sites and insert them into
paymentdetails
if addform.process().accepted:
percentage = addform.vars.Percentage
for place in addform.vars.Add:
db.paymentdetails.insert(payment = payment.id, plads =
place, percentage = percentage)
redirect(URL('paymentdetails', args=payment.id))

return dict(details = details, addform = addform)

View:

{{extend 'layout.html'}}
h1This is the default/paymentdetails.html template/h1
{{=details}}
{{=addform}}



So, this kind of works, but not really. I'm running into two problems:

1) In the following section of code:

for place in addform.vars.Add:
db.paymentdetails.insert(payment = payment.id, plads =
place, percentage = percentage)

The value that gets inserted is not plads.id. Instead, it appears that
the index of site in 

Re: [web2py] jQuery UI tabs selected tab.

2011-10-21 Thread Richard Vézina
Here the api of tabs plugin :

selected http://jqueryui.com/demos/tabs/#option-selectedNumberDefault:0

Zero-based index of the tab to be selected on initialization. To set all
tabs to unselected pass -1 as value.
Code examplesInitialize a tabs with the selected option specified.

$( .selector ).tabs({ selected: 3 });

Get or set the selected option, after init.

//getter
var selected = $( .selector ).tabs( option, selected );
//setter
$( .selector ).tabs( option, selected, 3 );



I think you only have to pass the actual weekday as a selected value of you
tabs init code...

You can do this like that :

var actual_day = {{=actual_weekday_passed_from_web2py_controller}}



$( .selector ).tabs( option, selected, actual_day );


I didn't test any thing... But, I guest it should works...

Richard

On Fri, Oct 21, 2011 at 12:51 PM, annet annet.verm...@gmail.com wrote:

 I am working on a timetable app using jQuery UI tab.


 This is the timetable view:

 !-- Tabs --
  h2 class=demoHeadersLesrooster/h2
   div id=tabs
  ul
lia href={{=URL('classtimes',args=[1])}}Monday/a/li
 lia href={{=URL('classtimes',args=[2])}}Tuesday/a/
 li
 lia href={{=URL('classtimes',args=[3])}}Wednesday/a/
 li
 lia href={{=URL('classtimes',args=[4])}}Thursday/a/
 li
 lia href={{=URL('classtimes',args=[5])}}Friday/a/li
  lia href={{=URL('classtimes',args=[6])}}Saturday/a/
 li
  lia href={{=URL('classtimes',args=[7])}}Sunday/a/
 li
   lia href={{=URL('classtimes',args=['week'])}}Week/
 a/li
 /ul
/div !-- tabs --


 This the controller:

 def timetable():
return dict()

 def classtimes():
if request.args(0)=='week':
weekday='all'
rows=db(db.lesrooster.bedrijf_id==1).select(db.lesrooster.ALL,
 \
 orderby=db.lesrooster.dag_id|db.lesrooster.tijd)
else:
weekday=[]


 rows=db((db.lesrooster.bedrijf_id==1)(db.lesrooster.dag_id==request.args(0))).select(db.lesrooster.ALL
 \
 ,orderby=db.lesrooster.tijd)
return dict(rows=rows)

 The classtimes view is a table based view.

 This all works, what I don't get to work is the selected tab being
 today's tab, i.e. when today is Friday, Friday's classes should be
 displayed in the Friday tab.

 I hope one of you will be able to help me solve this problem.

 Kind regards,

 Annet


[web2py] Re: Is there something like an optional requires

2011-10-21 Thread Massimo Di Pierro
You can file a request for improvement. This cannot be changed without
hitting the db twice: to validate the field to update the options.
Right now we ask that is done explicitly.





On Oct 21, 12:02 pm, Calycé welcome.to.dev.n...@gmail.com wrote:
 That's exactly what I'm experiencing. Do I need to file a bug ?

 On Oct 21, 4:11 pm, Anthony abasta...@gmail.com wrote:







  I *think* if you submit a form and immediately reload a new form (as part of
  the same action), the new form's dropdown is populated (via the IS_IN_DB
  validator) before the db insert of the submitted form, so the new form
  doesn't have the most up-to-date set of values. If that's the case, it
  should probably be fixed.

  On Friday, October 21, 2011 9:28:38 AM UTC-4, Calycé wrote:

   Thanks a lot to both of you the IS_EMPTY_OR() was indeed what I was
   needing (note to self: reread the book...)

   Could anyone of you tell me when the the combo is populated ? I'm just
   asking because now, when I enter a record using the appadmin
   interface, the new record is not appearing in the combo but is
   correctly inserted in the table. I have to reload the page in order to
   see the last inserted category in the combo.

   For the 0 or it's a bad cut 'n paste... my bad.

   On Oct 21, 2:56 pm, DenesL dene...@yahoo.ca wrote:
Hi Calycé,

note that:
store.category.parent_category.requires = 0 or IS_IN_DB(db,
db.category.id, '%(name)s')
is equivalent to:
store.category.parent_category.requires = IS_IN_DB(db, db.category.id,
'%(name)s')
since 0 evaluates to False.

I believe that what you want is:
store.category.parent_category.requires = IS_EMPTY_OR(IS_IN_DB(db,
db.category.id, '%(name)s'))

Denes.

On Oct 21, 3:35 am, Calycé welcome.t...@gmail.com wrote:

 Hi all,

 I have created a table with a self reference as described below:
 db.define_table('category',
     Field('parent_category', 'reference category'),
     Field('name', 'string', length=40, required=True),
     Field('description', 'text', required=True),
     Field('small_image', 'upload'))

 Now I'd like to have an optional requires clause. For example, if I
 add the following clause store.category.parent_category.requires = 0
 or IS_IN_DB(db, db.category.id, '%(name)s') I have a nice combo
 whenever I use the appdadmin to insert rows BUT I have to select
 something from the combo. In my case, the parent_category field should
 be optional. In extenso, categories without parent_category would be
 root categories so selecting a parent_category is optional.

 Is there a way to present a combo as does the requires but without
 enforcing the field ? Do I have to create a specific form for that ?


[web2py] Specifying Fields in Grid

2011-10-21 Thread horridohobbyist
I'm trying to specify exactly which fields to display in a grid, but I
just can't get the syntax right. And the docs are of no help.

Here's what I tried, among other things:

SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=False,searchable=False,details=False,maxtextlength=100,fields=[db.products.name,db.products.description,db.products.price])

No matter what I put into fields=, I keep getting an error. What is
the correct syntax, please?

Thanks,
Richard


[web2py] Re: Specifying Fields in Grid

2011-10-21 Thread Nate Atkinson
Have you tried including db.products.id in the fields?

On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:
 I'm trying to specify exactly which fields to display in a grid, but I
 just can't get the syntax right. And the docs are of no help.

 Here's what I tried, among other things:

 SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa 
 lse,searchable=False,details=False,maxtextlength=100,fields=[db.products.na 
 me,db.products.description,db.products.price])

 No matter what I put into fields=, I keep getting an error. What is
 the correct syntax, please?

 Thanks,
 Richard


[web2py] Re: Specifying Fields in Grid

2011-10-21 Thread horridohobbyist
No, but I don't want to display the id. Is this mandatory?

Richard

On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:
 Have you tried including db.products.id in the fields?

 On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:







  I'm trying to specify exactly which fields to display in a grid, but I
  just can't get the syntax right. And the docs are of no help.

  Here's what I tried, among other things:

  SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa 
  lse,searchable=False,details=False,maxtextlength=100,fields=[db.products.na 
  me,db.products.description,db.products.price])

  No matter what I put into fields=, I keep getting an error. What is
  the correct syntax, please?

  Thanks,
  Richard


[web2py] Re: Specifying Fields in Grid

2011-10-21 Thread horridohobbyist
I'm guessing it's mandatory. I suppose I can live with it.

Thanks.

On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:
 Have you tried including db.products.id in the fields?

 On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:







  I'm trying to specify exactly which fields to display in a grid, but I
  just can't get the syntax right. And the docs are of no help.

  Here's what I tried, among other things:

  SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa 
  lse,searchable=False,details=False,maxtextlength=100,fields=[db.products.na 
  me,db.products.description,db.products.price])

  No matter what I put into fields=, I keep getting an error. What is
  the correct syntax, please?

  Thanks,
  Richard


Re: [web2py] Re: Specifying Fields in Grid

2011-10-21 Thread Martín Mulone
yes, but you can use columns instead of fields.

2011/10/21 horridohobbyist horrido.hobb...@gmail.com

 No, but I don't want to display the id. Is this mandatory?

 Richard

 On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:
  Have you tried including db.products.id in the fields?
 
  On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:
 
 
 
 
 
 
 
   I'm trying to specify exactly which fields to display in a grid, but I
   just can't get the syntax right. And the docs are of no help.
 
   Here's what I tried, among other things:
 
  
 SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa
 lse,searchable=False,details=False,maxtextlength=100,fields=[
 db.products.na me,db.products.description,db.products.price])
 
   No matter what I put into fields=, I keep getting an error. What is
   the correct syntax, please?
 
   Thanks,
   Richard




-- 
 http://martin.tecnodoc.com.ar


[web2py] Adding SELECT Field to SQLFORM.factory

2011-10-21 Thread horridohobbyist
I don't know how to add a SELECT field (dropdown list) to
SQLFORM.factory. I want to create a form without a database table, and
one of the fields should be a dropdown list with a fixed set of items.

The sample syntax I've seen is like...

SQLFORM.factory(db.table,
Field(...),
Field(...),

How do you make one of those Fields a SELECT?

Thanks,
Richard


Re: [web2py] Re: Running web2py in an apache directory

2011-10-21 Thread José Luis Redrejo Rodríguez
2011/10/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 Can you show us your routes?




The application name is controlies, placed at
/var/web2py/applications/controlies

a web2py-apache file placed at /etc/apache2/conf.d contains:


        WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py

        WSGIDaemonProcess web2py user=www-data group=www-data \
                          home=/var processes=5 \
                          maximum-requests=1 \
                          threads=1

        Location /controlies
            Order deny,allow
            Allow from all
            WSGIProcessGroup web2py
        /Location



And /var/web2py/subwsgihandler.py is the same as the one at
http://www.web2pyslices.com/slices/take_slice/56

It all works correctly with web2py up to 1.95.1, but not since 1.96.1 .










 On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks


[web2py] Re: Specifying Fields in Grid

2011-10-21 Thread horridohobbyist
I tried columns, but it just seems to be ignored.

Richard

On Oct 21, 1:48 pm, Martín Mulone mulone.mar...@gmail.com wrote:
 yes, but you can use columns instead of fields.

 2011/10/21 horridohobbyist horrido.hobb...@gmail.com









  No, but I don't want to display the id. Is this mandatory?

  Richard

  On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:
   Have you tried including db.products.id in the fields?

   On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:

I'm trying to specify exactly which fields to display in a grid, but I
just can't get the syntax right. And the docs are of no help.

Here's what I tried, among other things:

  SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa
  lse,searchable=False,details=False,maxtextlength=100,fields=[
  db.products.na me,db.products.description,db.products.price])

No matter what I put into fields=, I keep getting an error. What is
the correct syntax, please?

Thanks,
Richard

 --
  http://martin.tecnodoc.com.ar


Re: [web2py] Re: Running web2py in an apache directory

2011-10-21 Thread José Luis Redrejo Rodríguez
El día 21 de octubre de 2011 19:51, José Luis Redrejo Rodríguez
jredr...@debian.org escribió:
 2011/10/21 Massimo Di Pierro massimo.dipie...@gmail.com:
 Can you show us your routes?




 The application name is controlies, placed at
 /var/web2py/applications/controlies

 a web2py-apache file placed at /etc/apache2/conf.d contains:

 
         WSGIScriptAlias /controlies /var/web2py/subwsgihandler.py

         WSGIDaemonProcess web2py user=www-data group=www-data \
                           home=/var processes=5 \
                           maximum-requests=1 \
                           threads=1

         Location /controlies
             Order deny,allow
             Allow from all
             WSGIProcessGroup web2py
         /Location

 

 And /var/web2py/subwsgihandler.py is the same as the one at
 http://www.web2pyslices.com/slices/take_slice/56

 It all works correctly with web2py up to 1.95.1, but not since 1.96.1 .





I've forgotten this in my previous email, there is also a symbolic link:

 /var/web2py/applications/controlies -  /var/web2py/applications/init







 On Oct 21, 5:20 am, José L. jredr...@gmail.com wrote:
 Hi,
 I've been running successfully web2py under apache in a directory following
 the slice athttp://www.web2pyslices.com/slices/take_slice/56. I need it
 running in a subdirectory because this apache server is running some other
 apps, some of them in php.

 It worked perfectly with version 1.95.1, but after trying to update web2py
 to versions =1.96.1, it doesn't work.

 I see this behaviour when going to the url where web2py should 
 work:http://miserver/mysubdir
 with 1.95.1, it redirects 
 to:http://miserver/mysubdir/init/default/user/login?_next=/mysubdir/init...
 but with versions =1.96.1 it redirects 
 to:http://miserver/init/default/user/login?_next=/init/default/index

 So, web2py it's removing the /mysubdir/ part somewhere.

 After checking the changelog between both versions I can not find anything
 related to this routes changes. Running under apache I'm not using the
 routes.py file nor changing apache configuration between web2py versions.

 Any idea?
 Thanks



Re: [web2py] Re: Specifying Fields in Grid

2011-10-21 Thread Martín Mulone
which version of web2py?. was a bug .. update to last from trunk or pass
like string:

columns = ['products.description']

2011/10/21 horridohobbyist horrido.hobb...@gmail.com

 I tried columns, but it just seems to be ignored.

 Richard

 On Oct 21, 1:48 pm, Martín Mulone mulone.mar...@gmail.com wrote:
  yes, but you can use columns instead of fields.
 
  2011/10/21 horridohobbyist horrido.hobb...@gmail.com
 
 
 
 
 
 
 
 
 
   No, but I don't want to display the id. Is this mandatory?
 
   Richard
 
   On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:
Have you tried including db.products.id in the fields?
 
On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com
 wrote:
 
 I'm trying to specify exactly which fields to display in a grid,
 but I
 just can't get the syntax right. And the docs are of no help.
 
 Here's what I tried, among other things:
 
  
 SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa
   lse,searchable=False,details=False,maxtextlength=100,fields=[
   db.products.na me,db.products.description,db.products.price])
 
 No matter what I put into fields=, I keep getting an error. What
 is
 the correct syntax, please?
 
 Thanks,
 Richard
 
  --
   http://martin.tecnodoc.com.ar




-- 
 http://martin.tecnodoc.com.ar


[web2py] Re: Adding SELECT Field to SQLFORM.factory

2011-10-21 Thread Anthony
Try

Field(..., requires=IS_IN_SET(...))


On Friday, October 21, 2011 1:51:09 PM UTC-4, horridohobbyist wrote:

 I don't know how to add a SELECT field (dropdown list) to 
 SQLFORM.factory. I want to create a form without a database table, and 
 one of the fields should be a dropdown list with a fixed set of items. 

 The sample syntax I've seen is like... 

 SQLFORM.factory(db.table, 
 Field(...), 
 Field(...), 

 How do you make one of those Fields a SELECT? 

 Thanks, 
 Richard



[web2py] Re: How to use SQLFORM.widgets.checkboxes.widget to insert multiple values to DB? Is this even the correct widget to use? The correct way to do what I want to do?

2011-10-21 Thread Nate Atkinson
So, I came to a solution by changing a line in the SQLFORM.factory as
so:

Field('Add', requires=IS_EMPTY_OR(IS_IN_SET(placeddict,
multiple = True)),
widget=SQLFORM.widgets.multiple.widget),

The multiple widget seems to work for this. I'd rather have
checkboxes, but unless anyone has a solution using checkboxes, this
will have to do.


On Oct 21, 1:07 pm, Nate Atkinson nja.perso...@gmail.com wrote:
 Hi,

 I have a question on using the checkboxes widget, and the correct way
 to go about what I want to do. Here's some background:

 The company I work for places environmental monitoring equipment in
 the field. I recently made a small database application to keep track
 of where we have equipment. My boss has asked if I can include payment
 details in the database. I said sure.

 The business logic goes about like this--
 Someone called a sitefinder finds a place where we can put some
 equipment. Every so often, the sitefinder will send an invoice to the
 head office for his sites. Head office sends the sitefinder a check.
 Usually the first check is for the value of (# of sites) * (price per
 site) * 70%. After the equipment has been on site for a month, the
 sitefinder will get another check for the additional 30%. Sometimes,
 the check will be mixed-- for example 5 new sites @ 70% and 4 old
 sites @ 30%.

 So, I already had a table for the sites where we have equipment. It's
 db.plads (name is for legacy reasons). There's also a table for the
 sitefinders (db.wards-- also for legacy reasons). There are a few
 other tables (status, state, etc.).

 I added two tables. They are db.payments and db.payment details.

 The models for the two new tables look like this:

 db.define_table('payments',
                 Field('sitefinder', db.wards),
                 Field('date', 'date'),
                 Field('amount', 'double'),
                 Field('comments', 'text'),
                 format = '%(sitefinder.wardname)s, %(date)s')

 db.payments.sitefinder.requires = IS_IN_DB(db, db.wards.id, '%
 (wardname)s')
 db.payments.date.requires = IS_DATE()

 db.define_table('paymentdetails',
                 Field('payment', db.payments),
                 Field('plads', db.plads),
                 Field('percentage', 'integer'))

 db.paymentdetails.payment.requires = IS_IN_DB(db, db.payments.id, '%
 (sitefinder)s, %(date)s')
 db.paymentdetails.plads.requires = IS_IN_DB(db, db.plads.id, '%
 (name)s, %(address)s')

 The idea is that when we pay someone the boss (or more likely, me
 doing the data entry) will create a new payment showing who we are
 paying, the date, amount we're paying, and various notes (like check
 #, etc.). Once the payment is created, we add sites to the payment
 (paymentdetails table).

 The most straightforward way I can think of to do this is to have a
 page showing a list of all sites from a sitefinder that are eligible
 for payment. There should be a checkbox next to each site, and box at
 the bottom to enter the percentage of payment. So, I can check 5
 sites, enter 70 in the percentage box, hit submit, and 5 rows will be
 added to the paymentdetails table containing the payment id, place id,
 and percentage of payment.

 Here's the code that I've written to implement this (not the
 prettiest, still a work in progress):

 Controller:

 def paymentdetails():

     def gettotalpercent(somesite):
         #Calculates total percentage of payments on a site
         percentset = [x.percentage for x in
 somesite.paymentdetails.select()]
         return sum(percentset)

     #Query database for already existing paymentdetails on this
 payment
     payment = db.payments(request.args(0))
     details = db(db.paymentdetails.payment == db.payments.id).select()

     #Generate the list of sites from sitefinder w/ less than 100%
 payment for checkboxes widget
     placedbysitefinder = db(db.plads.sitefinder ==
 payment.sitefinder).select()
     placedlessthan100 = filter(lambda a: gettotalpercent(a)  100,
 placedbysitefinder)
     placeddict = {}
     for place in placedlessthan100:
         placeddict[place.id] = place.name + ', ' +
 str(gettotalpercent(place)) + '%'

     #create a the SQL form. Shows a checkbox widget with all sites
 from sitefinder that haven't been fully paid
     #user can check which sites to add to a payment, and input the
 percentage of payment
     addform = SQLFORM.factory(
         Field('Add', requires=IS_EMPTY_OR(IS_IN_SET(placeddict,
 zero=T('Choose One'))),
             widget=SQLFORM.widgets.checkboxes.widget),
         Field('Percentage',
 requires=IS_EMPTY_OR(IS_INT_IN_RANGE(0,101)))
         )

     #step through all of the checked sites and insert them into
 paymentdetails
     if addform.process().accepted:
         percentage = addform.vars.Percentage
         for place in addform.vars.Add:
             db.paymentdetails.insert(payment = payment.id, plads =
 place, percentage = percentage)
         redirect(URL('paymentdetails', args=payment.id))


[web2py] Book overview form appearance

2011-10-21 Thread Paul
I am just starting with web2py. I am going through the online book. When I 
do the final MyApp, the word form appears on the page. From where did this 
come? Likewise, the line {{=BEAUTIFY(response._vars)}} was automatically 
gennerated and appears to display the form a second time.

What is your name?
form:

What's going on?


Re: [web2py] Book overview form appearance

2011-10-21 Thread Richard Vézina
I suspect that you did not pass the dict adequately from your controller...

It could help if you post your controller code and view code...

Richard

On Fri, Oct 21, 2011 at 2:38 PM, Paul paul.hermeneu...@gmail.com wrote:

 I am just starting with web2py. I am going through the online book. When I
 do the final MyApp, the word form appears on the page. From where did this
 come? Likewise, the line {{=BEAUTIFY(response._vars)}} was automatically
 gennerated and appears to display the form a second time.

 What is your name?
 form:

 What's going on?



[web2py] Re: Specifying Fields in Grid

2011-10-21 Thread Omi Chiba
You can hide id field like this.

db.products.id.readable = False

SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa
lse,searchable=False,details=False,maxtextlength=100,fields=[db.products.id,db.products.name,db.products.description,db.products.price])


On Oct 21, 12:47 pm, horridohobbyist horrido.hobb...@gmail.com
wrote:
 I'm guessing it's mandatory. I suppose I can live with it.

 Thanks.

 On Oct 21, 1:35 pm, Nate Atkinson nja.perso...@gmail.com wrote:







  Have you tried including db.products.id in the fields?

  On Oct 21, 1:30 pm, horridohobbyist horrido.hobb...@gmail.com wrote:

   I'm trying to specify exactly which fields to display in a grid, but I
   just can't get the syntax right. And the docs are of no help.

   Here's what I tried, among other things:

   SQLFORM.grid(db.products,deletable=False,editable=False,create=False,csv=Fa

   lse,searchable=False,details=False,maxtextlength=100,fields=[db.products.na
me,db.products.description,db.products.price])

   No matter what I put into fields=, I keep getting an error. What is
   the correct syntax, please?

   Thanks,
   Richard


[web2py] Web2py and Rest

2011-10-21 Thread BrendanC
I know this has probably come up before, but I'd like to get my head around 
the options to use Restful URLs with Web2py.  

Are there any (recent) docs I can reference? I know there are some old 
threads, but would like to get an idea where things stand currently.

(BTW - I'm not totally sold on rest, but restful url design seems to have 
captured a lot of mindshare with developers (possibly due to rails support) 
and seems to be a potential issue when choosing a webframework for a new 
project. 

Maybe this is something that could be added to the faq. 

Brendan






[web2py] Re: Contribution

2011-10-21 Thread Triquetra
I think a standalone workflow system is too high level.

Workflow type systems (among other things) can be more than adequately
developed with robust access control mechanisms.  I'd like to see
web2py's access control beefed up (thus permitting easy development of
workflows, among other things).  Specifically, the current web2py RBAC
has two levels of granularity: table and record (row).  This should be
extended to include field(column), type(controller), and
context(state).  The first is implemented in other RBAC systems (e.g.
Drupal), but not in web2py (at least not that I can tell).  The latter
two are ideas borrowed from SELinux.

If these were in place, then workflows could easily be implemented by,
e.g. specifying different permissions for a given role for each
context(state) of a record or table(record type).

Although the type(controller) access control is currently implemented
via decorators in web2py, this is restricted to coders.  Providing an
extra layer of abstraction to this mechanism would permit this level
of access control to be manipulated by users (eg. non-coder site
managers).

On Oct 21, 7:55 am, António Ramos ramstei...@gmail.com wrote:
 May i suggest a workflow framework in web2py?
 Django has one
 I want one :(

 2011/10/21 Hong-Khoan Quach hongkhoanqu...@googlemail.com







  Hi there.

  We would like to contribute to web2py for a university open source
  practical course. Does anyone have an idea for an important/cool feature
  that we could propose to our supervisor?
  Furthermore, are there any low hanging fruits, we can start with?

  Regards

  Matteo and Hong-Khoan


Re: [web2py] Contribution

2011-10-21 Thread Richard Vézina
See GoFlow...

I would love to have it into web2py...

Richard

2011/10/21 António Ramos ramstei...@gmail.com

 May i suggest a workflow framework in web2py?
 Django has one
 I want one :(


 2011/10/21 Hong-Khoan Quach hongkhoanqu...@googlemail.com

 Hi there.

 We would like to contribute to web2py for a university open source
 practical course. Does anyone have an idea for an important/cool feature
 that we could propose to our supervisor?
 Furthermore, are there any low hanging fruits, we can start with?

 Regards

 Matteo and Hong-Khoan





[web2py] Re: Book overview form appearance

2011-10-21 Thread Anthony
On Friday, October 21, 2011 2:38:49 PM UTC-4, Paul wrote:

 I am just starting with web2py. I am going through the online book. When I 
 do the final MyApp, the word form appears on the page. From where did this 
 come? Likewise, the line {{=BEAUTIFY(response._vars)}} was automatically 
 gennerated and appears to display the form a second time.


The word form and the second instance of the form are being generated by 
the {{=BEAUTIFY(response._vars)}}. How did that get in your view file? Can 
you show the exact code of your controller action and view file? Do you 
have {{=BEAUTIFY(response._vars)}} in your layout.html file?

Anthony


[web2py] Re: Contribution

2011-10-21 Thread Anthony
On Friday, October 21, 2011 3:54:26 PM UTC-4, Triquetra wrote:

 I'd like to see 
 web2py's access control beefed up (thus permitting easy development of 
 workflows, among other things).  Specifically, the current web2py RBAC 
 has two levels of granularity: table and record (row). This should be 

extended to include field(column), type(controller), and 
 context(state).


auth.add_permission(group_id, 'name', 'object', record_id)

In the above, 'object' can be any user-defined object, not just a DB table 
(record_id is only relevant if the object is a table). Does that help? 
 

 Although the type(controller) access control is currently implemented 
 via decorators in web2py, this is restricted to coders.


You don't have to use decorators. You can directly check for permissions via 
auth.has_membership() and auth.has_permission().



[web2py] Re: Book overview form appearance

2011-10-21 Thread Paul
To my knowledge, the BEAUTIFY line came with the default view file. I 
certainly would not know to type that line.

Is there a configuration setting that I have changed or need to change?

def first():
form = FORM(INPUT(_name='visitor_name', requires=IS_NOT_EMPTY()),
INPUT(_type='submit'))
if form.process().accepted:
session.visitor_name = form.vars.visitor_name
redirect(URL('second'))
return dict(form=form)

{{extend 'layout.html'}}
What is your name?
{{=form}}
{{=BEAUTIFY(response._vars)}}


[web2py] Re: jQuery UI tabs selected tab.

2011-10-21 Thread Cliff
Haven't tried Richard's way, but here is how I do it.

You need landing areas for your data.
Something like this:

div id=tabsul
lia href={{=URL('classtimes',args='tab_1')}}Monday/a/
li
 lia href={{=URL('classtimes',args='tab_2')}}Tuesday/
a/
li
 lia href={{=URL('classtimes',args='tab_3')}}Wednesday/
a/
li
 lia href={{=URL('classtimes',args='tab_4')}}Thursday/
a/
li
 lia href={{=URL('classtimes',args='tab_5')}}Friday/a/
li
  lia href={{=URL('classtimes',args='tab_6')}}Saturday/
a/
li
  lia href={{=URL('classtimes',args='tab_7')}}Sunday/
a/
li
   lia href={{=URL('classtimes',args=['week'])}}Week/
a/li
 /ul
/div!--tabs--
div id=tab_1
{{=stuff_to_go_on_tab_1}}
/div
div id=tab_2
{{=stuff_to_go_on_tab_2}}
/div
.
.
.

In the controller:

def function_associated_with_the_view():

## get records for tab 1 from the db
## build the table of info for tab 1
stuff_to_go_on_tab_1 = TABLE(...yada, yada) # or whatever


## get records for tab  from the db
## build the table of info for tab 2
stuff_to_go_on_tab_2 = TABLE(...yada, yada)

...

return dict(
stuff_to_go_on_tab_1=stuff_to_go_on_tab_1,
stuff_to_go_on_tab_2=stuff_to_go_on_tab_2,
...
)

Also note you don't need to use line continuation inside a tuple,
list, or dictionary.

URL doesn't need the list delimiters if there's only one arg.


On Oct 21, 1:12 pm, Richard Vézina ml.richard.vez...@gmail.com
wrote:
 Here the api of tabs plugin :

 selected http://jqueryui.com/demos/tabs/#option-selectedNumberDefault:0

 Zero-based index of the tab to be selected on initialization. To set all
 tabs to unselected pass -1 as value.
 Code examplesInitialize a tabs with the selected option specified.

 $( .selector ).tabs({ selected: 3 });

 Get or set the selected option, after init.

 //getter
 var selected = $( .selector ).tabs( option, selected );
 //setter
 $( .selector ).tabs( option, selected, 3 );

 I think you only have to pass the actual weekday as a selected value of you
 tabs init code...

 You can do this like that :

     var actual_day = {{=actual_weekday_passed_from_web2py_controller}}

 $( .selector ).tabs( option, selected, actual_day );

 I didn't test any thing... But, I guest it should works...

 Richard







 On Fri, Oct 21, 2011 at 12:51 PM, annet annet.verm...@gmail.com wrote:
  I am working on a timetable app using jQuery UI tab.

  This is the timetable view:

  !-- Tabs --
   h2 class=demoHeadersLesrooster/h2
    div id=tabs
       ul
         lia href={{=URL('classtimes',args=[1])}}Monday/a/li
          lia href={{=URL('classtimes',args=[2])}}Tuesday/a/
  li
          lia href={{=URL('classtimes',args=[3])}}Wednesday/a/
  li
          lia href={{=URL('classtimes',args=[4])}}Thursday/a/
  li
          lia href={{=URL('classtimes',args=[5])}}Friday/a/li
           lia href={{=URL('classtimes',args=[6])}}Saturday/a/
  li
           lia href={{=URL('classtimes',args=[7])}}Sunday/a/
  li
            lia href={{=URL('classtimes',args=['week'])}}Week/
  a/li
          /ul
     /div !-- tabs --

  This the controller:

  def timetable():
     return dict()

  def classtimes():
     if request.args(0)=='week':
         weekday='all'
         rows=db(db.lesrooster.bedrijf_id==1).select(db.lesrooster.ALL,
  \
  orderby=db.lesrooster.dag_id|db.lesrooster.tijd)
     else:
         weekday=[]

  rows=db((db.lesrooster.bedrijf_id==1)(db.lesrooster.dag_id==request.args(0 
  ))).select(db.lesrooster.ALL
  \
  ,orderby=db.lesrooster.tijd)
     return dict(rows=rows)

  The classtimes view is a table based view.

  This all works, what I don't get to work is the selected tab being
  today's tab, i.e. when today is Friday, Friday's classes should be
  displayed in the Friday tab.

  I hope one of you will be able to help me solve this problem.

  Kind regards,

  Annet


[web2py] Re: Contribution

2011-10-21 Thread Cliff
It would be nice if we could nest groups.

How about that for a proposal?

On Oct 21, 4:08 pm, Anthony abasta...@gmail.com wrote:
 On Friday, October 21, 2011 3:54:26 PM UTC-4, Triquetra wrote:

  I'd like to see
  web2py's access control beefed up (thus permitting easy development of
  workflows, among other things).  Specifically, the current web2py RBAC
  has two levels of granularity: table and record (row). This should be

 extended to include field(column), type(controller), and

  context(state).

 auth.add_permission(group_id, 'name', 'object', record_id)

 In the above, 'object' can be any user-defined object, not just a DB table
 (record_id is only relevant if the object is a table). Does that help?

  Although the type(controller) access control is currently implemented
  via decorators in web2py, this is restricted to coders.

 You don't have to use decorators. You can directly check for permissions via
 auth.has_membership() and auth.has_permission().


[web2py] SOLVED join and sum - display in view

2011-10-21 Thread andrej burja
working example

controller:
def person():
sum = db.t_payement.f_value.sum()
rows= 
db().select(db.t_person.f_name,db.t_person.f_surname,db.t_person.f_city, 
sum, groupby=db.t_person.id, 
left=db.t_payement.on(db.t_person.id==db.t_payement.f_person)) 
return dict(rows=rows, sum=sum)

view:
{{for row in rows:}}
{{=TR(TD(row.t_person.f_name),TD(row[sum]))}}
{{pass}}





[web2py] Re: Book overview form appearance

2011-10-21 Thread Anthony
On Friday, October 21, 2011 4:46:31 PM UTC-4, Paul wrote:

 To my knowledge, the BEAUTIFY line came with the default view file.


What do you mean by default view file? The book tutorial instructs you to 
create a /views/default/first.html view file from scratch.


 


[web2py] Re: DAL: Selecting using the 'WHERE' clause

2011-10-21 Thread howesc
i've never seen that.

got a code example?  which version of the SDK?


[web2py] [Video] History of Python by GVR

2011-10-21 Thread Michele Comitini
Guido Van Rossum talk on Python History at Dropbox.

http://youtu.be/ugqu10JV7dk

mic


[web2py] Re: @auth.requires_login problem

2011-10-21 Thread brushek
And now is all ok, thank You, Massimo.

On 21 Paź, 16:03, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 typo in last commit. fixed now in trunk

 On Oct 21, 5:16 am, brushek luk...@chrustek.net wrote:







  On 21 Paź, 04:33, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   This is not fixed in trunk. Please check it.

  I don't know if You realy want to write is 'not fixed', but.. yes,
  this not fixed, but error is diffrent right now.
  Version of web2py:

  Version 1.99.3 (2011-10-20 22:43:34) dev

  Traceback (most recent call last):
    File /home/users/brushek/web2py/gluon/restricted.py, line 192, in
  restricted
      exec ccode in environment
    File /home/users/brushek/web2py/applications/test/controllers/
  default.py, line 72, in module
    File /home/users/brushek/web2py/gluon/globals.py, line 149, in
  lambda
      self._caller = lambda f: f()
    File /home/users/brushek/web2py/applications/test/controllers/
  default.py, line 34, in user
      return dict(form=auth())
    File /home/users/brushek/web2py/gluon/tools.py, line 1130, in
  __call__
      return getattr(self,args[0])()
    File /home/users/brushek/web2py/gluon/tools.py, line 1648, in
  login
      user = self.db(table_user[username] ==
  form.vars[username]).select().first()
    File /home/users/brushek/web2py/gluon/dal.py, line 5777, in select
      return self.db._adapter.select(self.query,fields,attributes)
    File /home/users/brushek/web2py/gluon/dal.py, line 1264, in select
      sql = self._select(query, fields, attributes)
    File /home/users/brushek/web2py/gluon/dal.py, line 1651, in
  _select
      sql = super(SQLiteAdapter, self)._select(query, fields,
  attributes)
    File /home/users/brushek/web2py/gluon/dal.py, line 1178, in
  _select
      if self.can_select_with_update is False and for_update is True:
  AttributeError: 'SQLiteAdapter' object has no attribute
  'can_select_with_update'


[web2py] Re: SQLFORM.grid / Powergrid

2011-10-21 Thread greenpoise
This is great but is there a grid that I can do an edit in place of a
field???



thanks


dan

On Oct 21, 6:56 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 On Oct 20, 11:07 pm, greenpoise danel.sega...@gmail.com wrote:

  I have a few questions regarding the grids.

  1. Is SQLFORM.grid the implementation of Powergrid?

 No but was inspired but it

  meaning, does
  SQLFORM.grid has all the features of Powergrid?

 Not sure. martin should answer that.

  2. Is there an option to edit a value on the fly rather than using an
  edit button? sort of like edit in place pyslice.

 No. because it uses no ajax.

  3. Is search as you type an option (type ahead)?

 No.







  Thanks

  Dan


[web2py] Re: SQLFORM.grid / Powergrid

2011-10-21 Thread Massimo Di Pierro
plugin_wiki contains jqGrid. Client side it supports it. Server side
it needs a missing action. Should be easy to add. Any takers?

On Oct 21, 6:26 pm, greenpoise danel.sega...@gmail.com wrote:
 This is great but is there a grid that I can do an edit in place of a
 field???

 thanks

 dan

 On Oct 21, 6:56 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  On Oct 20, 11:07 pm, greenpoise danel.sega...@gmail.com wrote:

   I have a few questions regarding the grids.

   1. Is SQLFORM.grid the implementation of Powergrid?

  No but was inspired but it

   meaning, does
   SQLFORM.grid has all the features of Powergrid?

  Not sure. martin should answer that.

   2. Is there an option to edit a value on the fly rather than using an
   edit button? sort of like edit in place pyslice.

  No. because it uses no ajax.

   3. Is search as you type an option (type ahead)?

  No.

   Thanks

   Dan


[web2py] Re: a couple of related questions

2011-10-21 Thread niknok
Anyone?

On Oct 21, 10:40 am, niknok nikolai...@gmail.com wrote:
 I have a person table[1] with a parent field with a clickable
 representation view of the record. If I put this on a grid and click on
 the link, I get a not authorized error message. I thought I need to
 pass the signature so I can make it viewable. (This works fine if
 parameter user_signature=False)

 Also, I have defined a default representation for the person table but
 in my validation statement, note that I had to specify the same format
 again. I'm wondering if there's a way to tell the validator to use the
 default representation of the person (which I thought was web2py's
 default behavior.)

 In my grid, I specified a new button [2] in the links parameter, how do
 I specificy an icon for this button? For example I want to use what's
 already in base.css (book, heart, cross etc.)

 /r
 Nik

 [1]
 db.define_table('person'
                 ,Field('birth_date', 'date', requires=IS_DATE())
                 ,Field('last_name', notnull=True)
                 ,Field('given_name', notnull=True)
                 ,Field('parent', 'list:reference person'
                                 ,requires=IS_EMPTY_OR(IS_IN_DB(db, 'person.id'
                                               ,'%(last_name)s,
 %(given_name)s [%(birth_date)s]'
                                               ,multiple=True
                                               ,zero=T('pick one')))
                                 ,represent =  lambda value, row: [A(' ▸'+
 db.person[v].given_name , _href = URL('index/view/person', args=[v]))
 for v in value])
                 ,auth.signature
                 ,format='%(last_name)s, %(given_name)s [%(birth_date)s]'
                 )

 [2]
  form=SQLFORM.grid( db.person
                       ,fields=[db.person.id, db.person.last_name,
 db.person.given_name
                                     ,db.person.middle_name,
 db.person.gender, db.person.birth_date, db.person.parent]
                       ,showbuttontext=False
                       ,sorter_icons=('[▴]','[▾]')
                       ,onvalidation=person_processing
                       ,links = [lambda row: A('X',
 _href=URL(args=[view, db.person, row.id] ))]
                       )

Re: [web2py] Re: Hide menu until after authentication.

2011-10-21 Thread Christopher Steel

# Append one or more additional menu items to reponse.menu using +=

if auth.is_logged_in():
response.menu+= [
(T('user menu'), False, URL('members','index'),
   )]  

# Create an additional response.menu and add a menu to a view using Annets 
code

if auth.is_logged_in():
response.menu_users= [
(T('user menu'), False, URL('members','index'),
   )] 

# In either case the above code should probably work for you in your apps 
menu.py


[web2py] Looking for people to help test web2py support in New Relic.

2011-10-21 Thread Graham Dumpleton
I tweeted about this already recently, but got no response.

I am looking for people who want to take the opportunity while New
Relic Python agent is in beta, to test out the web2py support we
provide. I had someone try a long long time back but we had issues. We
worked out since then that it was likely a uWSGI issue, but haven't
had anyone step up since who was interested in using New Relic with
web2py.

For those those who don't know what New Relic is, it is a production
web application performance monitoring system. The easiest way to see
what it can do is browser through New Relic page at:

  http://newrelic.com/features/performance-analytics

I have though also stuck up some specific screen shots of what a
web2py application being monitored by it using our Python agent looks
like at:

  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz004.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz005.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz006.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz007.gif

If you have ever used Django debug toolbar, it has overlapping
features, but with the big difference being that New Relic can be
deployed to your production application where as Django debug toolbar
is for development systems only.

Would be really nice to get the support for web2py checked out by
actual users of web2py and to work out what would be better things to
track or what else we can provide so we can include this with the
product when fully launched.

Right now we don't for example track time in DAL except as may be
picked up if running on top of a database such as PostgreSQL, MySQL or
SQLite. So don't see database breakout when DAL just using file
system. Also still need to work out what is required in web2py to
support end user monitoring support. Finally, not showing any
structure within templates either such as template blocks, within
transaction traces. As an example of what we could do there, have a
look at what we currently do for Django at:

  http://dl.dropbox.com/u/22571016/SafariScreenSnapz094.gif

The roadblock for adding more support is simply don't understand the
web2py internals enough to know where should monkey patch in to get
what we need.

Hopefully some of you will be interested in what we are doing and will
be interested in participating. I would also like to hope my prior
work in writing Apache/mod_wsgi puts me in good enough standing such
that you might at least give New Relic at least a quick once over to
learn what it is about. I know I am excited on working on this stuff
as it brings something to the Python web community which simply
doesn't exist and could be so beneficial to those who are serious
about wanting to deploy a well run production web site.

Just for the record. New Relic is a paid subscription service. For
access to all features will therefore cost money. When you signup and
deploy it you will get an initial Pro trial period of all features.
When that finishes it drops back to free Lite subscription level which
still gives you access to lots of useful features at no cost.

For more information on the Python agent for New Relic see:

  https://support.newrelic.com/help/kb/python/new-relic-for-python
  https://support.newrelic.com/help/kb/python/python-agent-and-web2py

The Python agent package for New Relic is available via the Python
package index or from New Relic site once you have created your
account.

I monitor new deployments so will keep an eye out for anyone deploying
with web2py. If you have problems you can create a ticket at:

  http://support.newrelic.com

and I will get back to you.

Feedback almost most welcome. Would be good to try and get the level
of support for we2py up to the same sort of depth as we do for Django
but really need your help to get it there.

Thanks.

Graham Dumpleton




Re: [web2py] Looking for people to help test web2py support in New Relic.

2011-10-21 Thread Bruno Rocha
I will give it a try next week.

Is it safe to work in a production website?

I can test it with web2pyslices.com and other two working apps.

Thank you.

http://zerp.ly/rochacbruno
Em 21/10/2011 23:34, Graham Dumpleton graham.dumple...@gmail.com
escreveu:

 I tweeted about this already recently, but got no response.

 I am looking for people who want to take the opportunity while New
 Relic Python agent is in beta, to test out the web2py support we
 provide. I had someone try a long long time back but we had issues. We
 worked out since then that it was likely a uWSGI issue, but haven't
 had anyone step up since who was interested in using New Relic with
 web2py.

 For those those who don't know what New Relic is, it is a production
 web application performance monitoring system. The easiest way to see
 what it can do is browser through New Relic page at:

  http://newrelic.com/features/performance-analytics

 I have though also stuck up some specific screen shots of what a
 web2py application being monitored by it using our Python agent looks
 like at:

  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz004.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz005.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz006.gif
  http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz007.gif

 If you have ever used Django debug toolbar, it has overlapping
 features, but with the big difference being that New Relic can be
 deployed to your production application where as Django debug toolbar
 is for development systems only.

 Would be really nice to get the support for web2py checked out by
 actual users of web2py and to work out what would be better things to
 track or what else we can provide so we can include this with the
 product when fully launched.

 Right now we don't for example track time in DAL except as may be
 picked up if running on top of a database such as PostgreSQL, MySQL or
 SQLite. So don't see database breakout when DAL just using file
 system. Also still need to work out what is required in web2py to
 support end user monitoring support. Finally, not showing any
 structure within templates either such as template blocks, within
 transaction traces. As an example of what we could do there, have a
 look at what we currently do for Django at:

  http://dl.dropbox.com/u/22571016/SafariScreenSnapz094.gif

 The roadblock for adding more support is simply don't understand the
 web2py internals enough to know where should monkey patch in to get
 what we need.

 Hopefully some of you will be interested in what we are doing and will
 be interested in participating. I would also like to hope my prior
 work in writing Apache/mod_wsgi puts me in good enough standing such
 that you might at least give New Relic at least a quick once over to
 learn what it is about. I know I am excited on working on this stuff
 as it brings something to the Python web community which simply
 doesn't exist and could be so beneficial to those who are serious
 about wanting to deploy a well run production web site.

 Just for the record. New Relic is a paid subscription service. For
 access to all features will therefore cost money. When you signup and
 deploy it you will get an initial Pro trial period of all features.
 When that finishes it drops back to free Lite subscription level which
 still gives you access to lots of useful features at no cost.

 For more information on the Python agent for New Relic see:

  https://support.newrelic.com/help/kb/python/new-relic-for-python
  https://support.newrelic.com/help/kb/python/python-agent-and-web2py

 The Python agent package for New Relic is available via the Python
 package index or from New Relic site once you have created your
 account.

 I monitor new deployments so will keep an eye out for anyone deploying
 with web2py. If you have problems you can create a ticket at:

  http://support.newrelic.com

 and I will get back to you.

 Feedback almost most welcome. Would be good to try and get the level
 of support for we2py up to the same sort of depth as we do for Django
 but really need your help to get it there.

 Thanks.

 Graham Dumpleton





[web2py] Re: Book overview form appearance

2011-10-21 Thread Anthony
On Friday, October 21, 2011 5:50:30 PM UTC-4, Paul wrote:

 The from scratch steps I too were from the Admin page Views section. I 
 entered first intot the create file with filename edit control and chose 
 the Create button.

 When I do this in a new application, the resulting first.html file 
 contains:

 {{extend 'layout.html'}}
 h1This is the first.html template/h1
 {{=BEAUTIFY(response._vars)}}


Yes, that's just a template generated by the admin app. You can delete all 
that and enter your own code. You can also just create a view file from 
scratch using any text editor (no need to use admin).

Note, response._vars is the dictionary returned by the controller function, 
and the BEAUTIFY helper turns lists and dictionaries of objects into HTML. 
So, {{=BEAUTIFY(response._vars)}} is a quick and easy way to display the 
objects returned by the controller without having to really code a view. It 
would typically be used for development purposes during prototyping.

Anthony 


[web2py] Re: Looking for people to help test web2py support in New Relic.

2011-10-21 Thread Graham Dumpleton
The agent as a whole is already in use in various production web sites
using Django, Flask, CherryPy, Pylons and Bottle, just none for Web2Py
yet.

You might therefore try it on a test system first to make sure no
issues with web2py specific instrumentation.

So far my testing has just been on the builtin sample applications and
admin that comes with web2py, but I am not keeping up with all the
updates of web2py and so hasn't been tested with very latest versions.

Thanks for giving it a go.

Graham

On Oct 22, 1:33 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 I will give it a try next week.

 Is it safe to work in a production website?

 I can test it with web2pyslices.com and other two working apps.

 Thank you.

 http://zerp.ly/rochacbruno
 Em 21/10/2011 23:34, Graham Dumpleton graham.dumple...@gmail.com
 escreveu:







  I tweeted about this already recently, but got no response.

  I am looking for people who want to take the opportunity while New
  Relic Python agent is in beta, to test out the web2py support we
  provide. I had someone try a long long time back but we had issues. We
  worked out since then that it was likely a uWSGI issue, but haven't
  had anyone step up since who was interested in using New Relic with
  web2py.

  For those those who don't know what New Relic is, it is a production
  web application performance monitoring system. The easiest way to see
  what it can do is browser through New Relic page at:

   http://newrelic.com/features/performance-analytics

  I have though also stuck up some specific screen shots of what a
  web2py application being monitored by it using our Python agent looks
  like at:

   http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz004.gif
   http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz005.gif
   http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz006.gif
   http://dl.dropbox.com/u/22571016/FirefoxScreenSnapz007.gif

  If you have ever used Django debug toolbar, it has overlapping
  features, but with the big difference being that New Relic can be
  deployed to your production application where as Django debug toolbar
  is for development systems only.

  Would be really nice to get the support for web2py checked out by
  actual users of web2py and to work out what would be better things to
  track or what else we can provide so we can include this with the
  product when fully launched.

  Right now we don't for example track time in DAL except as may be
  picked up if running on top of a database such as PostgreSQL, MySQL or
  SQLite. So don't see database breakout when DAL just using file
  system. Also still need to work out what is required in web2py to
  support end user monitoring support. Finally, not showing any
  structure within templates either such as template blocks, within
  transaction traces. As an example of what we could do there, have a
  look at what we currently do for Django at:

   http://dl.dropbox.com/u/22571016/SafariScreenSnapz094.gif

  The roadblock for adding more support is simply don't understand the
  web2py internals enough to know where should monkey patch in to get
  what we need.

  Hopefully some of you will be interested in what we are doing and will
  be interested in participating. I would also like to hope my prior
  work in writing Apache/mod_wsgi puts me in good enough standing such
  that you might at least give New Relic at least a quick once over to
  learn what it is about. I know I am excited on working on this stuff
  as it brings something to the Python web community which simply
  doesn't exist and could be so beneficial to those who are serious
  about wanting to deploy a well run production web site.

  Just for the record. New Relic is a paid subscription service. For
  access to all features will therefore cost money. When you signup and
  deploy it you will get an initial Pro trial period of all features.
  When that finishes it drops back to free Lite subscription level which
  still gives you access to lots of useful features at no cost.

  For more information on the Python agent for New Relic see:

   https://support.newrelic.com/help/kb/python/new-relic-for-python
   https://support.newrelic.com/help/kb/python/python-agent-and-web2py

  The Python agent package for New Relic is available via the Python
  package index or from New Relic site once you have created your
  account.

  I monitor new deployments so will keep an eye out for anyone deploying
  with web2py. If you have problems you can create a ticket at:

   http://support.newrelic.com

  and I will get back to you.

  Feedback almost most welcome. Would be good to try and get the level
  of support for we2py up to the same sort of depth as we do for Django
  but really need your help to get it there.

  Thanks.

  Graham Dumpleton


Re: [web2py] Re: SQLFORM.grid / Powergrid

2011-10-21 Thread Bruno Rocha
I created PowerTable and it has edit in place with Jquery Jeditable. but
this project is frozen and I have not tested with new w2p version so I did
not created any documentation. (someone wants to adopt it?)

I also created PowerGrid and it is being developed (I have made a lot of
improvements this week).

SQLFORM.grid has more features than PowerGrid and I think .grid is better
because it is under web2py core development.

Althrough, PowerGrid is more flexible because it is fully Ajax JSON/JSONP
and JQuery template based. The grid itself is all client side. the server
only deal with JSON processing.

PowerGrid uses a default json callback and you can write your own the way
you want. It also has easy way to add buttons, modals and a customizable
search also it is cacheable in client side.

You can also create a blog or do any kind of pagination with it (
miaudota.com.br/blog)  and (miaudota.com.br/prestacao-de-contas).

I will some major changes to PowetGrid repo very soon.

- user_signature as default
- filtering by column
- replace nyromodal with jqueryui
- selectable with checkbox
- and I will try to include Jeditable examples.

but, it is made for the developer to maintain and create your own callbacks.
(I only responsible for the client side code)

if you want a powerful and solid grid system use the SQLFORM.grid and I
think it is easy to add Jeditable to it.

http://zerp.ly/rochacbruno
Em 21/10/2011 21:26, greenpoise danel.sega...@gmail.com escreveu:

 This is great but is there a grid that I can do an edit in place of a
 field???



 thanks


 dan

 On Oct 21, 6:56 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
  On Oct 20, 11:07 pm, greenpoise danel.sega...@gmail.com wrote:
 
   I have a few questions regarding the grids.
 
   1. Is SQLFORM.grid the implementation of Powergrid?
 
  No but was inspired but it
 
   meaning, does
   SQLFORM.grid has all the features of Powergrid?
 
  Not sure. martin should answer that.
 
   2. Is there an option to edit a value on the fly rather than using an
   edit button? sort of like edit in place pyslice.
 
  No. because it uses no ajax.
 
   3. Is search as you type an option (type ahead)?
 
  No.
 
 
 
 
 
 
 
   Thanks
 
   Dan


Re: [web2py] Re: DAL: Selecting using the 'WHERE' clause

2011-10-21 Thread Sathvik Ponangi
Dear Howsec,

 I'm using v1.5.5
I stopped getting that error after I optimized (like replacing cPickle with
simplejson) my script  rebooting the server, so I don't really know what
caused it.
BTW, Thanky for your time...

With Regards,

Sathvik

On Sat, Oct 22, 2011 at 3:31 AM, howesc how...@umich.edu wrote:

 i've never seen that.

 got a code example?  which version of the SDK?




-- 
Sathvik Ponangi


[web2py] Alternative to Transactions

2011-10-21 Thread Sathvik Ponangi
Hello,

 I'm using web2py on Google AppEngine (SDK v1.5.5) and I'm trying to port a
script here which uses 'transactions'.
In what way can I effectively emulate *db.run_in_transaction(func1, params)*
* *on Web2py?
Will I need to manually run that function (func1) every-time I update the
database?
Thank you in advance.

With Regards,
Sathvik

-- 
Sathvik Ponangi


[web2py] Foreign key name getting other value, images app

2011-10-21 Thread Paul
When I use appadmin to display the COMMENT table, the comment.image_id field 
displays the title field from the image table.

Looking in sql.log, I see that comment.image_id is an integer referencing 
image.id.

image_id INTEGER REFERENCES image(id) ON DELETE CASCADE,

I was expecting to see the integer id value, but the text of the title field is 
displayed.

How/why does the comment.image_id field display the text of title? What in 
db.py connects those two?