[web2py] Re: ssh tunnel to admin panel with lighttpd= ERROR:web2py.cache:corrupted file

2012-01-29 Thread Benjamin
Hello Massimo,

Unfortunately it doesn't solve it.

There is from time to time only 2 files in this cache folder :
cache.lock
cache.shelve

And deleting it doesn't change the behavior, i.e.: the web2py
welcome page is displayed correctly using an SSH tunnel but the
admin panel displays Internal error Ticket issued: admin/
__1.2012-01-29.13-25-47.643f7d62-256c-4151-b2e3-fd1ef2fc332a

Here is what I have found at the end of the ticket :
***
SStorage {'_user_agent': {'os': {'name': 'Macint...owser':
{'version': '5.1.1', 'name': 'Safari'}}} p3726 sg60
SStorage {'body': cStringIO.StringO object at 0..._vars': Storage
{}, 'post_vars': Storage {}} p3727
sg2782 SStorage {'status': 200, 'body': cStringIO.Stri.../css/
styles.css'], 'view': 'default/index.html'}
p3728 sS'session_folder' p3729 S'/home/www-data/web2py/applications/
admin/sessions' p3730 sssS'traceback' p3731
S'Traceback (most recent call last):\n File /home/www-data/web2py/
gluon/main.py, line 523, in wsgibase\n
session._try_store_on_disk(request, response)\n File /home/www-data/
web2py/gluon/globals.py, line 586, in
_try_store_on_disk\n response.session_file =
open(response.session_filename, \'wb\')\nIOError: [Errno 13]
Permission denied:
\'/home/www-data/web2py/applications/admin/sessions/..
1-055bbcfa-3236-4328-b1ff-0dc2d70a32b9\'\n' p3732 s.

***

By looking at my admin folder it seems like EVERYTHING has rights :
drwxr-xr-x  www-data www-data, EXCEPT only the sessions folder
which has drwxr-xr-x  root root.

Any reason why is it so ?

Isn't the session folder supposed to also be drwxr-xr-x  www-data www-
data ?

It's really weird it happened as i've chown chown -R www-data:www-
data web2py during web2py installation...

Thanks for your help,

Cheers,


On 28 jan, 20:53, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Can you try delete applications/admin/cache/*?

 it is possible that there is a cache file created using a different
 python version and web2py cannot open it. For permission issues it may
 be unable to remove it and re-create it.

 On Jan 28, 12:25 pm, Benjamin benjamin.aguet...@gmail.com wrote:







  Hello guys,

  Attracted by web2py dev possibilities I couldn't resist ;-) But
  unfortunately deployment is a whole other story and I'm having major
  difficulties.

  So after a struggle I got web2py to run on lighttpd, then discovered
  that, as I didn't set any SSL, I couldn't access the admin interface.

  So I'm trying to use an ssh tunnel :
  ssh -L 9090:localhost:80 r...@192.168.1.101

  After that I can see the demo app at localhost:9090 but every single
  click on the Admin interface button on the right of the demo app end
  up with :

  on the browser side :
  Internal error
  Ticket issued: admin/__1.2012-01-28.23-18-18.cf854d0b-a8f7-4ef8-bd28-
  a24debe031a8

  on the terminal side (the terminal which started a bash script
  starting the fcgihandler.fcgi ) I got this :
  ERROR:web2py.cache:corrupted file /home/www-data/web2py/applications/
  admin/cache/cache.shelve, will try delete it!

  Interesting fact : each time I try to click on the admin panel
  button from the browser, a new ERROR:web2py.cache:corrupted file /
  home/www-data/web2py/applications/admin/cache/cache.shelve, will try
  delete it! is displayed on the terminal.

  What am I doing wrong ?

  Thanks a lot,

  cheers,

  PS : the file got deleted automatically each time but I still can't
  access the admin panel


[web2py] TIP: function to help with common filter usage

2012-01-29 Thread guruyaya
I wrote this function, to help out with a project I'm working on, that
has an extensive use of the common filter functionality (describes in
chapter 6 of the web2py book).
Say you have a blog, containing active, and inactive posts:

db.define_table('post',
 Field('subject'),
 Field('post','text'),
 Field('is_active','boolean'),
 common_filter = lambda query: db.post.is_active == True
)

And we have comments on posts:
db.define_table('comment',
 Field('post',db.post),
 Field('comment','text')
)

Running db(db.comment.id  0).select(), will select all comments,
including those posts where is_active is False.

Solution:
use this function in a model, module, whatever:

def inherit_common_filter(db, col):
''' gets the common filter of a field refrenced
'''
ref_table_name = col.type.replace('reference ', '')
ref_table = db[ref_table_name]
ref_table_filter = ref_table._common_filter

return lambda query:
col.belongs(db(ref_table_filter(query))._select(ref_table.id))

Now, the new model looks like:
db.define_table('comment',
 Field('post',db.post),
 Field('comment','text')
)
db.comment._common_filter = inherit_common_filter(db, db.comment)

Now Running db(db.comment.id  0).select(), will select all comments
that are set to is_active == True.

Hope you'll find this useful


[web2py] Re: TIP: function to help with common filter usage

2012-01-29 Thread guruyaya
I've made a mistake in my tip, please replace:
   db.comment._common_filter = inherit_common_filter(db, db.comment)
with:
   db.comment._common_filter = inherit_common_filter(db,
db.comment.post)

Sorry for this one.

On Jan 29, 10:46 am, guruyaya guruy...@gmail.com wrote:
 I wrote this function, to help out with a project I'm working on, that
 has an extensive use of the common filter functionality (describes in
 chapter 6 of the web2py book).
 Say you have a blog, containing active, and inactive posts:

 db.define_table('post',
  Field('subject'),
  Field('post','text'),
  Field('is_active','boolean'),
  common_filter = lambda query: db.post.is_active == True
 )

 And we have comments on posts:
 db.define_table('comment',
  Field('post',db.post),
  Field('comment','text')
 )

 Running db(db.comment.id  0).select(), will select all comments,
 including those posts where is_active is False.

 Solution:
 use this function in a model, module, whatever:

 def inherit_common_filter(db, col):
     ''' gets the common filter of a field refrenced
     '''
     ref_table_name = col.type.replace('reference ', '')
     ref_table = db[ref_table_name]
     ref_table_filter = ref_table._common_filter

     return lambda query:
 col.belongs(db(ref_table_filter(query))._select(ref_table.id))

 Now, the new model looks like:
 db.define_table('comment',
  Field('post',db.post),
  Field('comment','text')
 )
 db.comment._common_filter = inherit_common_filter(db, db.comment)

 Now Running db(db.comment.id  0).select(), will select all comments
 that are set to is_active == True.

 Hope you'll find this useful


[web2py] Re: ssh tunnel to admin panel with lighttpd= ERROR:web2py.cache:corrupted file

2012-01-29 Thread Benjamin
Hello,

Just to let you know ISSUE SOLVED.

For an unknown reason sessions folder was not chown to www-data, so
simply :

chown -R www-data:www-data sessions

solved the issue.

I am not sure it's the way it should be but at least it works now.

Thanks,

Cheers,

On 29 jan, 09:41, Benjamin benjamin.aguet...@gmail.com wrote:
 Hello Massimo,

 Unfortunately it doesn't solve it.

 There is from time to time only 2 files in this cache folder :
 cache.lock
 cache.shelve

 And deleting it doesn't change the behavior, i.e.: the web2py
 welcome page is displayed correctly using an SSH tunnel but the
 admin panel displays Internal error Ticket issued: admin/
 __1.2012-01-29.13-25-47.643f7d62-256c-4151-b2e3-fd1ef2fc332a

 Here is what I have found at the end of the ticket :
 ***
 SStorage {'_user_agent': {'os': {'name': 'Macint...owser':
 {'version': '5.1.1', 'name': 'Safari'}}} p3726 sg60
 SStorage {'body': cStringIO.StringO object at 0..._vars': Storage
 {}, 'post_vars': Storage {}} p3727
 sg2782 SStorage {'status': 200, 'body': cStringIO.Stri.../css/
 styles.css'], 'view': 'default/index.html'}
 p3728 sS'session_folder' p3729 S'/home/www-data/web2py/applications/
 admin/sessions' p3730 sssS'traceback' p3731
 S'Traceback (most recent call last):\n File /home/www-data/web2py/
 gluon/main.py, line 523, in wsgibase\n
 session._try_store_on_disk(request, response)\n File /home/www-data/
 web2py/gluon/globals.py, line 586, in
 _try_store_on_disk\n response.session_file =
 open(response.session_filename, \'wb\')\nIOError: [Errno 13]
 Permission denied:
 \'/home/www-data/web2py/applications/admin/sessions/..
 1-055bbcfa-3236-4328-b1ff-0dc2d70a32b9\'\n' p3732 s.

 ***

 By looking at my admin folder it seems like EVERYTHING has rights :
 drwxr-xr-x  www-data www-data, EXCEPT only the sessions folder
 which has drwxr-xr-x  root     root.

 Any reason why is it so ?

 Isn't the session folder supposed to also be drwxr-xr-x  www-data www-
 data ?

 It's really weird it happened as i've chown chown -R www-data:www-
 data web2py during web2py installation...

 Thanks for your help,

 Cheers,

 On 28 jan, 20:53, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Can you try delete applications/admin/cache/*?

  it is possible that there is a cache file created using a different
  python version and web2py cannot open it. For permission issues it may
  be unable to remove it and re-create it.

  On Jan 28, 12:25 pm, Benjamin benjamin.aguet...@gmail.com wrote:

   Hello guys,

   Attracted by web2py dev possibilities I couldn't resist ;-) But
   unfortunately deployment is a whole other story and I'm having major
   difficulties.

   So after a struggle I got web2py to run on lighttpd, then discovered
   that, as I didn't set any SSL, I couldn't access the admin interface.

   So I'm trying to use an ssh tunnel :
   ssh -L 9090:localhost:80 r...@192.168.1.101

   After that I can see the demo app at localhost:9090 but every single
   click on the Admin interface button on the right of the demo app end
   up with :

   on the browser side :
   Internal error
   Ticket issued: admin/__1.2012-01-28.23-18-18.cf854d0b-a8f7-4ef8-bd28-
   a24debe031a8

   on the terminal side (the terminal which started a bash script
   starting the fcgihandler.fcgi ) I got this :
   ERROR:web2py.cache:corrupted file /home/www-data/web2py/applications/
   admin/cache/cache.shelve, will try delete it!

   Interesting fact : each time I try to click on the admin panel
   button from the browser, a new ERROR:web2py.cache:corrupted file /
   home/www-data/web2py/applications/admin/cache/cache.shelve, will try
   delete it! is displayed on the terminal.

   What am I doing wrong ?

   Thanks a lot,

   cheers,

   PS : the file got deleted automatically each time but I still can't
   access the admin panel


[web2py] Re: Any advice on spam control for a comment system?

2012-01-29 Thread Benjamin
Hi,

Personally I like human quiz anti-bot measures. Captcha can be
breaken easily.

e.g. you could build yourself a big list of questions and ask for the
answer before validating the comment form. Of course the answer should
not be a simple yes/no quiz.

questions like : What color is not on the american flag : blue, red
or orange ? (answer in uppercase), What do you put in coffee : sugar
or salt ? (answer in uppercase), which one is a spice : cinnamon or
water ?

Actually you don't even need the uppercase, you can handle it
yourself.

Cheers,

On 28 jan, 22:57, monotasker scotti...@gmail.com wrote:
 I'm about to deploy a simple blog platform for myself and have implemented
 comments using something very much like Massimo's example in the components
 chapter of the web2py book. What I'm wondering about, though, is spam
 control. At the moment I think I'm just going to activate recaptcha for the
 comment submission form. But has anyone got other suggestions? I understand
 that honeypot solutions are often effective, but I haven't yet thought
 about how to implement one.

 Ian


[web2py] Re: Is it possible to LOAD a component after a page has rendered?

2012-01-29 Thread scausten
Thanks! web2py easy, as always.

On Jan 28, 11:24 am, Alan Etkin spame...@gmail.com wrote:
 You can use javascript onclick and the web2py.js function
 web2py_component(action,target) to load the source on demand.
 You need to set a target div or other element in the view previously
 and get the triggered event's DOM element id with jQuery to pass it
 with the url/action string.


Re: [web2py] Many apps but only one needs https.

2012-01-29 Thread Alexandre Andrade
while https can be used for everyone, u can force https just to one.



Em 28 de janeiro de 2012 12:51, António Ramos ramstei...@gmail.comescreveu:

 Hello, if i have 20 apps in the same server of web2py and only one needs
 to be accessed with https what do i do?


 Thank you

 António




-- 
Atenciosamente


Alexandre Andrade
Hipercenter.com Classificados Gratuitos


[web2py] Mobile OTP authentication (motp) plugin for web2py

2012-01-29 Thread whowhywhat
just finished writing a motp (http://motp.sourceforge.net/)
authentication plugin for web2py. Where do i contribute this code?
I would appreciate if some one tests this and gives me some feedback.

I have uploaded the code to Google code. project is
https://web2py-motp-auth.googlecode.com
you can see the source here - 
https://code.google.com/p/web2py-motp-auth/source/browse/motp_auth.py

Some questions I had:
- is there any way to prevent web2py from storing the password in the
DB after a successful alternate login. One you authenticate with motp.
the motp password gets stored in the db. OTP means having an ever
changing password.

- does web2py have a standard AES api? i would like to (symmetrically)
encrypt the stored motp pin and motp secret. Or is it better i just
use a external python library?

- as of now the user database and user field is hard-coded to use
auth_user table and email field respectively. How can i make this
variable? (so a user can pass some other database table or field)

i also want to implement google authenticator (https://code.google.com/
p/google-authenticator/) auth for web2py. This is another OTP
solution. However for google authenticator, you need to use both your
site password and the OTP.. so a custom login for would be needed.
Would be great solution where that extra bit of security is needed. I
personally use google authenticator for my google accounts, and i
think the added security is a boon.

Would also appreciate your thoughts and comments on OTP in general

thanks web2py community.. :)


[web2py] Re: TIP: function to help with common filter usage

2012-01-29 Thread whowhywhat
nice tip. thanks for sharing!

On Jan 29, 1:51 pm, guruyaya guruy...@gmail.com wrote:
 I've made a mistake in my tip, please replace:
    db.comment._common_filter = inherit_common_filter(db, db.comment)
 with:
    db.comment._common_filter = inherit_common_filter(db,
 db.comment.post)

 Sorry for this one.

 On Jan 29, 10:46 am, guruyaya guruy...@gmail.com wrote:







  I wrote this function, to help out with a project I'm working on, that
  has an extensive use of the common filter functionality (describes in
  chapter 6 of the web2py book).
  Say you have a blog, containing active, and inactive posts:

  db.define_table('post',
   Field('subject'),
   Field('post','text'),
   Field('is_active','boolean'),
   common_filter = lambda query: db.post.is_active == True
  )

  And we have comments on posts:
  db.define_table('comment',
   Field('post',db.post),
   Field('comment','text')
  )

  Running db(db.comment.id  0).select(), will select all comments,
  including those posts where is_active is False.

  Solution:
  use this function in a model, module, whatever:

  def inherit_common_filter(db, col):
      ''' gets the common filter of a field refrenced
      '''
      ref_table_name = col.type.replace('reference ', '')
      ref_table = db[ref_table_name]
      ref_table_filter = ref_table._common_filter

      return lambda query:
  col.belongs(db(ref_table_filter(query))._select(ref_table.id))

  Now, the new model looks like:
  db.define_table('comment',
   Field('post',db.post),
   Field('comment','text')
  )
  db.comment._common_filter = inherit_common_filter(db, db.comment)

  Now Running db(db.comment.id  0).select(), will select all comments
  that are set to is_active == True.

  Hope you'll find this useful


[web2py] Clean session after logout

2012-01-29 Thread Bruno Rocha
I want to clean session (remove / delete) the session file


*auth.settings.logout_onlogout = lambda user: remove_session(user)*


def remove_session(user):



Does anybody implemented that kind of function?

I will wait for someone to share it before starting code my own...

-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] Re: ticket with book example under 7.2.6 Links to Referencing Records

2012-01-29 Thread DenesL

It gives a different error using trunk:

Traceback (most recent call last):
  File C:\w2p\trunk\gluon\restricted.py, line 204, in restricted
exec ccode in environment
  File C:/w2p/trunk/applications/test/controllers/test.py, line 21,
in module
  File C:\w2p\trunk\gluon\globals.py, line 172, in lambda
self._caller = lambda f: f()
  File C:/w2p/trunk/applications/test/controllers/test.py, line 18,
in list_records
records = db(query).select(db[table])
  File C:\w2p\trunk\gluon\dal.py, line 7371, in select
return adapter.select(self.query,fields,attributes)
  File C:\w2p\trunk\gluon\dal.py, line 1301, in select
sql = self._select(query, fields, attributes)
  File C:\w2p\trunk\gluon\dal.py, line 1730, in _select
sql = super(SQLiteAdapter, self)._select(query, fields,
attributes)
  File C:\w2p\trunk\gluon\dal.py, line 1198, in _select
raise SyntaxError, 'Set: no tables selected'
SyntaxError: Set: no tables selected


File C:\w2p\trunk\gluon\dal.py in _select at line 1198 code arguments
variables
Function argument list

(self=gluon.dal.SQLiteAdapter object, query='person.id0',
fields=[Table {'ALL': gluon.dal.SQLALL object at 0x023...lename':
gluon.dal.Field object at 0x023B4330}], attributes={})

Code listing

1193.
1194.if use_common_filters(query):
1195.query = self.common_filter(query,tablenames)
1196.
1197.if len(tablenames)  1:
1198.raise SyntaxError, 'Set: no tables selected'

1199.sql_f = ', '.join(map(self.expand, fields))
1200.self._colnames = [c.strip() for c in sql_f.split(', ')]
1201.if query:
1202.sql_w = ' WHERE ' + self.expand(query)



[web2py] Re: Mobile OTP authentication (motp) plugin for web2py

2012-01-29 Thread Massimo Di Pierro
Please email me a patch. The files would go into contrib.
Thank you for this contribution. :-)

Massimo

On Jan 29, 6:53 am, whowhywhat mads...@gmail.com wrote:
 just finished writing a motp (http://motp.sourceforge.net/)
 authentication plugin for web2py. Where do i contribute this code?
 I would appreciate if some one tests this and gives me some feedback.

 I have uploaded the code to Google code. project 
 ishttps://web2py-motp-auth.googlecode.com
 you can see the source here 
 -https://code.google.com/p/web2py-motp-auth/source/browse/motp_auth.py

 Some questions I had:
 - is there any way to prevent web2py from storing the password in the
 DB after a successful alternate login. One you authenticate with motp.
 the motp password gets stored in the db. OTP means having an ever
 changing password.

 - does web2py have a standard AES api? i would like to (symmetrically)
 encrypt the stored motp pin and motp secret. Or is it better i just
 use a external python library?

 - as of now the user database and user field is hard-coded to use
 auth_user table and email field respectively. How can i make this
 variable? (so a user can pass some other database table or field)

 i also want to implement google authenticator (https://code.google.com/
 p/google-authenticator/) auth for web2py. This is another OTP
 solution. However for google authenticator, you need to use both your
 site password and the OTP.. so a custom login for would be needed.
 Would be great solution where that extra bit of security is needed. I
 personally use google authenticator for my google accounts, and i
 think the added security is a boon.

 Would also appreciate your thoughts and comments on OTP in general

 thanks web2py community.. :)


[web2py] Re: Clean session after logout

2012-01-29 Thread Massimo Di Pierro
auth.settings.logout_onlogout = lambda user: session.clear()

On Jan 29, 7:35 am, Bruno Rocha rochacbr...@gmail.com wrote:
 I want to clean session (remove / delete) the session file

 *auth.settings.logout_onlogout = lambda user: remove_session(user)*

 def remove_session(user):
     

 Does anybody implemented that kind of function?

 I will wait for someone to share it before starting code my own...

 --

 Bruno Rocha
 [http://rochacbruno.com.br]


[web2py] Re: Clean session after logout

2012-01-29 Thread Massimo Di Pierro
If you want to actually remove the file you can try:

def remove_session(user):
  session._unlock(response)
  os.unlink(response.session_filename)
  session.clear()

I am not 100% sure.

On Jan 29, 7:35 am, Bruno Rocha rochacbr...@gmail.com wrote:
 I want to clean session (remove / delete) the session file

 *auth.settings.logout_onlogout = lambda user: remove_session(user)*

 def remove_session(user):
     

 Does anybody implemented that kind of function?

 I will wait for someone to share it before starting code my own...

 --

 Bruno Rocha
 [http://rochacbruno.com.br]


[web2py] help with js issue

2012-01-29 Thread Massimo Di Pierro
I would like to post web2py 2.0 since we have no major pending issues.
Yet there are two issues I would like to fix first:

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

I used to be able to stop the server with CRTL+C but it does not work
anymore on my mac. I now have to kill it. Why?

I could use some help. ;-)

Massimo


Re: [web2py] help with js issue

2012-01-29 Thread Bruno Rocha
the same for me, I always have to kill - 9 PID.

But it only happens after some time.

http://zerp.ly/rochacbruno
Em 29/01/2012 14:27, Massimo Di Pierro massimo.dipie...@gmail.com
escreveu:

 I would like to post web2py 2.0 since we have no major pending issues.
 Yet there are two issues I would like to fix first:

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

 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?

 I could use some help. ;-)

 Massimo


Re: [web2py] help with js issue

2012-01-29 Thread Ovidio Marinho
Ctrl+C in Mac is Cmd+C



   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil




2012/1/29 Bruno Rocha rochacbr...@gmail.com

 the same for me, I always have to kill - 9 PID.

 But it only happens after some time.

 http://zerp.ly/rochacbruno
 Em 29/01/2012 14:27, Massimo Di Pierro massimo.dipie...@gmail.com
 escreveu:

  I would like to post web2py 2.0 since we have no major pending issues.
 Yet there are two issues I would like to fix first:

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

 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?

 I could use some help. ;-)

 Massimo




Re: [web2py] help with js issue

2012-01-29 Thread Jonathan Lundell
On Jan 29, 2012, at 10:44 AM, Ovidio Marinho wrote:

 Ctrl+C in Mac is Cmd+C

It is for copy, but not for quitting a process from the terminal. Control-C.

Massimo, are you sure web2py isn't running in the background when you do this? 
If you hit return, do you get a shell prompt? Control-C won't work then.

   
 
 
Ovidio Marinho Falcao Neto
 Web Developer
  ovidio...@gmail.com 
   ovidiomari...@itjp.net.br
  ITJP - itjp.net.br
83   8826 9088 - Oi
83   9334 0266 - Claro
 Brasil
   
 
 
 
 2012/1/29 Bruno Rocha rochacbr...@gmail.com
 the same for me, I always have to kill - 9 PID.
 
 But it only happens after some time.
 
 http://zerp.ly/rochacbruno
 
 Em 29/01/2012 14:27, Massimo Di Pierro massimo.dipie...@gmail.com 
 escreveu:
 
 I would like to post web2py 2.0 since we have no major pending issues.
 Yet there are two issues I would like to fix first:
 
 http://code.google.com/p/web2py/issues/detail?id=627
 
 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?
 
 I could use some help. ;-)
 
 Massimo
 




Re: [web2py] help with js issue

2012-01-29 Thread Ricardo Pedroso
On Sun, Jan 29, 2012 at 4:27 PM, Massimo Di Pierro
massimo.dipie...@gmail.com wrote:

 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?

I'm new to web2py, but I already see this happened
in other scripts when working with sockets and threads.

Probably something wrong inside rocket.

see:
http://stackoverflow.com/questions/1148062/python-socket-accept-blocks-prevents-app-from-quitting

Regards,
Ricardo


Re: [web2py] help with js issue

2012-01-29 Thread Michele Comitini
Yes probably some system call hangs somewhere.


2012/1/29 Ricardo Pedroso rmdpedr...@gmail.com:
 On Sun, Jan 29, 2012 at 4:27 PM, Massimo Di Pierro
 massimo.dipie...@gmail.com wrote:

 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?

 I'm new to web2py, but I already see this happened
 in other scripts when working with sockets and threads.

 Probably something wrong inside rocket.

 see:
 http://stackoverflow.com/questions/1148062/python-socket-accept-blocks-prevents-app-from-quitting

 Regards,
 Ricardo


Re: [web2py] Re: Soliciting freelance developers

2012-01-29 Thread Bruce Wade
How do I get my company listed on
http://www.web2py.com/examples/default/support ?

Now that I have two developers, and 2 designers working with me on porting
a few applications over to web2py I think that I will be using the
framework strictly for new client development at
http://www.wadecybertech.com and am able to take on new projects.

On Tue, Jan 3, 2012 at 6:59 PM, Anthony abasta...@gmail.com wrote:

 http://experts4solutions.com/
 http://www.web2py.com/examples/default/support




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: Nginx + uwsgi file download problem

2012-01-29 Thread Roberto De Ioris

 Hard to say.

 I don't know if this helps but here's how appadmin does it for a csv file:

 def csv():
 import gluon.contenttype
 response.headers['Content-Type'] = \
 gluon.contenttype.contenttype('.csv')
 db = get_database(request)
 query = get_query(request)
 if not query:
 return None
 response.headers['Content-disposition'] = 'attachment;
 filename=%s_%s.csv'\
  % tuple(request.vars.query.split('.')[:2])
 return str(db(query).select())


Try to set Content-Length header to avoid nginx losing data

-- 
Roberto De Ioris
http://unbit.it


[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Magnitus
Making some inroads.

The file type returned in the HTTP header for audio files is this: 
text/plain; charset=utf-8

Accoding to this article, Firefox is actually the correct implementation 
amongst the browsers for this, because it respects the file type indicated 
by the server:

https://developer.mozilla.org/en/Properly_Configuring_Server_MIME_Types

So, I guess now, I'll have to figure out how to make Rocket return the 
correct file types (to debug audio with Firefox without changing partition) 
or I suppose I could setup Apache on my Windows partition which I need to 
debug IE.


Re: [web2py] Re: Soliciting freelance developers

2012-01-29 Thread Kenneth Lundström
If you havn't gotten a reply by Massimo by now you can email him 
directly. You can find his address on quite a few posts in this group.



Kenneth


How do I get my company listed on 
http://www.web2py.com/examples/default/support ?


Now that I have two developers, and 2 designers working with me on 
porting a few applications over to web2py I think that I will be using 
the framework strictly for new client development at 
http://www.wadecybertech.com and am able to take on new projects.


On Tue, Jan 3, 2012 at 6:59 PM, Anthony abasta...@gmail.com 
mailto:abasta...@gmail.com wrote:


http://experts4solutions.com/
http://www.web2py.com/examples/default/support




--
--
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com




[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Magnitus
The problem is with web2py.

I changed 'contenttype.py' in gluon and added '.webm': 'video/webm' to the 
list. 

If the necessary changes could be made to the trunk so that I don't have to 
do the above modification to my copy each time I download the latest 
version of the framework, it would be appreciated.


Re: [web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Jonathan Lundell
On Jan 29, 2012, at 1:49 PM, Magnitus wrote:

 The problem is with web2py.
 
 I changed 'contenttype.py' in gluon and added '.webm': 'video/webm' to the 
 list. 
 
 If the necessary changes could be made to the trunk so that I don't have to 
 do the above modification to my copy each time I download the latest version 
 of the framework, it would be appreciated.


You could also try:

from gluon.contenttype import CONTENT_TYPE
CONTENT_TYPE['.webm'] = 'video/webm'

presumably early in db.py, depending on when it was needed. Unless that's too 
late in some case.

Re: [web2py] Many apps but only one needs https.

2012-01-29 Thread António Ramos
How?

2012/1/29 Alexandre Andrade alexandrema...@gmail.com

 while https can be used for everyone, u can force https just to one.



 Em 28 de janeiro de 2012 12:51, António Ramos ramstei...@gmail.comescreveu:

 Hello, if i have 20 apps in the same server of web2py and only one needs
 to be accessed with https what do i do?


 Thank you

 António




 --
 Atenciosamente


 Alexandre Andrade
 Hipercenter.com Classificados Gratuitos



Re: [web2py] Re: Soliciting freelance developers

2012-01-29 Thread Bruce Wade
Ok thanks I will email him directly.

--
Regards,
Bruce

2012/1/29 Kenneth Lundström kenneth.t.lundst...@gmail.com

  If you havn't gotten a reply by Massimo by now you can email him
 directly. You can find his address on quite a few posts in this group.


 Kenneth



  How do I get my company listed on
 http://www.web2py.com/examples/default/support ?

  Now that I have two developers, and 2 designers working with me on
 porting a few applications over to web2py I think that I will be using the
 framework strictly for new client development at
 http://www.wadecybertech.com and am able to take on new projects.

 On Tue, Jan 3, 2012 at 6:59 PM, Anthony abasta...@gmail.com wrote:

 http://experts4solutions.com/
 http://www.web2py.com/examples/default/support




  --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/brucelwade
 http://www.wadecybertech.com
 http://www.warplydesigned.com
 http://www.fitnessfriendsfinder.com





-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] Nesting HTML tables

2012-01-29 Thread Tsvi Mostovicz
Hi all,
I'm trying to get the following HTML structure using HTML helpers:

tablethead.../thead
tbody.../tbody
tablethead.../thead
tbody.../tbody
/table/table

AKA nested tables.
For some reason when I put the TABLE helper within another TABLE
helper, the internal one gets surrounded by tbody, tr and td causing
it not to show properly. Does anyone have an idea how to fix this
behavior?

Thanks,

Tsvi

Sent from my phone


Re: [web2py] Nesting HTML tables

2012-01-29 Thread Marin Pranjić
Shouldn't second table go inside td ... /td if you want nested tables ?
Shouldn't anything inside table be inside td ... /td ?

I don't understand your wanted structure. It is not valid or am I missing
something?


Marin

On Sun, Jan 29, 2012 at 10:10 PM, Tsvi Mostovicz ttm...@gmail.com wrote:

 Hi all,
 I'm trying to get the following HTML structure using HTML helpers:

 tablethead.../thead
 tbody.../tbody
 tablethead.../thead
 tbody.../tbody
 /table/table

 AKA nested tables.
 For some reason when I put the TABLE helper within another TABLE
 helper, the internal one gets surrounded by tbody, tr and td causing
 it not to show properly. Does anyone have an idea how to fix this
 behavior?

 Thanks,

 Tsvi

 Sent from my phone



[web2py] Re: Nesting HTML tables

2012-01-29 Thread Alan Etkin
Have you tried passing table components as arguments?
TABLE(THEAD(), TBODY(), THEAD(), TBODY(), ...)

You could explore each table helper instance and extract the parts you
want to nest and then in a view do something like this:
table
{{ for table in tables:}}
  {{ table.elements(thead)[0] }}
  {{ table.elements(tbody)[0] }}
{{ pass }}
/table

Ore use a similar workaround with other helper methods.

Anyway, if nested tables are valid HTML there should be a way of
passing TABLE instances as TABLE arguments

On 29 ene, 18:10, Tsvi Mostovicz ttm...@gmail.com wrote:
 Hi all,
 I'm trying to get the following HTML structure using HTML helpers:

 tablethead.../thead
 tbody.../tbody
 tablethead.../thead
 tbody.../tbody
 /table/table

 AKA nested tables.
 For some reason when I put the TABLE helper within another TABLE
 helper, the internal one gets surrounded by tbody, tr and td causing
 it not to show properly. Does anyone have an idea how to fix this
 behavior?

 Thanks,

 Tsvi

 Sent from my phone


[web2py] select data from database using date

2012-01-29 Thread Sanjeet roy
I have one date column due_date here i want to select the all data
between dates one is starting date and one is end date both are taken
manually so if the user select cmnpny and start and end date all the
data related to company between choosen date should be come
my code is below but i don't able to get the proper data:
for row in db(db.f_company_compliance.company == session.company and
db.f_company_compliance.due_date = session.strtdate and
db.f_company_compliance.due_date = session.enddate).select():


[web2py] Re: Mobile OTP authentication (motp) plugin for web2py

2012-01-29 Thread Alan Etkin
 does web2py have a standard AES api? i would like to (symmetrically)
 encrypt the stored motp pin and motp secret. Or is it better i just
 use a external python library?

There is a CRYPT helper object of web2py that can be instanitated with
different options. It is used for standard authentication. (I am not
sure if if can be of use for AES)
http://web2py.com/examples/static/epydoc/web2py.gluon.validators.CRYPT-class.html

 - as of now the user database and user field is hard-coded to use
 auth_user table and email field respectively. How can i make this
 variable? (so a user can pass some other database table or field)

Maybe you could make custom Auth forms and let the use choose the
input sources. You could also call extra authentication object methods
to pre-define options in the model. For this purpose, a paralell
object available at the model should store the extra settings.

 - is there any way to prevent web2py from storing the password in the
 DB after a successful alternate login. One you authenticate with motp.
 the motp password gets stored in the db. OTP means having an ever
 changing password.

The model's auth standard instance hast special settings for handling
on-authentication events. It should be possible to catch on-login
events and return without storing data.


[web2py] Re: help with js issue

2012-01-29 Thread Massimo Di Pierro
Yes I am sure it is not running in background.

Recently I started having two problems and I cannot track them down.
1) on 10.6.8 I cannot quit with ctrl+C
2) on Lion is keeps printing '^@' to console, about one per minute.
I suspect these problems are related and bother me very much. I cannot
think of any change that may have caused this.

There is also a test related to locking of language files that keeps
failing.
Who wrote the language tests? If you did can you help us understand
it?

massimo

On Jan 29, 10:57 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 29, 2012, at 10:44 AM, Ovidio Marinho wrote:

  Ctrl+C in Mac is Cmd+C

 It is for copy, but not for quitting a process from the terminal. Control-C.

 Massimo, are you sure web2py isn't running in the background when you do 
 this? If you hit return, do you get a shell prompt? Control-C won't work then.









         Ovidio Marinho Falcao Neto
                  Web Developer
               ovidio...@gmail.com
            ovidiomari...@itjp.net.br
                   ITJP - itjp.net.br
                 83   8826 9088 - Oi
                 83   9334 0266 - Claro
                          Brasil

  2012/1/29 Bruno Rocha rochacbr...@gmail.com
  the same for me, I always have to kill - 9 PID.

  But it only happens after some time.

 http://zerp.ly/rochacbruno

  Em 29/01/2012 14:27, Massimo Di Pierro massimo.dipie...@gmail.com 
  escreveu:

  I would like to post web2py 2.0 since we have no major pending issues.
  Yet there are two issues I would like to fix first:

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

  I used to be able to stop the server with CRTL+C but it does not work
  anymore on my mac. I now have to kill it. Why?

  I could use some help. ;-)

  Massimo


[web2py] Re: help with js issue

2012-01-29 Thread Massimo Di Pierro
I fixed issue 627. The other issue is still open.

On Jan 29, 10:27 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I would like to post web2py 2.0 since we have no major pending issues.
 Yet there are two issues I would like to fix first:

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

 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?

 I could use some help. ;-)

 Massimo


Re: [web2py] select data from database using date

2012-01-29 Thread Bruce Wade
query = db(db.f_company_compliance.company == session.company)
query = query((db.f_company_compliance.due_date = session.strtdate) 
(db.f_company_compliance.due_date = session.enddate))
rows = query.select()

for row in rows:
   # do something

On Sun, Jan 29, 2012 at 10:22 AM, Sanjeet roy kumarsanjeet1...@gmail.comwrote:

 I have one date column due_date here i want to select the all data
 between dates one is starting date and one is end date both are taken
 manually so if the user select cmnpny and start and end date all the
 data related to company between choosen date should be come
 my code is below but i don't able to get the proper data:
 for row in db(db.f_company_compliance.company == session.company and
 db.f_company_compliance.due_date = session.strtdate and
 db.f_company_compliance.due_date = session.enddate).select():




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Massimo Di Pierro
adding to trunk.


On Jan 29, 2:12 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 29, 2012, at 1:49 PM, Magnitus wrote:

  The problem is with web2py.

  I changed 'contenttype.py' in gluon and added '.webm': 'video/webm' to the 
  list.

  If the necessary changes could be made to the trunk so that I don't have to 
  do the above modification to my copy each time I download the latest 
  version of the framework, it would be appreciated.

 You could also try:

 from gluon.contenttype import CONTENT_TYPE
 CONTENT_TYPE['.webm'] = 'video/webm'

 presumably early in db.py, depending on when it was needed. Unless that's too 
 late in some case.


[web2py] Re: Soliciting freelance developers

2012-01-29 Thread Massimo Di Pierro
The policy is simple. If you have a business and you have a web site
that says you provide web2py support just ask and I will add you.

If you can claim projects already built with web2py, please also send
me those links.

I also encourage people to apply for membership to
expert4solutions.com. Your company could be listed there too.

Massimo


[web2py] Re: select data from database using date

2012-01-29 Thread Alan Etkin
I belive the and operator is not used with query expressions.
I think the proper intersection is query1  query2...  queryN

On 29 ene, 15:22, Sanjeet roy kumarsanjeet1...@gmail.com wrote:
 I have one date column due_date here i want to select the all data
 between dates one is starting date and one is end date both are taken
 manually so if the user select cmnpny and start and end date all the
 data related to company between choosen date should be come
 my code is below but i don't able to get the proper data:
 for row in db(db.f_company_compliance.company == session.company and
 db.f_company_compliance.due_date = session.strtdate and
 db.f_company_compliance.due_date = session.enddate).select():


[web2py] Re: help with js issue

2012-01-29 Thread Alan Etkin
On Mandriva Linux Free 2010 (32 bit) with KDE desktop I get a message
when I stop rocket with Ctrl-C:

unknown program name(10129)/ ClientApp::doIt: Creating ClientApp
kioclient(10129) ClientApp::kde_open: KUrl(http://127.0.0.1:8000;)
^CUnhandled exception in thread started by
Error in sys.excepthook:

The server exits after a few seconds.

Perhaps this can help to track the problem.

On 29 ene, 19:23, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I fixed issue 627. The other issue is still open.

 On Jan 29, 10:27 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:

  I would like to post web2py 2.0 since we have no major pending issues.
  Yet there are two issues I would like to fix first:

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

  I used to be able to stop the server with CRTL+C but it does not work
  anymore on my mac. I now have to kill it. Why?

  I could use some help. ;-)

  Massimo




[web2py] Re: 'Morsel' object has no attribute 'split' ?

2012-01-29 Thread Alan Etkin
Cant't you just modify the interface code to get the expected string
input? It seems that the input data is stored in the Morsel instance.

On 29 ene, 04:11, Ben Tammetta b...@clubelite.com wrote:
 Hello,

 I am using the code provided here to create a web2py facebook 
 applicationhttps://github.com/pythonforfacebook/facebook-sdk/blob/master/faceboo...

 When I call this function inside of facebook.py .
 testvar = facebook.get_user_from_cookie(request.cookies, FACEBOOK_APP_ID,
 FACEBOOK_APP_SECRET)

 I always get this error.
 'Morsel' object has no attribute 'split'

 It is trying to split the signed_request variable that does exits as in
 this case which was returned from facebook.

 signed_request Morsel:
 fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9'
 signed_request.split undefined

 I am not sure what I am doing wrong.  Any pointers or suggestions?

 Ben

 More details below.

 Ticket ID

 127.0.0.1.2012-01-29.00-45-53.cca4dcc3-0338-40d3-aaf0-e9ec6a29f163
 type 'exceptions.AttributeError' 'Morsel' object has no attribute 'split'
 Version
 web2py™ (1, 99, 4, datetime.datetime(2011, 12, 14, 14, 46, 14), 'stable')
 Python Python 2.6.6: /usr/bin/python

 

 Traceback
 File applications/FB_Tab_App/modules/facebook.py, line 376, in
 get_user_from_cookie
 parsed_request = parse_signed_request(cookie, app_secret)
 File applications/FB_Tab_App/modules/facebook.py, line 395, in
 parse_signed_request
 l = signed_request.split('.', 2)
 AttributeError: 'Morsel' object has no attribute 'split'

 Error snapshot help

 type 'exceptions.AttributeError'('Morsel' object has no attribute 'split')

 ..

 Function argument list

 (signed_request=Morsel:
 fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9',
 app_secret='16dc8c9503dca01b0bf3b36a41e4b43c')

 .

 Code listing

 
 information requested in the scope.

 If the signed_request is malformed or corrupted, False is returned.
 
 try:
 l = signed_request.split('.', 2)

 encoded_sig = str(l[0])
 payload = str(l[1])
 sig = base64.urlsafe_b64decode(encoded_sig + = * ((4 - len(encoded_sig) %
 4) % 4))
 data = base64.urlsafe_b64decode(payload + = * ((4 - len(payload) % 4) %
 4))

 Variables
 signed_request Morsel:
 fbsr_156579191121738='_idbY3Z4113pO9Z2h...CI6MTMyNzgxOTQ4MSwidXNlcl9pZCI6IjY5NzE1MTYyMiJ9'
 signed_request.split undefined
 l undefined


[web2py] SQLFORM.grid: search and links

2012-01-29 Thread backseat
I've a couple of questions about SQLFORM.grid:

 - Is it possible to position the buttons/links created by the 'links' 
argument somewhere other than the end of the row? It feels as if the 
'fields' argument should be able to do this, but I can't see how.

 - Is it possible for the 'search' box to search linked tables? That may be 
asking a bit much...

Thanks


[web2py] Re: Nesting HTML tables

2012-01-29 Thread DenesL
Can we see the code?

In the following example no tbody is added to the inner table:

 t=TABLE(*[TR(TABLE( *[ TR(*[1,2,3]), TR(*[4,5,6])] )),TR()])
 print t
tabletrtdtabletrtd1/tdtd2/tdtd3/td/
trtrtd4/tdtd5/tdtd6/td/tr/table/td/trtr/tr/
table

or nicely formatted:

table
  tr
td
  table
trtd1/tdtd2/tdtd3/td/tr
trtd4/tdtd5/tdtd6/td/tr
  /table
/td
  /tr
  tr
  /tr
/table



On Jan 29, 4:10 pm, Tsvi Mostovicz ttm...@gmail.com wrote:
 Hi all,
 I'm trying to get the following HTML structure using HTML helpers:

 tablethead.../thead
 tbody.../tbody
 tablethead.../thead
 tbody.../tbody
 /table/table

 AKA nested tables.
 For some reason when I put the TABLE helper within another TABLE
 helper, the internal one gets surrounded by tbody, tr and td causing
 it not to show properly. Does anyone have an idea how to fix this
 behavior?

 Thanks,

 Tsvi

 Sent from my phone


[web2py] Removing need for first and last name in auth

2012-01-29 Thread HittingSmoke
I'd like to use auth with only a username instead of first and last
name. I defined my own tables without a first and last name but it
still causes issues throughout the app.

For instance, when I try to use appadmin to add a user to a new auth
group I get an error (type 'exceptions.KeyError' 'first_name') if
there is no first and last name fields in the database. If I create
them but make them unreadable and unwritable the page will load but
all of the entries in the User ID dropdown say None None (user ID
#).

The auth Welcome bar is also fixed to the first name field and if not
used it will says Welcome, None.

This seems like quite a huge oversight for such a robust auth system.
Usernames are far more common for user management than first and last
names and many people just plain refuse to give their real names to
random web sites that require authentication.

Is there a modded version of auth perhaps that can be used as a
plugin? Excuse me if that sounds stupid, I'm just started out with
this and could very well just be going about this all wrong.


[web2py] Re: Removing need for first and last name in auth

2012-01-29 Thread Massimo Di Pierro
I suggest you simply make the fields hidden

db.auth_user.first_name.readable = db.auth_user.first_name.writable =
False
db.auth_user.last_name.readable = db.auth_user.last_name.writable =
False

On Jan 29, 6:36 pm, HittingSmoke hittingsm...@gmail.com wrote:
 I'd like to use auth with only a username instead of first and last
 name. I defined my own tables without a first and last name but it
 still causes issues throughout the app.

 For instance, when I try to use appadmin to add a user to a new auth
 group I get an error (type 'exceptions.KeyError' 'first_name') if
 there is no first and last name fields in the database. If I create
 them but make them unreadable and unwritable the page will load but
 all of the entries in the User ID dropdown say None None (user ID
 #).

 The auth Welcome bar is also fixed to the first name field and if not
 used it will says Welcome, None.

 This seems like quite a huge oversight for such a robust auth system.
 Usernames are far more common for user management than first and last
 names and many people just plain refuse to give their real names to
 random web sites that require authentication.

 Is there a modded version of auth perhaps that can be used as a
 plugin? Excuse me if that sounds stupid, I'm just started out with
 this and could very well just be going about this all wrong.


[web2py] new feature in trunk ... help test

2012-01-29 Thread Massimo Di Pierro
auth.mygroups

is a dictionary of (key,value) = (group_id,role)

This makes it easy to create objects like

db.define_table('thing',
Field('name'),
Field('groups_with_access','list:reference auth_group'))

and select them with

mythings =
db(db.thing.groups_with_access.contains(auth.mygroups.keys())).select(db.thing.ALL)

Before this makes it into stable I would like to hear comments and
suggestions for improvement.


Re: [web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Anthony


 You could also try:

 from gluon.contenttype import CONTENT_TYPE
 CONTENT_TYPE['.webm'] = 'video/webm'

 presumably early in db.py, depending on when it was needed. Unless that's 
 too late in some case.

Static files are served before hitting the app code, but should work for 
other downloads.
 


Re: [web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread LightDot
This brings back memories. I believe I may have had a similar problem 
recently. Apache  mod_wsgi, web2py 1.99.2.

I wanted to use css3pie to overcome IE8 and IE9 lack of CSS3 support. IE8 
is easy going, but IE9 strictly demands a correct file-type for the PIE.htc 
behaviour file in order to use it. So I did all that, had the correct 
content-type settings in Apache's configuration, got IE8 going just fine. 
But IE9 was lying dead in the water. Hm. I tried all possible solutions, 
even had Apache force content-type for an entire directory (didn't realize 
Apache has that many content-type enforcing possibilities), had css trigger 
different IE9 compatibility modes, tried god knows what to nudge IE9 into 
accepting PIE.htc. Nothing! And than it finally struck me...

My PIE.htc still opens as text in browser. Wait a minute... It shouldn't do 
that. It should download.

Once I moved PIE.htc file out of web2py entirely (it was in 
static/something/something), Apache content type was taken into account and 
it started working right away. This was one of *those* head scrathing bugs 
that make me chuckle afterwards and which I usually remember for a while. :)

If static files are indeed meant to be served before hitting the app code, 
then it must be a bug somewhere. Apache content-type doesn't seem to apply. 
Or does using web2py routes cause this? I had /someapp/static routed to 
/static.

Anyway...

AddType text/x-component .htc



[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Massimo Di Pierro
You have to tell web2py what do to with the file.

If the file is in static and served by web2py you should download it
with

http:///filename?attachment

if it is served by your controller you must set the
reponse.header['content-disposition'].


On Jan 29, 8:25 pm, LightDot light...@gmail.com wrote:
 This brings back memories. I believe I may have had a similar problem
 recently. Apache  mod_wsgi, web2py 1.99.2.

 I wanted to use css3pie to overcome IE8 and IE9 lack of CSS3 support. IE8
 is easy going, but IE9 strictly demands a correct file-type for the PIE.htc
 behaviour file in order to use it. So I did all that, had the correct
 content-type settings in Apache's configuration, got IE8 going just fine.
 But IE9 was lying dead in the water. Hm. I tried all possible solutions,
 even had Apache force content-type for an entire directory (didn't realize
 Apache has that many content-type enforcing possibilities), had css trigger
 different IE9 compatibility modes, tried god knows what to nudge IE9 into
 accepting PIE.htc. Nothing! And than it finally struck me...

 My PIE.htc still opens as text in browser. Wait a minute... It shouldn't do
 that. It should download.

 Once I moved PIE.htc file out of web2py entirely (it was in
 static/something/something), Apache content type was taken into account and
 it started working right away. This was one of *those* head scrathing bugs
 that make me chuckle afterwards and which I usually remember for a while. :)

 If static files are indeed meant to be served before hitting the app code,
 then it must be a bug somewhere. Apache content-type doesn't seem to apply.
 Or does using web2py routes cause this? I had /someapp/static routed to
 /static.

 Anyway...

 AddType text/x-component .htc


Re: [web2py] new feature in trunk ... help test

2012-01-29 Thread Bruno Rocha
I like the idea. Currently I am loading user groups on login.

I just think it have to be called auth.user_groups so it will be more
compatible with auth.user_id

http://zerp.ly/rochacbruno
Em 29/01/2012 23:17, Massimo Di Pierro massimo.dipie...@gmail.com
escreveu:

 auth.mygroups

 is a dictionary of (key,value) = (group_id,role)

 This makes it easy to create objects like

 db.define_table('thing',
Field('name'),
Field('groups_with_access','list:reference auth_group'))

 and select them with

 mythings =

db(db.thing.groups_with_access.contains(auth.mygroups.keys())).select(db.thing.ALL)

 Before this makes it into stable I would like to hear comments and
 suggestions for improvement.


[web2py] hollywoodr.js

2012-01-29 Thread Massimo Di Pierro
https://github.com/magnusvw/hollywoodr




Re: [web2py] select data from database using date

2012-01-29 Thread Sanjeet roy
Thanks Bruce My Problem is solved

[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread LightDot
First, I apologize for stealing a thread a bit, but this seems to be 
related to the original issue. This group is a wealth of knowledge so I 
guess it doesn't hurt to document this here...

In the case of PIE.htc, it only needs a proper content-type and it needs to 
be referenced in the css (I'm routing /someapp/static to /static):

behavior: url(/static/css3pie/PIE.htc);


So the proper way of telling web2py what content-type should it use, is to 
define (in a model):

from gluon.contenttype import CONTENT_TYPE
CONTENT_TYPE['.htc'] = 'text/x-component'

If that does it, it's not a big issue. Just something to document for 
future projects. I'm barely learning the inner workings of web2py, so I 
these kind of percepted bugs are a good way to progress... Also, just to 
note - I had good results with using css3pie with IE8 and IE9, so if anyone 
is in need of CSS3 gradients, box-shadows, rounded corners, etc. on these 
old fashioned browsers, give it a go.


Re: [web2py] select data from database using date

2012-01-29 Thread Bruce Wade
No problem any time.

On Sun, Jan 29, 2012 at 7:35 PM, Sanjeet roy kumarsanjeet1...@gmail.comwrote:

 Thanks Bruce My Problem is solved




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.warplydesigned.com
http://www.fitnessfriendsfinder.com


Re: [web2py] Re: help with js issue

2012-01-29 Thread Jonathan Lundell
On Jan 29, 2012, at 4:23 PM, Massimo Di Pierro wrote:

 Yes I am sure it is not running in background.
 
 Recently I started having two problems and I cannot track them down.
 1) on 10.6.8 I cannot quit with ctrl+C
 2) on Lion is keeps printing '^@' to console, about one per minute.
 I suspect these problems are related and bother me very much. I cannot
 think of any change that may have caused this.

Any command-line arguments? I only have 10.7, which responds fine to ^C. No ^@ 
yet (that's a NUL, btw, I think). No arguments, so Tcl  hardcron.

 web2py-github $ python web2py.py
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2011
 Version 1.99.4 (2012-01-29 16:24:43) stable
 Database drivers available: SQLite3, pymysql, pg8000, IMAP
 Starting hardcron...
 please visit:
   http://127.0.0.1:8000
 starting browser...



 
 There is also a test related to locking of language files that keeps
 failing.
 Who wrote the language tests? If you did can you help us understand
 it?
 
 massimo
 
 On Jan 29, 10:57 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 29, 2012, at 10:44 AM, Ovidio Marinho wrote:
 
 Ctrl+C in Mac is Cmd+C
 
 It is for copy, but not for quitting a process from the terminal. Control-C.
 
 Massimo, are you sure web2py isn't running in the background when you do 
 this? If you hit return, do you get a shell prompt? Control-C won't work 
 then.
 
 
 
 
 
 
 
 
 
Ovidio Marinho Falcao Neto
 Web Developer
  ovidio...@gmail.com
   ovidiomari...@itjp.net.br
  ITJP - itjp.net.br
83   8826 9088 - Oi
83   9334 0266 - Claro
 Brasil
 
 2012/1/29 Bruno Rocha rochacbr...@gmail.com
 the same for me, I always have to kill - 9 PID.
 
 But it only happens after some time.
 
 http://zerp.ly/rochacbruno
 
 Em 29/01/2012 14:27, Massimo Di Pierro massimo.dipie...@gmail.com 
 escreveu:
 
 I would like to post web2py 2.0 since we have no major pending issues.
 Yet there are two issues I would like to fix first:
 
 http://code.google.com/p/web2py/issues/detail?id=627
 
 I used to be able to stop the server with CRTL+C but it does not work
 anymore on my mac. I now have to kill it. Why?
 
 I could use some help. ;-)
 
 Massimo




Re: [web2py] Re: help with js issue

2012-01-29 Thread Jonathan Lundell
On Jan 29, 2012, at 4:23 PM, Massimo Di Pierro wrote:

 Yes I am sure it is not running in background.
 
 Recently I started having two problems and I cannot track them down.
 1) on 10.6.8 I cannot quit with ctrl+C
 2) on Lion is keeps printing '^@' to console, about one per minute.
 I suspect these problems are related and bother me very much. I cannot
 think of any change that may have caused this.

Is this with a fresh/virgin copy of the source, or might you have 
apps/crontasks that are involved?

[web2py] Re: new feature in trunk ... help test

2012-01-29 Thread Massimo Di Pierro
Done.

I also think we need a mechanism to give permissions to users about
groups. The auth_permission works well to give permissions about
objects and other tables but not about groups themselves.

For example consider the permission to manage a group. If we do

auth.has_permission('manage','auth_group',group_id)

this will check that the auth.user is member of a group that has
permission to manage the auth_group in question. The only thing that
would make sense is if that is the group 'user_%(id)s' which is unique
of the user. So now instead of one link between the user and the group
he has permission to manage we have to find which is the unique group
of the user, and check that members of this groups have the manage
permission on the other group. To check the names of the people who
have manage permission on a group we need three-way join. All of this
is cumbersome.

I think we need something like

db.define_table('auth_group_permission'
   Field('group_id','reference auth_group'),
   Field('user_id','reference auth_user'),
   Field('permission','string'),
   auth.signature)

Thoughts?


On Jan 29, 9:02 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 I like the idea. Currently I am loading user groups on login.

 I just think it have to be called auth.user_groups so it will be more
 compatible with auth.user_id

 http://zerp.ly/rochacbruno
 Em 29/01/2012 23:17, Massimo Di Pierro massimo.dipie...@gmail.com
 escreveu:

  auth.mygroups

  is a dictionary of (key,value) = (group_id,role)

  This makes it easy to create objects like

  db.define_table('thing',
     Field('name'),
     Field('groups_with_access','list:reference auth_group'))

  and select them with

  mythings =

 db(db.thing.groups_with_access.contains(auth.mygroups.keys())).select(db.th 
 ing.ALL)









  Before this makes it into stable I would like to hear comments and
  suggestions for improvement.


[web2py] Re: Problem with the audio tag, web2py and Firefox

2012-01-29 Thread Magnitus
Well, thank you for the support :).

I realize that the html5 codecs situation is a bit of a mess at the present.

@Lightdot:

It's always reassuring to know you're not the only one who tripped over 
this.

Sometimes, I feel like I should know the Framework inside out after having 
used it for about 2 years, but as much as you'd like to focus on one piece 
of technology and master it, when you are flying solo, there are so many 
things you need to know that it's crazy and the Framework itself is 
evolving (which is a great thing btw)!

Learning all the stuff, while highly satisfying, is a significant time 
overhead.


[web2py] New in trunk - disabling menu items

2012-01-29 Thread guruyaya
Say you have a response.menu, that goes

response.menu = [
(T('Home'), False, URL('default','index'), [
  (T('Looged In stuff'), False, URL('default','index'))
]),
(T('Logged in menu'), False, URL('default','index'), [
  (T('Menu Item'), False, URL('default','index'))
])
   ]

In this menu, some of the items, are for logged in users only. In the
new trunk, you can add a boolean statment, like true or false to the
menu, to hide a menu item. This can be used the following way:

response.menu = [
(T('Home'), False, URL('default','index'), [
  (T('Some other stuff'), False, URL('default','index')),

  (T('Looged In stuff'), False, URL('default','index'), [],
auth.is_logged_in())
]),
(T('Logged in menu'), False, URL('default','index'), [
  (T('Menu Item'), False, URL('default','index'))
], auth.is_logged_in())
]

You can ofcourse use every other boolean statement to make items
appear of disappear from this menu.
Hope you'll find this useful

Yair Eshel Cahansky


Re: [web2py] Web2py in large web scenarios

2012-01-29 Thread Johann Spies
On 27 January 2012 20:24, Bruno Rocha rochacbr...@gmail.com wrote:

 I also noted  best performance directly rendering the templates and
 caching views where it can be cached.

 just replacing

 return dict()

 with

 return response.render(filename, context)

Is there documentation about this?  How do you code the view differently in
such a case?

 the bottleneck is always server and database, so it is better to use pure
 Python to sort, find, filter Rows objects than using a lot of database
 requests.

 DAL provides .sort .find .exclude and Python has a lot of good things like
 map, reduce, filter. With one db request you can fetch records put them in
 cache and use Python in some cases to avoid more sql queries. Even
 paginations can be done without the need to go to db again.


This might be true for smaller queries, but when working with thousands of
records Postgresql is much more efficient than Python.

Regards
Johann
-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Web2py in large web scenarios

2012-01-29 Thread Johann Spies
On 28 January 2012 01:06, Michele Comitini michele.comit...@gmail.comwrote:

 About db bottlenecks:

 I think that using executesql gives a performance gain of 2 orders of
 magnitude over DAL on datasets with more than 1000 records.  The DAL
 is a huge bottleneck if used inappropriately.


I agree. I often find it easier to use executesql - many times just because
formulating a complex query for me  is not that easy using DAL.  Also DAL
cannot handle all the query types that one can do in Postgresql.

It is a pity that SQLFORM.grid seems to depend on DAL queries.   The
drawback is that one cannot use it in direct combination with executesql -
or can one?  I would like to know whether this is possible.

Regards
Johann

-- 
Because experiencing your loyal love is better than life itself,
my lips will praise you.  (Psalm 63:3)


Re: [web2py] Re: ssh tunnel to admin panel with lighttpd= ERROR:web2py.cache:corrupted file

2012-01-29 Thread nils
Hi,
.
Lighty runs under the user of www-data and so folders or files that
need to be written too, have to have the ownership changed to www-data
other wise you will get this error, same goes for a  download/upload
folder if you are uploading content via your application.

Regards,

Nils

On Sun, Jan 29, 2012 at 9:50 AM, Benjamin benjamin.aguet...@gmail.com wrote:
 Hello,

 Just to let you know ISSUE SOLVED.

 For an unknown reason sessions folder was not chown to www-data, so
 simply :

 chown -R www-data:www-data sessions

 solved the issue.

 I am not sure it's the way it should be but at least it works now.

 Thanks,

 Cheers,

 On 29 jan, 09:41, Benjamin benjamin.aguet...@gmail.com wrote:
 Hello Massimo,

 Unfortunately it doesn't solve it.

 There is from time to time only 2 files in this cache folder :
 cache.lock
 cache.shelve

 And deleting it doesn't change the behavior, i.e.: the web2py
 welcome page is displayed correctly using an SSH tunnel but the
 admin panel displays Internal error Ticket issued: admin/
 __1.2012-01-29.13-25-47.643f7d62-256c-4151-b2e3-fd1ef2fc332a

 Here is what I have found at the end of the ticket :
 ***
 SStorage {'_user_agent': {'os': {'name': 'Macint...owser':
 {'version': '5.1.1', 'name': 'Safari'}}} p3726 sg60
 SStorage {'body': cStringIO.StringO object at 0..._vars': Storage
 {}, 'post_vars': Storage {}} p3727
 sg2782 SStorage {'status': 200, 'body': cStringIO.Stri.../css/
 styles.css'], 'view': 'default/index.html'}
 p3728 sS'session_folder' p3729 S'/home/www-data/web2py/applications/
 admin/sessions' p3730 sssS'traceback' p3731
 S'Traceback (most recent call last):\n File /home/www-data/web2py/
 gluon/main.py, line 523, in wsgibase\n
 session._try_store_on_disk(request, response)\n File /home/www-data/
 web2py/gluon/globals.py, line 586, in
 _try_store_on_disk\n response.session_file =
 open(response.session_filename, \'wb\')\nIOError: [Errno 13]
 Permission denied:
 \'/home/www-data/web2py/applications/admin/sessions/..
 1-055bbcfa-3236-4328-b1ff-0dc2d70a32b9\'\n' p3732 s.

 ***

 By looking at my admin folder it seems like EVERYTHING has rights :
 drwxr-xr-x  www-data www-data, EXCEPT only the sessions folder
 which has drwxr-xr-x  root     root.

 Any reason why is it so ?

 Isn't the session folder supposed to also be drwxr-xr-x  www-data www-
 data ?

 It's really weird it happened as i've chown chown -R www-data:www-
 data web2py during web2py installation...

 Thanks for your help,

 Cheers,

 On 28 jan, 20:53, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Can you try delete applications/admin/cache/*?

  it is possible that there is a cache file created using a different
  python version and web2py cannot open it. For permission issues it may
  be unable to remove it and re-create it.

  On Jan 28, 12:25 pm, Benjamin benjamin.aguet...@gmail.com wrote:

   Hello guys,

   Attracted by web2py dev possibilities I couldn't resist ;-) But
   unfortunately deployment is a whole other story and I'm having major
   difficulties.

   So after a struggle I got web2py to run on lighttpd, then discovered
   that, as I didn't set any SSL, I couldn't access the admin interface.

   So I'm trying to use an ssh tunnel :
   ssh -L 9090:localhost:80 r...@192.168.1.101

   After that I can see the demo app at localhost:9090 but every single
   click on the Admin interface button on the right of the demo app end
   up with :

   on the browser side :
   Internal error
   Ticket issued: admin/__1.2012-01-28.23-18-18.cf854d0b-a8f7-4ef8-bd28-
   a24debe031a8

   on the terminal side (the terminal which started a bash script
   starting the fcgihandler.fcgi ) I got this :
   ERROR:web2py.cache:corrupted file /home/www-data/web2py/applications/
   admin/cache/cache.shelve, will try delete it!

   Interesting fact : each time I try to click on the admin panel
   button from the browser, a new ERROR:web2py.cache:corrupted file /
   home/www-data/web2py/applications/admin/cache/cache.shelve, will try
   delete it! is displayed on the terminal.

   What am I doing wrong ?

   Thanks a lot,

   cheers,

   PS : the file got deleted automatically each time but I still can't
   access the admin panel