[web2py] Re: Processing user entries prior to database commit

2012-12-17 Thread Niphlod
there's one additional detail before anyone can reply. If the user inserts 
JoHN DOe, the data on the database must be saved preserving the case 
sensitivity the user used? i.e. when the user comes back should he see JoHN 
DOe the way he inserted it or John Doe ? 

Il giorno lunedì 17 dicembre 2012 01:55:17 UTC+1, Dave Cenker ha scritto:

 I first must say that I have developed 2 different web applications using 
 Django in the past and I am very impressed and encouraged by what web2py 
 can offer to the web framework community. However, I am having trouble 
 carrying out a seemingly simple task without much ado after reviewing all 
 the documentation and traditional googling methods.
  
 Suppose I have a database table with a field named 'fullName'. When the 
 user submits a crud.create form with the data 'jOhN DoE', I would like for 
 this entry to be saved into the database as 'John Doe' (i.e. - title case). 
 In addition, I would like to be able to use the IS_IN_DB requirement 
 validator to disallow any variant of this entry to be entered in the 
 future. For example, if a user enters 'john doe', 'JOHN DOE', or 'JoHn 
 DoE', they should all be recognized as an entry that is already in the 
 database (i.e. - I would like a case insensitive check).
  
 I have tried to use the represent attribute on the field, however that 
 doesn't seem to affect the actual data that is saved in the database. I 
 have tried to use a custom onvalidation function, but it doesn't seem to 
 work well either. The only way I have seen that really seems to work is 
 having a separate database field (i.e. - two fields for the same database 
 object). Has anyone run into this situation and found a more eloquent 
 solution?
  
 Thanks in advance for any help you can provide!
  
 Dave
  


-- 





Re: [web2py] Re: count distinct

2012-12-17 Thread Manuele Pesenti

Il 14/12/12 02:49, Andrew W ha scritto:

Does your dbms support count(distinct ) ?
What happens if you only put one column in COUNT(DISTINCT 
vista.municipio) ?

thank you Andrew and Niphold,
using just one field for the distinct option works fine... I just 
thought a little bit better what I really needed from the query :).


M.

--





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread Andrew W
Thanks

-- 





[web2py] default/user/profile onaccept ?

2012-12-17 Thread Annet
For administrative reasons, when a user changes his e-mail address in 
default/user/profile, I want to inform the admin by mail.

Is there a way to adjust the default user function, or should I define a 
separate profile function do something like:

def profile():
row=db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL).first()
form=crud.update(table=db.auth_usert,record=row,next=session.crud_next,\
onaccept= lambda form:mail.send(to=[TOMAIL],subject='E-mail address 
updated ' + str(auth.user.id),message=''),\
deletable=False)
return dict(form=form)


Kind regards,

Annet

-- 





[web2py] Re: Webassets in web2py

2012-12-17 Thread Niphlod
let's give webassets a try: it's a dependency hell (I highly doubt this 
will be shipped with web2py).

However, contrib module are made for those kind of things.

Shallow first analysis according to 
http://elsdoerfer.name/docs/webassets/builtin_filters.html
JS: 
- rjsmin (strips just newline and whitespaces)
- yui_js (needs yuicompressor, hence a python module and java)
- closure_js (needs closure, hence a python module and java)
- uglify_js (needs uglify binary in path, hence node.js)
- jsmin (needs jsmin, hence a python module, does pretty much the same 
thing as response.minify_js)
- jspacker (included)
CSS:
- cssmin (needs cssmin, hence a python module, does pretty much the same 
thing as response.minify_css)
- cssutils (same as before)
- yui_css (same as for js)
- clean_css (node.js required)
- slimmer_css (needs slimmer, hence a python module)
compilers
- clevercss (needs clevercss, hence a python module)
- less (needs less by node.js or ruby)
- sass (needs sass from ruby)
- scss (same as ssas)
- compass (same as ssas)
- pyscss (requires a module)
- stylus (node.js required)
- coffeescript (node.js required)
gzip
- done by scripts/zip_static_files.py
sprites
- requires spritemapper

I skipped over js templates generators and jinja2 for obvious reasons.
So, basically, you'd have a python only functionality slighthly better 
than the one currently included in web2py with:
JS: no such thing
CSS: no such thing
compilers:
clevercss and pyscss
sprites:
spritemapper

All the others features are not python modules: they are just smart 
wrapper around the command-line arguments of each binary.
Now, let's talk about what functionality do you miss in web2py is it 
just something like edit the less file in static/less/file.less and have 
it recompiled as /static/css/file.css ?


-- 





[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
I'm also not a sysadmin, but I did go through the process of setting up 
web2py on webfaction recently as well. I also found that script but it 
seemed to be overly complicated. In particular, there is no need to 
download, build  run nginx, as you can use webfaction's instance. If there 
is an advantage to running your own I'd be curious to hear about it. 
Simplified steps I followed:

1. download  build latest uwsgi
2. download  unpack latest web2py
3. set up a custom app using webfaction's control panel, taking note of 
the port
4. run the uwsgi binary, specifying parameters in the command line. For the 
socket parameter use 127.0.0.1 and the port webfaction assigned for your 
custom app. There are a few other posts in this group about selecting good 
uwsgi parameters so that you don't run out of memory (seems to be a common 
pitfall on webfaction)

Hope that's useful.

Neil


On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:

 I've been learning web2py on Webfaction off and on for a while now. The 
 web2py install script on the Webfaction wiki is quite outdated and runs on 
 an Apache instance that can barely stay within the default memory limits 
 without serious tweaking. Responsiveness with web2py/apache out of the box 
 with the default install script is unimpressive as well.

 A while back I tried a lighttpd setup with web2py on Webfaction. The 
 memory usage went way down and responsiveness was better but the web server 
 was quite unstable. I found myself having to restart it constantly and I 
 couldn't track down the cause of the breakages. After the host upped the 
 default RAM limit on CentOS6 systems to 256MB things got better as it made 
 Apache more manageable on custom installs but it still sucked overall.

 So I found an install script for nginx/uWSGI on the WF community support 
 forumhttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgibut
  it was horribly outdated and had multiple issues pointed out in the 
 comments that went unfixed. I spent a couple hours today fixing the ignored 
 errors, updating it to the latest nginx and uwsgi versions and fixing the 
 errors which that brought on. After getting it working my RAM usage has 
 decreased and responsiveness of my web2py apps has noticeably increased. I 
 figured I'd share the script for anyone interested.

 I'm not a sysadmin, more of a hobbyist so any critique of my server 
 configs here are greatly welcome. Please note that the comments are not 
 mine. I merely updated the parts of the script that were required for it to 
 work. All else was left as-is.

 Also, if anyone with knowledge of XML-RPC want's to make an actual 
 Webfaction install 
 scripthttps://docs.webfaction.com/xmlrpc-api/tutorial.html for 
 nginx/uwsgi/web2py that would be awesome. It could be added to the script 
 wiki.

 #!/bin/sh


 # TODO's:
 # * find free port for communication for nginx and uwsgi
 # * test conjob creation properly


 echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py (latest 
 stable)'
 echo 'If you wish to create cronjobs comment out the last lines of this 
 script'


 # port betweet nginx and uwsgi
 nginx_uwsgi_port=9001


 # Get web2py admin password
 echo Web2py admin password:
 read  web2py_password


 # Get webfaction application name
 echo Webfaction application name:
 read  webfaction_app_name


 # Get webfaction port number
 echo Webfaction application port:
 read  webfaction_app_port


 # port betweet nginx and uwsgi
 echo Port number for communication between nginx and uswgi (eg. 9001):
 read nginx_uwsgi_port


 ### 
 ### web2py
 ###
 cd ~/webapps/${webfaction_app_name}
 wget http://www.web2py.com/examples/static/web2py_src.zip
 unzip web2py_src.zip
 rm web2py_src.zip
 cd web2py
 python -c from gluon.main import save_password; 
 save_password('${web2py_password}',${webfaction_app_port})
 cd ..


 ###
 ### nginx
 ###
 mkdir downs
 cd downs


 # download and install nginx in the appname directory
 wget http://nginx.org/download/nginx-1.2.6.tar.gz
 tar xvf nginx-1.2.6.tar.gz
 cd nginx-1.2.6


 ./configure \
   --prefix=/home/${USER}/webapps/${webfaction_app_name}/nginx \
   --sbin-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/sbin/nginx 
 \
   --conf-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/nginx.conf 
 \
   --error-log-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/log/
 error.log \
   --pid-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/run/nginx.pid 
  \
   --lock-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/lock/
 nginx.lock \
   --with-http_gzip_static_module \
   --http-log-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/log/
 access.log \
   --http-client-body-temp-path=/home/${USER}/webapps/${webfaction_app_name
 }/nginx/tmp/client/ \
   --http-proxy-temp-path=/home/${USER}/webapps/${webfaction_app_name}/
 nginx/tmp/proxy/ \
   --http-fastcgi-temp-path=/home/${USER}/webapps/${webfaction_app_name}/
 

[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
This thread has a more detailed exampled of a script:

https://groups.google.com/forum/?fromgroups=#!searchin/web2py/uwsgi$20webfaction/web2py/PWpwayGa4Io/bBVyehyZ3ogJ

On Monday, December 17, 2012 12:32:21 PM UTC, Neil wrote:

  There are a few other posts in this group about selecting good uwsgi 
 parameters so that you don't run out of memory (seems to be a common 
 pitfall on webfaction)




-- 





[web2py] Re: SQLFORM.grid joins and view/edit

2012-12-17 Thread Michael Hall
Just bumping this as I am still struggling with view and edit for joined 
SQLFORM.grid's

On Wednesday, 28 November 2012 11:17:36 UTC, Michael Hall wrote:

 I have a SQLFORM.grid with a join, however when I insert, edit or update a 
 record displayed in the grid I am only ever given a form for the parent 
 table.

 What is the preferred method for creating insert, update and delete forms 
 for a joined SQLFORM.grid? Common sense tells me that it is the method 
 outlines in chapter 7: One form for multiple tables but this uses form 
 factory which to my noobish eyes does not seem to cover updating the same 
 way as vanilla SQLFORM in chapter 7's SQLFORM and insert/update/delete

 Can I create multi table update forms with either of these?

 Thanks in Advance

 Mike


-- 





[web2py] Re: Webassets in web2py

2012-12-17 Thread Arnon Marcus
Holy shit...

Where did you say you got all that info from?
Is this what that module needs?

I thought it's just a stand-alone pythonic-module doing everything...
Guess I was a bit optimistic...

What about coffeeCup?

- is it just something like edit the less file in static/less/file.less 
and have it recompiled as /static/css/file.css
Well, either that and/or sass/scss, as well as coffescript transpiling, 
with optional minification/zipping for the resaulting js/css, yeah, 
basically that.

But if there is ANY need for node.js in this kind of solution, than forget 
it.
There are already many pre-packaged npm's for node that do all that and 
then some (like yaomen).
I guess we'll have to get used to the idea of running node locally at each 
dev-machine for development, and another in the server for CI stuff...

Is web2py minifying css/js scripts by default? If so, in what 
circumstances? And since what version?

-- 





[web2py] Re: Single page apps vs Web2py

2012-12-17 Thread Arnon Marcus
Another general issue regarding that:

How would web2py behave using various modular javascript loaders?
Do I HAVE to configure my web server so serve the static folder?
How about AMD solutions (such as require.js and r.js), how would they 
behave?
Is there a way to rout those requests through web2py?
Can the request be dependecy-calculated in the client-side, and accumulated 
into a single request?
What are the proes/cons of doing that through web2py and/or through the web 
server directly?

-- 





Re: [web2py] many things break with multiple controllers

2012-12-17 Thread Massimo Di Pierro
I am prettysure web2py does not call str.format either. Must be in user's 
code.

On Monday, 17 December 2012 01:24:56 UTC-6, viniciusban wrote:

 On Sat, Dec 15, 2012 at 1:17 AM, Lewis lewis...@hotmail.com javascript: 
 wrote: 
  
  After attempting to delete a category that still references items, the 
  following error resulted: 
  
  type 'exceptions.AttributeError' 'str' object has no attribute 
 'format' 

 str.format() was introduced in Python 2.6. 

 What Python version are you using? 

  
  All I did today was paste the cut and paste the function from default.py 
  to full.py.  Previously the function worked perfectly. 
  
  A bug in web2py?  Something I did? 

 If this same piece of code worked before, I think it's a condition not 
 entered before. If you're using Python 2.6 or higher, it must work. 

  
  Should I give up on multiple controllers and go back to just one file? 

 Definetely it is not with a web2py or multiple controllers issue. It's 
 a Python compiler message. 


-- 





[web2py] Re: Processing user entries prior to database commit

2012-12-17 Thread Massimo Di Pierro
assuming

   db.define_table('person',Field('fullname'))
   db.define_table('thing',Field('name'),Field('belongsto','reference 
person'))

you can define a function to capitalized a name

   def capitalize(name): return ' '.join(t.capitalize() for t in (name or 
'').split())

You can use to change the representation of name

  db.person.fullname.represent = lambda name,row: capitalize(name)

If you want to store fullname capitalized you can create a validator instead

   class CAPITALIZE(object):
   def __call__(self,name): return ' '.join(t.capitalize() for t in 
(name or '').split())
   db.person.fullname.requires=CAPITALIZE

For the references you can do

   db.thing.belongsto.requires=IS_IN_DB(db,db.person.fullname)

Instead of a dropdown you may want an autocomplete widget.

   db.thing.belongsto.widget = 
SQLFORM.widgets.autocomplete(request,db.person.fullname, db.person.id)

Putting all together:

   db.define_table('person',Field('fullname'))
   db.define_table('think',Field('name'),Field('belongsto','reference 
person'))
   class CAPITALIZE(object):
   def __call__(self,name): return ' '.join(t.capitalize() for t in 
(name or '').split())
   db.person.fullname.requires=CAPITALIZE
   db.thing.belongsto.widget = 
SQLFORM.widgets.autocomplete(request,db.person.fullname, db.person.id)

Mind that if somebody is called McDonald O'Neil it would become  
Mcdonald O'neil. Are you sure that is what you want?

On Sunday, 16 December 2012 18:55:17 UTC-6, Dave Cenker wrote:

 I first must say that I have developed 2 different web applications using 
 Django in the past and I am very impressed and encouraged by what web2py 
 can offer to the web framework community. However, I am having trouble 
 carrying out a seemingly simple task without much ado after reviewing all 
 the documentation and traditional googling methods.
  
 Suppose I have a database table with a field named 'fullName'. When the 
 user submits a crud.create form with the data 'jOhN DoE', I would like for 
 this entry to be saved into the database as 'John Doe' (i.e. - title case). 
 In addition, I would like to be able to use the IS_IN_DB requirement 
 validator to disallow any variant of this entry to be entered in the 
 future. For example, if a user enters 'john doe', 'JOHN DOE', or 'JoHn 
 DoE', they should all be recognized as an entry that is already in the 
 database (i.e. - I would like a case insensitive check).
  
 I have tried to use the represent attribute on the field, however that 
 doesn't seem to affect the actual data that is saved in the database. I 
 have tried to use a custom onvalidation function, but it doesn't seem to 
 work well either. The only way I have seen that really seems to work is 
 having a separate database field (i.e. - two fields for the same database 
 object). Has anyone run into this situation and found a more eloquent 
 solution?
  
 Thanks in advance for any help you can provide!
  
 Dave
  


-- 





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread lucas
probably related:

using web2py 2.3.1 stable, centos 6.3, httpd  apache 2

(2, 3, 1, datetime.datetime(2012, 12, 14, 15, 24, 12), 'stable')PythonPython 
2.6.6: /usr/bin/pythonTRACEBACK

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

Traceback (most recent call last):
  File /opt/web-apps/web2py/gluon/main.py, line 538, in wsgibase
if global_settings.debugging and app != admin:
  File /opt/web-apps/web2py/gluon/main.py, line 206, in serve_controller
# ##
  File /opt/web-apps/web2py/gluon/compileapp.py, line 400, in 
build_environment
request.env.http_accept_language)
TypeError: __init__() takes exactly 2 arguments (3 given)

ERROR SNAPSHOT [image: help]

type 'exceptions.TypeError'(__init__() takes exactly 2 arguments (3 
given))

On Monday, December 17, 2012 4:44:00 AM UTC-5, Andrew W wrote:

 Thanks

-- 





[web2py] problem with update

2012-12-17 Thread cabildocl
hi, i have a problem from to update web2py  to latest version, the error is 
the next:

Ticket ID 

10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
type 'exceptions.ValueError' invalid literal for int() with base 10: '-1 
day,'

Function argument list 

(self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
value=datetime.timedelta(-1, 41400), field_type='time')
 Code listing 

1837.
1838.
1839.
1840.
1841.
1842.

1843.
1844.
1845.
1846.

value = datetime.date(y, m, d)
return value

def parse_time(self, value, field_type):
if not isinstance(value, datetime.time):
#time_items = map(int,str(value)[:8].strip().split(':')[:3])

if len(time_items) == 3:
(h, mi, s) = time_items
else:
(h, mi, s) = time_items + [0]

 Variables builtinlen built-in function len  time_items undefined

this worked ok, your help please




-- 





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread Massimo Di Pierro
1225 was just fixed!

On Monday, 17 December 2012 03:44:00 UTC-6, Andrew W wrote:

 Thanks

-- 





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread Massimo Di Pierro
Please make a clean installation. Looks like you have a new compileapp.py 
but an old languages.py.

Something went beck during unzipping.

massimo

On Monday, 17 December 2012 08:40:46 UTC-6, lucas wrote:

 probably related:

 using web2py 2.3.1 stable, centos 6.3, httpd  apache 2

 (2, 3, 1, datetime.datetime(2012, 12, 14, 15, 24, 12), 'stable')PythonPython 
 2.6.6: /usr/bin/pythonTRACEBACK

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

 Traceback (most recent call last):
   File /opt/web-apps/web2py/gluon/main.py, line 538, in wsgibase
 if global_settings.debugging and app != admin:
   File /opt/web-apps/web2py/gluon/main.py, line 206, in serve_controller
 # ##
   File /opt/web-apps/web2py/gluon/compileapp.py, line 400, in 
 build_environment
 request.env.http_accept_language)
 TypeError: __init__() takes exactly 2 arguments (3 given)

 ERROR SNAPSHOT [image: help]

 type 'exceptions.TypeError'(__init__() takes exactly 2 arguments (3 
 given))

 On Monday, December 17, 2012 4:44:00 AM UTC-5, Andrew W wrote:

 Thanks



-- 





[web2py] Re: default/user/profile onaccept ?

2012-12-17 Thread Massimo Di Pierro
auth.settings.profile_onaccept.append(lambda form: 
mail.sent(to='administra...@example.com', subject='email change', 
message=%(first_name)s %(last_name)s changed email to %(email)s % 
form.vars))

On Monday, 17 December 2012 05:11:30 UTC-6, Annet wrote:

 For administrative reasons, when a user changes his e-mail address in 
 default/user/profile, I want to inform the admin by mail.

 Is there a way to adjust the default user function, or should I define a 
 separate profile function do something like:

 def profile():
 row=db(db.auth_user.id==auth.user.id).select(db.auth_user.ALL).first()
 
 form=crud.update(table=db.auth_usert,record=row,next=session.crud_next,\
 onaccept= lambda form:mail.send(to=[TOMAIL],subject='E-mail address 
 updated ' + str(auth.user.id),message=''),\
 deletable=False)
 return dict(form=form)


 Kind regards,

 Annet


-- 





[web2py] REF: SQLFORM.grid error

2012-12-17 Thread Teddy Nyambe
I am trying to set the fields to display in my grid...I am following the
slice at http://www.web2pyslices.com/slice/show/1471/sqlformgrid , however,
I am having an error with fields...I am using it as follows and I getting
an error as below:

links = [lambda row: A('View
Post',_href=URL(administration,file_details,args=[row.file_transaction.file_id]))]
fields =
(db.file_transaction.file_id,db.file_transaction.source_office_id, \
db.file_transaction.destination_office_id,
db.file_transaction.transaction_date_time)
query = ((db.file_subject_issue.circulation_status==True) 
(db.file_transaction.file_subject_issue_id == db.file_subject_issue.id))
form = SQLFORM.grid(query,searchable=True,links=links, fields=fields,
deletable=False, \
details=False, editable=False, \
selectable=False,csv=False , paginate=20,
user_signature=False)

Error:

type 'exceptions.AttributeError' 'tuple' object has no attribute 'append'


2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted
exec ccode in environment
  File 
/home/www-data/web2py/applications/intranet/controllers/administration.py
https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
line 175, in module
  File /home/www-data/web2py/gluon/globals.py, line 188, in lambda
self._caller = lambda f: f()
  File 
/home/www-data/web2py/applications/intranet/controllers/administration.py
https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
line 70, in file_track
selectable=False,csv=False , paginate=20, user_signature=False)
  File /home/www-data/web2py/gluon/sqlhtml.py, line 1799, in grid
fields.append(field_id)
AttributeError: 'tuple' object has no attribute 'append'


-- Teddy L

-- 





Re: [web2py] 'Row' object has no attribute powerTable

2012-12-17 Thread FERNANDO VILLARROEL
Dear Bruno.
Yes works fine without powerTable
The problem occur when i use powerTable.
Regards

--- On Mon, 12/17/12, Bruno Rocha rochacbr...@gmail.com wrote:

From: Bruno Rocha rochacbr...@gmail.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 1:04 AM

what happens if you just return the Rows without using powerTable, it works?
def test():    
return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)



-- 

 

 

 

-- 





[web2py] Re: problem with update

2012-12-17 Thread Massimo Di Pierro
That line is definitively not commented in the web2py source code for 2.3.1 
and 2.3.2

On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the error 
 is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: '-1 
 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: REF: SQLFORM.grid error

2012-12-17 Thread Massimo Di Pierro
Replace

 fields = 
(db.file_transaction.file_id,db.file_transaction.source_office_id, \
db.file_transaction.destination_office_id, 
db.file_transaction.transaction_date_time)

with

 fields = 
[db.file_transaction.file_id,db.file_transaction.source_office_id, \
db.file_transaction.destination_office_id, 
db.file_transaction.transaction_date_time]

On Monday, 17 December 2012 08:58:36 UTC-6, software.ted wrote:

 I am trying to set the fields to display in my grid...I am following the 
 slice at http://www.web2pyslices.com/slice/show/1471/sqlformgrid , 
 however, I am having an error with fields...I am using it as follows and I 
 getting an error as below:

 links = [lambda row: A('View 
 Post',_href=URL(administration,file_details,args=[row.file_transaction.file_id]))]
 fields = 
 (db.file_transaction.file_id,db.file_transaction.source_office_id, \
 db.file_transaction.destination_office_id, 
 db.file_transaction.transaction_date_time)
 query = ((db.file_subject_issue.circulation_status==True)  
 (db.file_transaction.file_subject_issue_id == db.file_subject_issue.id))
 form = SQLFORM.grid(query,searchable=True,links=links, fields=fields, 
 deletable=False, \
 details=False, editable=False, \
 selectable=False,csv=False , paginate=20, 
 user_signature=False)

 Error:

 type 'exceptions.AttributeError' 'tuple' object has no attribute 'append'


 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted

 exec ccode in environment
   File 
 /home/www-data/web2py/applications/intranet/controllers/administration.py 
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
  line 175, in module

   File /home/www-data/web2py/gluon/globals.py, line 188, in lambda

 self._caller = lambda f: f()

   File 
 /home/www-data/web2py/applications/intranet/controllers/administration.py 
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
  line 70, in file_track

 selectable=False,csv=False , paginate=20, user_signature=False)

   File /home/www-data/web2py/gluon/sqlhtml.py, line 1799, in grid

 fields.append(field_id)
 AttributeError: 'tuple' object has no attribute 'append'


 -- Teddy L
  

-- 





[web2py] web2py 2.3.2 is OUT

2012-12-17 Thread Massimo Di Pierro
It is the same as 2.3.2 but fixed a major bug with NEWINSTALL being ignored 
and therefore not creating the welcome.w2p for the new scaffolding app.

If you are using 2.3.1 you may still be using an older welcome instead of 
the cool new one. Upgrade to 2.3.2 to fix this.

Massimo

-- 





[web2py] How to a web2py environment along to subprocess?

2012-12-17 Thread Ian W. Scott
I'm running a file like this:

python ~/web/web2py/web2py.py -S paideia -M -R 
applications/paideia/bin/runtest.py

Then I launch a subprocess from runtest.py like this:

proc = subprocess.Popen(py.test {}.format(test_dir),
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
shell=True)
stdout_val, stderr_val = proc.communicate()

is there any way to expose the web2py environment from runtest.py to the 
new subprocess?

-- 





[web2py] Re: importing modules to test file using pytest

2012-12-17 Thread Ian W. Scott
After a bit of hacking I put together a working test runner for pytest. 
Here it is:


Run this app's tests via py.test

place this file in applications/appname/bin/

run with: python your web2py dir/web2py.py -S paideia -M -R 
applications/appname/bin/runtest.py

import os
import sys
import pytest

def run_pytest(w2p_dir, test_dir, app_name):
if os.name == 'nt':
errlist = (WindowsError,ValueError,SystemExit)
else:
errlist = (OSError,ValueError,SystemExit)

try:
test_dir = os.path.join(w2p_dir, 'applications', app_name, test_dir)
if test_dir not in sys.path:
sys.path.append(test_dir)   # to support imports from current 
folder in the testfiles
# modules are applications/[app_name]/modules
modules_path = os.path.join('applications', app_name, 'modules')
if modules_path not in sys.path:
sys.path.append(modules_path)   # to support imports from 
modules folder
if 'site-packages' not in sys.path:
sys.path.append('site-packages')# support imports from 
web2py/site-packages
pytest.main([test_dir]) # run pytest programmatically

except Exception, e:
print type(e), e

if __name__=='__main__':
run_pytest(your web2py directory, your test folder, your appname)

I'll post a slice to w2py slices with this code as well and post the file 
in a github repo. I'm not a brilliant programmer, so I'm sure others might 
have improvements to suggest (esp. since right now you have to configure 
things in the test runner file itself). But it's a working start. 


On Wednesday, December 5, 2012 3:06:45 PM UTC-5, Ian W. Scott wrote:

 [edit: sorry, I forgot the runtest.py attachment before.]
 I'm trying to use pytest (instead of unittest) to do unit testing for a 
 web2py app. I've written a script (attached: runtest.py) to launch py.test, 
 which then finds and executes my test files. I run this launcher script in 
 a web2py environment like this:

 python ~/web/web2py/web2py.py -S paideia -M -R 
 applications/paideia/bin/runtest.py

 The problem is that when I try to import gluon or any of my app's custom 
 modules (where the classes under test live) I get an import error. 

 This is particularly strange since my runtest.py explicitly adds the app 
 modules folder to sys.path (this is mostly cribbed from the testrunner.py 
 on web2py slices). But my grasp of the w2p environment and running 
 subprocesses is weak at best. (Case in point, testrunner.py passes 
 globals() to the test files using execfile(testfile, globals()) but I 
 haven't figured out yet how to get pytest to pick up those globals, since 
 it doesn't allow me to execute the test files directly.)

 Any help is much appreciated. If we can get this working I think it would 
 be a help, since some of pytest's functions (e.g., parameterized fixtures 
 and automatic fixture clean-up) are pretty powerful.



-- 





[web2py] Re: How to a web2py environment along to subprocess?

2012-12-17 Thread Ian W. Scott
Sorry, the question title should read How to *pass* a web2py environment 
along . . . I can't seem to correct the title!

On Monday, December 17, 2012 11:11:47 AM UTC-5, Ian W. Scott wrote:

 I'm running a file like this:

 python ~/web/web2py/web2py.py -S paideia -M -R 
 applications/paideia/bin/runtest.py

 Then I launch a subprocess from runtest.py like this:

 proc = subprocess.Popen(py.test {}.format(test_dir),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 shell=True)
 stdout_val, stderr_val = proc.communicate()

 is there any way to expose the web2py environment from runtest.py to the 
 new subprocess?



-- 





Re: [web2py] Re: importing modules to test file using pytest

2012-12-17 Thread Vinicius Assef
Nice, Ian.

I'm overworking these days. I'll touch this next week.



On Mon, Dec 17, 2012 at 2:41 PM, Ian W. Scott scotti...@gmail.com wrote:
 After a bit of hacking I put together a working test runner for pytest. Here
 it is:

 
 Run this app's tests via py.test

 place this file in applications/appname/bin/

 run with: python your web2py dir/web2py.py -S paideia -M -R
 applications/appname/bin/runtest.py
 
 import os
 import sys
 import pytest

 def run_pytest(w2p_dir, test_dir, app_name):
 if os.name == 'nt':
 errlist = (WindowsError,ValueError,SystemExit)
 else:
 errlist = (OSError,ValueError,SystemExit)

 try:
 test_dir = os.path.join(w2p_dir, 'applications', app_name, test_dir)
 if test_dir not in sys.path:
 sys.path.append(test_dir)   # to support imports from current
 folder in the testfiles
 # modules are applications/[app_name]/modules
 modules_path = os.path.join('applications', app_name, 'modules')
 if modules_path not in sys.path:
 sys.path.append(modules_path)   # to support imports from
 modules folder
 if 'site-packages' not in sys.path:
 sys.path.append('site-packages')# support imports from
 web2py/site-packages
 pytest.main([test_dir]) # run pytest programmatically

 except Exception, e:
 print type(e), e

 if __name__=='__main__':
 run_pytest(your web2py directory, your test folder, your appname)

 I'll post a slice to w2py slices with this code as well and post the file in
 a github repo. I'm not a brilliant programmer, so I'm sure others might have
 improvements to suggest (esp. since right now you have to configure things
 in the test runner file itself). But it's a working start.


 On Wednesday, December 5, 2012 3:06:45 PM UTC-5, Ian W. Scott wrote:

 [edit: sorry, I forgot the runtest.py attachment before.]

 I'm trying to use pytest (instead of unittest) to do unit testing for a
 web2py app. I've written a script (attached: runtest.py) to launch py.test,
 which then finds and executes my test files. I run this launcher script in a
 web2py environment like this:

 python ~/web/web2py/web2py.py -S paideia -M -R
 applications/paideia/bin/runtest.py

 The problem is that when I try to import gluon or any of my app's custom
 modules (where the classes under test live) I get an import error.

 This is particularly strange since my runtest.py explicitly adds the app
 modules folder to sys.path (this is mostly cribbed from the testrunner.py on
 web2py slices). But my grasp of the w2p environment and running subprocesses
 is weak at best. (Case in point, testrunner.py passes globals() to the test
 files using execfile(testfile, globals()) but I haven't figured out yet how
 to get pytest to pick up those globals, since it doesn't allow me to execute
 the test files directly.)

 Any help is much appreciated. If we can get this working I think it would
 be a help, since some of pytest's functions (e.g., parameterized fixtures
 and automatic fixture clean-up) are pretty powerful.

 --




-- 





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread Ron McOuat
Tested with a clean install of trunk, fixed. Thanks

On Monday, 17 December 2012 06:51:04 UTC-8, Massimo Di Pierro wrote:

 1225 was just fixed!

 On Monday, 17 December 2012 03:44:00 UTC-6, Andrew W wrote:

 Thanks



-- 





[web2py] Help on rewrite using parameter-based

2012-12-17 Thread Tito Garrido
Hi Folks!

I have a bunch of domain using the same application so I have something
like:
routers = dict(
  BASE  = dict(
  domains = {
  'domain1.net' : 'app/principal',
  'www.domain1.net' : 'app/principal',
  'domain2.net.br' : 'app/principal',
  'www.domain2.net.br' : 'app/principal' }

Now I need to have (for migration proposes) something like:

www.domain1.net/something.php mapped to app/content(my
controler)/something(parameter) but it still needs to show
www.domain1.net/something.php on the browser and something may vary...

How can I do that using parameter-based rewrite?

Thanks in advance!

-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 





[web2py] Passing an environment variable to wep2py

2012-12-17 Thread Kostas M
I am trying  to set up an environment variable (lets say 
WEB2PY_USE_DB_TESTING), so that in my db.py:

if not os.environ.get(WEB2PY_USE_DB_TESTING,None):
db = DAL('sqlite://storage.sqlite')
else:
db = DAL('sqlite://../fts/testdb.sqlite')

(as this resource points out:  
http://ncdegroot.blogspot.ca/2011/09/web2py-automate-unittesting-doctesting.html)

I want to set this variable by script, only when I run my functional tests.

So I have tried up to now:


   1. class FunctionalTest(unittest.TestCase):
   
   @classmethod
   def setUpClass(self):
   os.environ[WEB2PY_USE_DB_TESTING]= 1
   self.web2py = start_web2py_server()
   self.browser = webdriver.Firefox()
   self.browser.implicitly_wait(5)
   2. running web2py with --config=MYCONFIG, where MYCONFIG.py has:

import os
os.environ[WEB2PY_USE_DB_TESTING]= 1



Both methods fail to transfer the environment variable to the shell that 
web2py runs... Any suggestions?

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-17 Thread Richard Vézina
I am not sure, the only thing that I know is that Nginx is not showing up
until I stop and restart it. Maybe it was needing a reload as you said at
last...

Richard

On Fri, Dec 14, 2012 at 3:01 PM, Niphlod niph...@gmail.com wrote:

 tly with the install and this line is the culprit ?

-- 





[web2py] Using contrib.webclient to test JSONRPC interfaces

2012-12-17 Thread Daniel Gonzalez
Hi,

I am trying to understand how to use the included WebClient to test a 
JSONRPC interface. One showstopper for me at the moment is that I see the 
following in WebClient.post:

# time the POST request
data = urllib.urlencode(data)
t0 = time.time()
self.response = opener.open(self.url,data)
self.time = time.time()-t0

When doing JSONRPC accesses I do not want the data to be urlencoded. 
Actually, I will prepare the data with json.dump, and I want WebClient to 
POST it transparently (I guess this goes in the body of the POST request). 
Is this at all possible? Is there an example of WebClient usage 
for JSONRPC interfaces somewhere?

Thanks,
Daniel Gonzalez

-- 





Re: [web2py] Specify password strengh, with error feedback

2012-12-17 Thread Daniel Gonzalez
Thanks, this was very helpful.

On Monday, December 17, 2012 4:05:02 AM UTC+1, Massimo Di Pierro wrote:

 Which you can find here:


 http://web2py.com/examples/static/epydoc/web2py.gluon.validators.IS_STRONG-class.html

 On Sunday, 16 December 2012 17:49:51 UTC-6, Jonathan Lundell wrote:

 On 16 Dec 2012, at 3:47 PM, Daniel Gonzalez gonv...@gmail.com wrote:

 Is is possible to specify what kind of password is allowed? For example, 
 let's say I want:

- length =8
- at least 1 uppercase
- at least 1 lowercase
- at least 1 number
- at least 1 char in a pre-defined set()

 I would also like to give the end-user information about why the password 
 did not pass the cut, like At least one uppercase is needed.

 How would this be done in web2py?


 Have a look at IS_STRONG. 



-- 





[web2py] Caution: 2.2.1 jquery ui tabs break menu dropdowns

2012-12-17 Thread Cliff Kachinske
Just a cautionary note for anyone planning to upgrade to 2.2.1

I don't have an answer for this.

-- 





[web2py] Re: How to a web2py environment along to subprocess?

2012-12-17 Thread Massimo Di Pierro
You cannot expose it. You can re-recreate it. 

from gluon.shell import 
env; globals().update(env('yourappname',import_modules=True))

On Monday, 17 December 2012 10:11:47 UTC-6, Ian W. Scott wrote:

 I'm running a file like this:

 python ~/web/web2py/web2py.py -S paideia -M -R 
 applications/paideia/bin/runtest.py

 Then I launch a subprocess from runtest.py like this:

 proc = subprocess.Popen(py.test {}.format(test_dir),
 stdout=subprocess.PIPE,
 stderr=subprocess.PIPE,
 shell=True)
 stdout_val, stderr_val = proc.communicate()

 is there any way to expose the web2py environment from runtest.py to the 
 new subprocess?



-- 





[web2py] Re: NEWINSTALL not working

2012-12-17 Thread Massimo Di Pierro
Thanks for reporting this. It was a major issue which deserved a new web2py 
release.

On Monday, 17 December 2012 11:06:42 UTC-6, Ron McOuat wrote:

 Tested with a clean install of trunk, fixed. Thanks

 On Monday, 17 December 2012 06:51:04 UTC-8, Massimo Di Pierro wrote:

 1225 was just fixed!

 On Monday, 17 December 2012 03:44:00 UTC-6, Andrew W wrote:

 Thanks



-- 





[web2py] Re: problem with update

2012-12-17 Thread cabildocl
apologies.
when doing tests to check the error makes that line. This is the code that 
shows me the error



El lunes, 17 de diciembre de 2012 12:08:57 UTC-3, Massimo Di Pierro 
escribió:

 That line is definitively not commented in the web2py source code for 
 2.3.1 and 2.3.2
 Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]


 On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the error 
 is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: 
 '-1 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: Passing an environment variable to wep2py

2012-12-17 Thread Massimo Di Pierro
This is the correct way to retrieve it:

os.environ.get(WEB2PY_USE_DB_TESTING,None):

I think that the problem is that 

os.environ[WEB2PY_USE_DB_TESTING]= 1

is not setting it. Not sure why. Perhaps it is setting it in the wrong 
shell.

Did you try:

export WEB2PY_USE_DB_TESTING=1

On Monday, 17 December 2012 11:33:22 UTC-6, Kostas M wrote:

 I am trying  to set up an environment variable (lets say 
 WEB2PY_USE_DB_TESTING), so that in my db.py:

 if not os.environ.get(WEB2PY_USE_DB_TESTING,None):
 db = DAL('sqlite://storage.sqlite')
 else:
 db = DAL('sqlite://../fts/testdb.sqlite')

 (as this resource points out:  
 http://ncdegroot.blogspot.ca/2011/09/web2py-automate-unittesting-doctesting.html
 )

 I want to set this variable by script, only when I run my functional tests.

 So I have tried up to now:


1. class FunctionalTest(unittest.TestCase):

@classmethod
def setUpClass(self):
os.environ[WEB2PY_USE_DB_TESTING]= 1
self.web2py = start_web2py_server()
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(5)
2. running web2py with --config=MYCONFIG, where MYCONFIG.py has:

 import os
 os.environ[WEB2PY_USE_DB_TESTING]= 1



 Both methods fail to transfer the environment variable to the shell that 
 web2py runs... Any suggestions?


-- 





[web2py] Re: problem with update

2012-12-17 Thread Massimo Di Pierro
Sorry I do not understand. Do you still have an error? What is the error?

On Monday, 17 December 2012 11:55:27 UTC-6, cabildocl wrote:

 apologies.
 when doing tests to check the error makes that line. This is the code that 
 shows me the error



 El lunes, 17 de diciembre de 2012 12:08:57 UTC-3, Massimo Di Pierro 
 escribió:

 That line is definitively not commented in the web2py source code for 
 2.3.1 and 2.3.2
 Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]


 On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the error 
 is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: 
 '-1 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: problem with update

2012-12-17 Thread cabildocl
the problem is that it throws me this error. 

Ticket ID 

10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
type 'exceptions.ValueError' invalid literal for int() with base 10: '-1 
day,'


This began to occur when  upgrade web2py. Now I tried again an older version 
but the error persists

El lunes, 17 de diciembre de 2012 14:59:54 UTC-3, Massimo Di Pierro 
escribió:

 Sorry I do not understand. Do you still have an error? What is the error?

 On Monday, 17 December 2012 11:55:27 UTC-6, cabildocl wrote:

 apologies.
 when doing tests to check the error makes that line. This is the code that 
 shows me the error



 El lunes, 17 de diciembre de 2012 12:08:57 UTC-3, Massimo Di Pierro 
 escribió:

 That line is definitively not commented in the web2py source code for 
 2.3.1 and 2.3.2
 Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]


 On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the 
 error is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: 
 '-1 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: Caution: 2.2.1 jquery ui tabs break menu dropdowns

2012-12-17 Thread LightDot
Did you make any updates to your app's existing static assets, such as 
jquery version, jquery-ui version, etc.? Or did you just use your entire 
old app with a clean 2.2.1 web2py?

Regards,
Ales


On Monday, December 17, 2012 6:46:40 PM UTC+1, Cliff Kachinske wrote:

 Just a cautionary note for anyone planning to upgrade to 2.2.1

 I don't have an answer for this.


-- 





[web2py] Re: Web2py scheduler timeout

2012-12-17 Thread Mike D
I'm not sure what narrow is by the period is 30 seconds. I'm seeing 
weirder behavior now. The task completes successfully but it quits being 
executed at a random time. The only way for me to fix it is to restart the 
scheduler process. I enabled the debug logging and here are the last two 
runs of my process that executed (sorry for the length, I don't wanna leave 
anything out though):
2012-12-16 21:39:24,315 - web2py.scheduler - INFO - TICKER: I'm a ticker 
(snapserver.local#63)
2012-12-16 21:39:27,035 - web2py.scheduler - DEBUG - looping...
2012-12-16 21:39:27,042 - web2py.scheduler - INFO - TICKER: workers are 1
2012-12-16 21:39:27,042 - web2py.scheduler - INFO - TICKER: tasks are 1
2012-12-16 21:39:27,042 - web2py.scheduler - DEBUG - sleeping...
2012-12-16 21:39:27,320 - web2py.scheduler - DEBUG - recording 
heartbeat
2012-12-16 21:39:30,043 - web2py.scheduler - DEBUG - looping...
2012-12-16 21:39:30,047 - web2py.scheduler - DEBUG -work to do 1
2012-12-16 21:39:30,047 - web2py.scheduler - DEBUG - new scheduler_run 
record
2012-12-16 21:39:30,049 - web2py.scheduler - INFO - new task 1 search for 
files ss_server/appadmin.searchForFiles
2012-12-16 21:39:30,049 - web2py.scheduler - DEBUG -  new task allocated: 
ss_server/appadmin.searchForFiles
2012-12-16 21:39:30,050 - web2py.scheduler - DEBUG -task starting
2012-12-16 21:39:30,054 - web2py.scheduler - DEBUG - task started
2012-12-16 21:39:30,089 - ss_server - DEBUG - Logger created
2012-12-16 21:39:30,090 - ss_server - INFO - searching for files
2012-12-16 21:39:30,090 - ss_server - INFO - creating watermark
2012-12-16 21:39:30,095 - ss_server - INFO - done creating watermark
2012-12-16 21:39:30,096 - ss_server - INFO - globbing files
2012-12-16 21:39:30,096 - ss_server - INFO - files globbed
2012-12-16 21:39:30,097 - ss_server - INFO - getting basename for 
/usr/local/ss_server/input/S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
2012-12-16 21:39:30,097 - ss_server - INFO - splitting filename
2012-12-16 21:39:30,097 - ss_server - INFO - checking filename
2012-12-16 21:39:30,098 - ss_server - INFO - processing file: 
S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
2012-12-16 21:39:30,098 - ss_server - INFO - adding watermark
2012-12-16 21:39:30,153 - ss_server - INFO - IO Error
2012-12-16 21:39:30,153 - ss_server - INFO - end of loop
2012-12-16 21:39:30,154 - ss_server - INFO - getting basename for 
/usr/local/ss_server/input/S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
2012-12-16 21:39:30,154 - ss_server - INFO - splitting filename
2012-12-16 21:39:30,155 - ss_server - INFO - checking filename
2012-12-16 21:39:30,155 - ss_server - INFO - processing file: 
S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
2012-12-16 21:39:30,156 - ss_server - INFO - adding watermark
2012-12-16 21:39:30,196 - ss_server - INFO - IO Error
2012-12-16 21:39:30,197 - ss_server - INFO - end of loop
2012-12-16 21:39:30,197 - ss_server - INFO - getting basename for 
/usr/local/ss_server/input/S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
2012-12-16 21:39:30,197 - ss_server - INFO - splitting filename
2012-12-16 21:39:30,198 - ss_server - INFO - checking filename
2012-12-16 21:39:30,198 - ss_server - INFO - processing file: 
S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
2012-12-16 21:39:30,217 - ss_server - INFO - IO Error
2012-12-16 21:39:30,218 - ss_server - INFO - end of loop
2012-12-16 21:39:30,218 - ss_server - INFO - getting basename for 
/usr/local/ss_server/input/S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
2012-12-16 21:39:30,218 - ss_server - INFO - splitting filename
2012-12-16 21:39:30,219 - ss_server - INFO - checking filename
2012-12-16 21:39:30,219 - ss_server - INFO - processing file: 
S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
2012-12-16 21:39:30,221 - ss_server - INFO - adding watermark
2012-12-16 21:39:30,274 - ss_server - INFO - IO Error
2012-12-16 21:39:30,274 - ss_server - INFO - end of loop
2012-12-16 21:39:30,275 - ss_server - INFO - ending function
2012-12-16 21:39:30,277 - web2py.scheduler - DEBUG - new task report: 
COMPLETED
2012-12-16 21:39:30,277 - web2py.scheduler - DEBUG -result: success
2012-12-16 21:39:30,326 - web2py.scheduler - DEBUG - recording 
heartbeat
2012-12-16 21:39:30,327 - web2py.scheduler - DEBUG -  partial output: 
serach for files
/usr/local/ss_server/web2py_ss_server
processing file: 
S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
IO Error
processing file: 
S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
IO Error
processing file: 
S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
IO Error
processing file: 
S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
IO Error

2012-12-16 21:39:30,327 - web2py.scheduler - DEBUG 

[web2py] Re: problem with update

2012-12-17 Thread Massimo Di Pierro
Please I need the complete traceback. I think you have a datetime field 
which you later converted in date or time format. The data is still 
datetime and therefore you cannot take it out.

On Monday, 17 December 2012 12:17:44 UTC-6, cabildocl wrote:

 the problem is that it throws me this error. 

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: '-1 
 day,'


 This began to occur when  upgrade web2py. Now I tried again an older 
 version but the error persists

 El lunes, 17 de diciembre de 2012 14:59:54 UTC-3, Massimo Di Pierro 
 escribió:

 Sorry I do not understand. Do you still have an error? What is the error?

 On Monday, 17 December 2012 11:55:27 UTC-6, cabildocl wrote:

 apologies.
 when doing tests to check the error makes that line. This is the code that 
 shows me the error



 El lunes, 17 de diciembre de 2012 12:08:57 UTC-3, Massimo Di Pierro 
 escribió:

 That line is definitively not commented in the web2py source code for 
 2.3.1 and 2.3.2
 Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]


 On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the 
 error is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: 
 '-1 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: web2py book now free in PDF

2012-12-17 Thread Unyo
much thanks 3 you've definitely developed one of the best web frameworks 
i've used so far

On Tuesday, June 12, 2012 3:17:46 AM UTC-10, Massimo Di Pierro wrote:

 The official web2py book is now free for everybody:

 https://dl.dropbox.com/u/18065445/web2py/web2py_manual_4th.1.pdf

 Massimo


-- 





[web2py] Re: Can web2py run outside of public root?

2012-12-17 Thread Massimo Di Pierro
Yes. It does not matter where you put, as longs the user running the we 
server (www-data?) and read/write permissions.

On Monday, 17 December 2012 12:39:50 UTC-6, rh wrote:

 Is it possible to run web2py outside of the web root? 

 For example: 

 On disk the there is: 

 public web root = /var/www/example.com/html 

 private home dir = /subscribers/e/x/example.com 

 Can web2py live in /subscribers/e/x/example.com/w2py but be called from 
 /var/www/example.com/html/subdom/dispatch.fcgi ? 

 i.e. Can I propagate the path to web2py throughout the web2py instance 
 called by dispatch.fcgi? 



-- 





[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread HittingSmoke
Bah, I actually asked a Webfaction staff member if this were possible and I 
was told no, that the frontend Nginx server could only be used on 
static/PHP sites.

Now that I'm looking into it I'm seeing one major issue that without proper 
configuration of Nginx for web2py, it would be serving static files through 
uwsgi instead of directly though Nginx. That requires a special entry in 
nginx.conf. Would that not mean reduced performance and higher RAM usage 
from uwsgi?

On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:

 I'm also not a sysadmin, but I did go through the process of setting up 
 web2py on webfaction recently as well. I also found that script but it 
 seemed to be overly complicated. In particular, there is no need to 
 download, build  run nginx, as you can use webfaction's instance. If there 
 is an advantage to running your own I'd be curious to hear about it. 
 Simplified steps I followed:

 1. download  build latest uwsgi
 2. download  unpack latest web2py
 3. set up a custom app using webfaction's control panel, taking note of 
 the port
 4. run the uwsgi binary, specifying parameters in the command line. For 
 the socket parameter use 127.0.0.1 and the port webfaction assigned for 
 your custom app. There are a few other posts in this group about selecting 
 good uwsgi parameters so that you don't run out of memory (seems to be a 
 common pitfall on webfaction)

 Hope that's useful.

 Neil


 On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:

 I've been learning web2py on Webfaction off and on for a while now. The 
 web2py install script on the Webfaction wiki is quite outdated and runs on 
 an Apache instance that can barely stay within the default memory limits 
 without serious tweaking. Responsiveness with web2py/apache out of the box 
 with the default install script is unimpressive as well.

 A while back I tried a lighttpd setup with web2py on Webfaction. The 
 memory usage went way down and responsiveness was better but the web server 
 was quite unstable. I found myself having to restart it constantly and I 
 couldn't track down the cause of the breakages. After the host upped the 
 default RAM limit on CentOS6 systems to 256MB things got better as it made 
 Apache more manageable on custom installs but it still sucked overall.

 So I found an install script for nginx/uWSGI on the WF community support 
 forumhttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgibut
  it was horribly outdated and had multiple issues pointed out in the 
 comments that went unfixed. I spent a couple hours today fixing the ignored 
 errors, updating it to the latest nginx and uwsgi versions and fixing the 
 errors which that brought on. After getting it working my RAM usage has 
 decreased and responsiveness of my web2py apps has noticeably increased. I 
 figured I'd share the script for anyone interested.

 I'm not a sysadmin, more of a hobbyist so any critique of my server 
 configs here are greatly welcome. Please note that the comments are not 
 mine. I merely updated the parts of the script that were required for it to 
 work. All else was left as-is.

 Also, if anyone with knowledge of XML-RPC want's to make an actual 
 Webfaction install 
 scripthttps://docs.webfaction.com/xmlrpc-api/tutorial.html for 
 nginx/uwsgi/web2py that would be awesome. It could be added to the script 
 wiki.

 #!/bin/sh


 # TODO's:
 # * find free port for communication for nginx and uwsgi
 # * test conjob creation properly


 echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py (latest 
 stable)'
 echo 'If you wish to create cronjobs comment out the last lines of this 
 script'


 # port betweet nginx and uwsgi
 nginx_uwsgi_port=9001


 # Get web2py admin password
 echo Web2py admin password:
 read  web2py_password


 # Get webfaction application name
 echo Webfaction application name:
 read  webfaction_app_name


 # Get webfaction port number
 echo Webfaction application port:
 read  webfaction_app_port


 # port betweet nginx and uwsgi
 echo Port number for communication between nginx and uswgi (eg. 9001):
 read nginx_uwsgi_port


 ### 
 ### web2py
 ###
 cd ~/webapps/${webfaction_app_name}
 wget http://www.web2py.com/examples/static/web2py_src.zip
 unzip web2py_src.zip
 rm web2py_src.zip
 cd web2py
 python -c from gluon.main import save_password; 
 save_password('${web2py_password}',${webfaction_app_port})
 cd ..


 ###
 ### nginx
 ###
 mkdir downs
 cd downs


 # download and install nginx in the appname directory
 wget http://nginx.org/download/nginx-1.2.6.tar.gz
 tar xvf nginx-1.2.6.tar.gz
 cd nginx-1.2.6


 ./configure \
   --prefix=/home/${USER}/webapps/${webfaction_app_name}/nginx \
   --sbin-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/sbin/nginx 
 \
   --conf-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/nginx.conf 
 \
   --error-log-path=/home/${USER}/webapps/${webfaction_app_name}/nginx/log
 /error.log \
   

[web2py] Re: web2py book now free in PDF

2012-12-17 Thread Massimo Di Pierro
Make sure you tell others. The more the merrier. ;-)

Massimo

On Monday, 17 December 2012 13:16:12 UTC-6, Unyo wrote:

 much thanks 3 you've definitely developed one of the best web frameworks 
 i've used so far

 On Tuesday, June 12, 2012 3:17:46 AM UTC-10, Massimo Di Pierro wrote:

 The official web2py book is now free for everybody:

 https://dl.dropbox.com/u/18065445/web2py/web2py_manual_4th.1.pdf

 Massimo



-- 





[web2py] Re: fail to use web2py in IPython Notebook

2012-12-17 Thread wwwgong
Massimo,
Thanks for your quick reply. For most part, web2py worked with IPython 
Notebook like DAL, which is pretty good.
My interest is to to reuse web2py for managing notebooks without developing 
Tornado apps myself as I am new to python and web2py.

W.

On Sunday, December 16, 2012 10:13:16 PM UTC-5, Massimo Di Pierro wrote:

 Unfortunately I am not sure you can run web2py with Ipython notebook. The 
 reason is that the notebook is a web interface and the statements are 
 executed server side. The notebook server may execute the statements in 
 different threads (I am not sure but from the tracebacks that is what it 
 looks like). The web2py modules assume no data is shared among threads 
 since one tread serves one request at the time.

 I would need to understand better the notebook concurrency model before 
 this can be addressed.

 Massimo



 On Sunday, 16 December 2012 18:35:06 UTC-6, wwwgong wrote:

 I have watched video at https://vimeo.com/21185623 and try to use web2py 
 inside IPython Notebook, but run into 
 the following error:

 form = SQLFORM(db.ipynotebooks)

 ---AttributeError
 Traceback (most recent call 
 last)ipython-input-36-c6b1cb76b770 in module() 1 form = 
 SQLFORM(db.ipynotebooks)
 D:\web2py_git\gluon\sqlhtml.pyc in __init__(self, table, record, deletable, 
 linkto, upload, fields, labels, col3, submit_button, delete_label, showid, 
 readonly, comments, keepopts, ignore_rw, record_id, formstyle, buttons, 
 separator, **attributes)911linkto=URL(f='table/db/')
 912 -- 913 T = current.T914 915 
 self.ignore_rw = ignore_rw
 AttributeError: 'thread._local' object has no attribute 'T'


 I have created a gist at http://nbviewer.ipython.org/4314583/

 Thanks,
 W



-- 





Re: [web2py] raspberry pi

2012-12-17 Thread wwwgong
Now I see it in the source release. Thanks,


On Sunday, December 16, 2012 10:02:53 PM UTC-5, Massimo Di Pierro wrote:

 anyserver.py ships with web2py in the main folder. Run it with -h for 
 info. ;-)

 On Sunday, 16 December 2012 16:57:12 UTC-6, wwwgong wrote:

 Hi Massimo,
 The ease of running web2py/python/RaspberryPi out of box speaks loudly 
 about the quality and lightweightness of the whole stack.
 I watched your talk web2py: Web Development Should be 
 Easyhttps://www.youtube.com/watch?v=iMUX9NdN8YE today 
 and agree that
 the key to attract young programmer is to make it as easy as playing a 
 game.
 Does one need to teach kids how to play game?

 On a seperate subject, I watched your video on 
 web2py plays with tornado, cherrypy, paste, mako, and the regular Python 
 shell https://vimeo.com/21185623?
 can you share anyserver.py script? I don't quite understand how to make 
 web2py and tornado runs together.
 I am interested in running IPython Notebook together with web2py.

 Thanks,
 W



 On Saturday, December 15, 2012 9:24:40 AM UTC-5, Massimo Di Pierro wrote:

 This is good to know. I should get one.

 On Friday, 14 December 2012 20:44:48 UTC-6, wwwgong wrote:

 yes, I bought a 512MB Raspberry Pi for $35 as a gift to my kid 2 weeks 
 ago.

 In less than 5 mins, I am able to run web2py (v2.3.1) on this tiny and 
 cheap platform.
 installed 2 of my apps, they run a bit slow, but smoothly without error.

 Web2py + Python + RaspberryPi is a cool toy.

 I am going to show it off to my 6 grade class.

 Cheers,

 W

 On Friday, August 10, 2012 3:28:57 PM UTC-4, aapaap wrote:

 I just did it, within 5  minutes. 
 Python is already installed on the Raspberry-pi. 

 - download the sources to the Raspberry 
 - unpack the zip file 
 - open a terminal window and go to the directory where it is unpacked 
 - python web2py.py 

 that's all. 

 cheers, 
 Stef 

 On 13-03-2012 11:04, Ant�nio Ramos wrote: 
  it would be nice to be able to install web2py in raspberry pi 
  
  http://www.raspberrypi.org/ 



-- 





[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread Neil
What I've done for that is set up another webfaction application of type 
static to server all the css, images, audio, videos, etc. That creates a 
new folder, for example:

/home/[USER]/webapps/static_web2py_myapp

Then, in my web2py/applications/[my_app]/ folder, I put a symbolic link 
called static to the above folder. Seems to do the trick.

On Monday, December 17, 2012 7:17:35 PM UTC, HittingSmoke wrote:

 Bah, I actually asked a Webfaction staff member if this were possible and 
 I was told no, that the frontend Nginx server could only be used on 
 static/PHP sites.

 Now that I'm looking into it I'm seeing one major issue that without 
 proper configuration of Nginx for web2py, it would be serving static files 
 through uwsgi instead of directly though Nginx. That requires a special 
 entry in nginx.conf. Would that not mean reduced performance and higher RAM 
 usage from uwsgi?

 On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:

 I'm also not a sysadmin, but I did go through the process of setting up 
 web2py on webfaction recently as well. I also found that script but it 
 seemed to be overly complicated. In particular, there is no need to 
 download, build  run nginx, as you can use webfaction's instance. If there 
 is an advantage to running your own I'd be curious to hear about it. 
 Simplified steps I followed:

 1. download  build latest uwsgi
 2. download  unpack latest web2py
 3. set up a custom app using webfaction's control panel, taking note of 
 the port
 4. run the uwsgi binary, specifying parameters in the command line. For 
 the socket parameter use 127.0.0.1 and the port webfaction assigned for 
 your custom app. There are a few other posts in this group about selecting 
 good uwsgi parameters so that you don't run out of memory (seems to be a 
 common pitfall on webfaction)

 Hope that's useful.

 Neil


 On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:

 I've been learning web2py on Webfaction off and on for a while now. The 
 web2py install script on the Webfaction wiki is quite outdated and runs on 
 an Apache instance that can barely stay within the default memory limits 
 without serious tweaking. Responsiveness with web2py/apache out of the box 
 with the default install script is unimpressive as well.

 A while back I tried a lighttpd setup with web2py on Webfaction. The 
 memory usage went way down and responsiveness was better but the web server 
 was quite unstable. I found myself having to restart it constantly and I 
 couldn't track down the cause of the breakages. After the host upped the 
 default RAM limit on CentOS6 systems to 256MB things got better as it made 
 Apache more manageable on custom installs but it still sucked overall.

 So I found an install script for nginx/uWSGI on the WF community 
 support 
 forumhttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgibut
  it was horribly outdated and had multiple issues pointed out in the 
 comments that went unfixed. I spent a couple hours today fixing the ignored 
 errors, updating it to the latest nginx and uwsgi versions and fixing the 
 errors which that brought on. After getting it working my RAM usage has 
 decreased and responsiveness of my web2py apps has noticeably increased. I 
 figured I'd share the script for anyone interested.

 I'm not a sysadmin, more of a hobbyist so any critique of my server 
 configs here are greatly welcome. Please note that the comments are not 
 mine. I merely updated the parts of the script that were required for it to 
 work. All else was left as-is.

 Also, if anyone with knowledge of XML-RPC want's to make an actual 
 Webfaction install 
 scripthttps://docs.webfaction.com/xmlrpc-api/tutorial.html for 
 nginx/uwsgi/web2py that would be awesome. It could be added to the script 
 wiki.

 #!/bin/sh


 # TODO's:
 # * find free port for communication for nginx and uwsgi
 # * test conjob creation properly


 echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py 
 (latest stable)'
 echo 'If you wish to create cronjobs comment out the last lines of this 
 script'


 # port betweet nginx and uwsgi
 nginx_uwsgi_port=9001


 # Get web2py admin password
 echo Web2py admin password:
 read  web2py_password


 # Get webfaction application name
 echo Webfaction application name:
 read  webfaction_app_name


 # Get webfaction port number
 echo Webfaction application port:
 read  webfaction_app_port


 # port betweet nginx and uwsgi
 echo Port number for communication between nginx and uswgi (eg. 9001):
 read nginx_uwsgi_port


 ### 
 ### web2py
 ###
 cd ~/webapps/${webfaction_app_name}
 wget http://www.web2py.com/examples/static/web2py_src.zip
 unzip web2py_src.zip
 rm web2py_src.zip
 cd web2py
 python -c from gluon.main import save_password; 
 save_password('${web2py_password}',${webfaction_app_port})
 cd ..


 ###
 ### nginx
 ###
 mkdir downs
 cd downs


 # download and install nginx in the appname directory
 wget 

[web2py] Re: Caution: 2.2.1 jquery ui tabs break menu dropdowns

2012-12-17 Thread Cliff Kachinske
I'm getting the jquery stuff from ajax.googleapis.com.  Don't know if it's 
the latest.

I updated all the js, css, and image files.

On Monday, December 17, 2012 1:44:03 PM UTC-5, LightDot wrote:

 Did you make any updates to your app's existing static assets, such as 
 jquery version, jquery-ui version, etc.? Or did you just use your entire 
 old app with a clean 2.2.1 web2py?

 Regards,
 Ales


 On Monday, December 17, 2012 6:46:40 PM UTC+1, Cliff Kachinske wrote:

 Just a cautionary note for anyone planning to upgrade to 2.2.1

 I don't have an answer for this.



-- 





[web2py] Re: Script for nginx/uWSGI/web2py install on Webfaction

2012-12-17 Thread HittingSmoke
Hmm, interesting. I'll give it a try and compare RAM usage/performance 
after I've had more time to record data tinkering with the custom Nginx 
install.

On Monday, December 17, 2012 11:34:51 AM UTC-8, Neil wrote:

 What I've done for that is set up another webfaction application of type 
 static to server all the css, images, audio, videos, etc. That creates a 
 new folder, for example:

 /home/[USER]/webapps/static_web2py_myapp

 Then, in my web2py/applications/[my_app]/ folder, I put a symbolic link 
 called static to the above folder. Seems to do the trick.

 On Monday, December 17, 2012 7:17:35 PM UTC, HittingSmoke wrote:

 Bah, I actually asked a Webfaction staff member if this were possible and 
 I was told no, that the frontend Nginx server could only be used on 
 static/PHP sites.

 Now that I'm looking into it I'm seeing one major issue that without 
 proper configuration of Nginx for web2py, it would be serving static files 
 through uwsgi instead of directly though Nginx. That requires a special 
 entry in nginx.conf. Would that not mean reduced performance and higher RAM 
 usage from uwsgi?

 On Monday, December 17, 2012 4:32:21 AM UTC-8, Neil wrote:

 I'm also not a sysadmin, but I did go through the process of setting up 
 web2py on webfaction recently as well. I also found that script but it 
 seemed to be overly complicated. In particular, there is no need to 
 download, build  run nginx, as you can use webfaction's instance. If there 
 is an advantage to running your own I'd be curious to hear about it. 
 Simplified steps I followed:

 1. download  build latest uwsgi
 2. download  unpack latest web2py
 3. set up a custom app using webfaction's control panel, taking note 
 of the port
 4. run the uwsgi binary, specifying parameters in the command line. For 
 the socket parameter use 127.0.0.1 and the port webfaction assigned for 
 your custom app. There are a few other posts in this group about selecting 
 good uwsgi parameters so that you don't run out of memory (seems to be a 
 common pitfall on webfaction)

 Hope that's useful.

 Neil


 On Monday, December 17, 2012 6:53:31 AM UTC, HittingSmoke wrote:

 I've been learning web2py on Webfaction off and on for a while now. The 
 web2py install script on the Webfaction wiki is quite outdated and runs on 
 an Apache instance that can barely stay within the default memory limits 
 without serious tweaking. Responsiveness with web2py/apache out of the box 
 with the default install script is unimpressive as well.

 A while back I tried a lighttpd setup with web2py on Webfaction. The 
 memory usage went way down and responsiveness was better but the web 
 server 
 was quite unstable. I found myself having to restart it constantly and I 
 couldn't track down the cause of the breakages. After the host upped the 
 default RAM limit on CentOS6 systems to 256MB things got better as it made 
 Apache more manageable on custom installs but it still sucked overall.

 So I found an install script for nginx/uWSGI on the WF community 
 support 
 forumhttp://community.webfaction.com/questions/7193/install-web2py-with-nginx-and-uwsgibut
  it was horribly outdated and had multiple issues pointed out in the 
 comments that went unfixed. I spent a couple hours today fixing the 
 ignored 
 errors, updating it to the latest nginx and uwsgi versions and fixing the 
 errors which that brought on. After getting it working my RAM usage has 
 decreased and responsiveness of my web2py apps has noticeably increased. I 
 figured I'd share the script for anyone interested.

 I'm not a sysadmin, more of a hobbyist so any critique of my server 
 configs here are greatly welcome. Please note that the comments are not 
 mine. I merely updated the parts of the script that were required for it 
 to 
 work. All else was left as-is.

 Also, if anyone with knowledge of XML-RPC want's to make an actual 
 Webfaction install 
 scripthttps://docs.webfaction.com/xmlrpc-api/tutorial.html for 
 nginx/uwsgi/web2py that would be awesome. It could be added to the script 
 wiki.

 #!/bin/sh


 # TODO's:
 # * find free port for communication for nginx and uwsgi
 # * test conjob creation properly


 echo 'Install script for nginx (1.2.6), uwsgi (1.4.3) and web2py 
 (latest stable)'
 echo 'If you wish to create cronjobs comment out the last lines of 
 this script'


 # port betweet nginx and uwsgi
 nginx_uwsgi_port=9001


 # Get web2py admin password
 echo Web2py admin password:
 read  web2py_password


 # Get webfaction application name
 echo Webfaction application name:
 read  webfaction_app_name


 # Get webfaction port number
 echo Webfaction application port:
 read  webfaction_app_port


 # port betweet nginx and uwsgi
 echo Port number for communication between nginx and uswgi (eg. 
 9001):
 read nginx_uwsgi_port


 ### 
 ### web2py
 ###
 cd ~/webapps/${webfaction_app_name}
 wget http://www.web2py.com/examples/static/web2py_src.zip
 unzip web2py_src.zip
 rm web2py_src.zip
 cd web2py
 

Re: [web2py] 'Row' object has no attribute powerTable

2012-12-17 Thread FERNANDO VILLARROEL
Dear.
Why when i run:
def test():    
return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)
Works fine.
But when i use powerTable occur the error:
reg=db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha) 
        powerTable = plugins.powerTable         powerTable.datasource = reg     
    powerTable.dtfeatures['sScrollY'] = '100%'         
powerTable.dtfeatures['sScrollX'] = '100%'         
powerTable.dtfeatures['bPaginate'] =  True         
powerTable.dtfeatures['bAutoWidth'] = True          powerTable._width='1020'    
     powerTable.dtfeatures['bSort'] = False #Se muestra ordenado por Query      
   
#powerTable.extra=dict(editable={'editablecallback':URL('llamadas','editablefunction')})  
        powerTable.dtfeatures['iDisplayLength'] = 50          
powerTable.virtualfields = None          powerTable.headers='labels'         
powerTable.showkeycolumn = False         powerTable.dtfeatures['bJQueryUI'] = 
request.vars.get('jqueryui',True)       
  powerTable.uitheme = 
'redmond'#request.vars.get('theme','cupertino')#'smoothness' / 'redmond'        
 powerTable.dtfeatures['sPaginationType'] = 
'full_numbers'#request.vars.get('pager','full_numbers') # two_button scrolling  
       powerTable.columns =  
['pagos.id','pagos.fecha','pagos.monto','pagos.comments']         
#powerTable.extra = dict(autoresize={})         powerTable.keycolumn = 
'pagos.id'         powerTable.hiddecolumns=['pagos.id']         
table=powerTable.create()         return dict(table=table) 

type 'exceptions.AttributeError' 'Row' object has no attribute 'pagos'
Any idea what is wrong?

--- On Mon, 12/17/12, FERNANDO VILLARROEL fvillarr...@yahoo.com wrote:

From: FERNANDO VILLARROEL fvillarr...@yahoo.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 11:02 AM

Dear Bruno.
Yes works fine without powerTable
The problem occur when i use powerTable.
Regards

--- On Mon, 12/17/12, Bruno Rocha rochacbr...@gmail.com wrote:

From: Bruno Rocha rochacbr...@gmail.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 1:04 AM

what happens if you just return the Rows without using powerTable, it works?
def test():    
return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)



-- 

 

 

 





-- 

 

 

 

-- 





[web2py] Re: webgrid and row_created

2012-12-17 Thread Kenneth
Hi,

anybody have any ideas?

tablerow.components.insert(2, TD(IMG(_src=URL('static', 
'delete-article.png'), _onclick=confirmation(rowdata.asset_id), 
_width=15)))

Kenneth


Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth:

 Hello,

 I'm using webgrid in an application and I'm trying to insert an delete 
 image into the table to shows all rows in an table. When clicking on the 
 delete image I want an onclick event to trigger a Javascript that confirms 
 and deletes that row. To do that I need the rownumber. 

 Looks like this:
 def controller that uses webgrid():
 grid.row_created = add_add_serial_link

 def add_add_serial_link(tablerow,rowtype,rowdata):
 if rowtype == 'datarow':

 tablerow.components.insert(2, TD(IMG(_src=URL('static', 
 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), 
 _width=15)))

 How do I write that _onclick so that the asset_id is sent to the 
 confirmation Javascript? If I write 
 _onclick='confirmation(rowdata.asset_id)' Javascript gets the text 
 rowdata.asset_id and not the ID I'm tryin to send to it.


 Kenneth





-- 





[web2py] Re: Caution: 2.2.1 jquery ui tabs break menu dropdowns

2012-12-17 Thread LightDot
Who's going to know if it's the newest if not you?? :) How are you calling 
the jquery stuff, you could post at least that... The cause of your 
troubles might be as simple as incompatible jquery and jquery-ui versions, 
but you're not telling us enough information to troubleshoot. For example, 
you might be calling a very old jquery-ui from google and including the 
newest jquery in web2py.

Anyway, if you updated all js, css and image files within your app, there's 
really no way of knowing what you broke. You'll need to either go over your 
app's code and make adjustments to newer (or even completely different) css 
and js libraries or go back to using old ones.

This isn't a web2py issue per se... If you had used your existing app as it 
was, there would be no errors with the newer web2py.

Regards,
Ales


On Monday, December 17, 2012 8:35:50 PM UTC+1, Cliff Kachinske wrote:

 I'm getting the jquery stuff from ajax.googleapis.com.  Don't know if 
 it's the latest.

 I updated all the js, css, and image files.

 On Monday, December 17, 2012 1:44:03 PM UTC-5, LightDot wrote:

 Did you make any updates to your app's existing static assets, such as 
 jquery version, jquery-ui version, etc.? Or did you just use your entire 
 old app with a clean 2.2.1 web2py?

 Regards,
 Ales


 On Monday, December 17, 2012 6:46:40 PM UTC+1, Cliff Kachinske wrote:

 Just a cautionary note for anyone planning to upgrade to 2.2.1

 I don't have an answer for this.



-- 





[web2py] Re: Using contrib.webclient to test JSONRPC interfaces

2012-12-17 Thread Daniel Gonzalez
I have slightly modified the WebClient to support jsonrpc. I am not sure 
everything is correctly covered, but it is suiting my needs.

In case you are interested, you can see the changes here:

https://github.com/gonvaled/web2py/tree/webclient_add_jsonrpc

The biggest problem I had was 
that opener.addheaders.append((key,str(value))) is not working as (I) 
expected: the content-type is not rewritten:
http://stackoverflow.com/questions/13920211/not-possible-to-set-content-type-to-application-json-using-urllib2

On Monday, December 17, 2012 6:38:30 PM UTC+1, Daniel Gonzalez wrote:

 Hi,

 I am trying to understand how to use the included WebClient to test a 
 JSONRPC interface. One showstopper for me at the moment is that I see the 
 following in WebClient.post:

 # time the POST request
 data = urllib.urlencode(data)
 t0 = time.time()
 self.response = opener.open(self.url,data)
 self.time = time.time()-t0

 When doing JSONRPC accesses I do not want the data to be urlencoded. 
 Actually, I will prepare the data with json.dump, and I want WebClient to 
 POST it transparently (I guess this goes in the body of the POST request). 
 Is this at all possible? Is there an example of WebClient usage 
 for JSONRPC interfaces somewhere?

 Thanks,
 Daniel Gonzalez


-- 





[web2py] editable=lambda row: check(row), : make user's row editable, and the rest read only

2012-12-17 Thread Adi
Is it possible to display all rows in grid, but make editable only a row 
that belongs to a particular user? Tried searching if someone else did it, 
but couldn't find any reference... 

Tried following code, without success: 

def check(row): return (row.created_by == 1) #auth.user_id

def suppliers():
   grid=SQLFORM.grid(q, ...
editable=lambda row: check(row),
# or, a second solution: 
# editable=lambda row: row.created_by==auth.user_id,


A filter will do it, but all other rows will not be displayed, which is not 
what I want:
db.supplier._common_filter = lambda query: 
(db.supplier.created_by   auth.user_id)


Thanks,
Adnan

-- 





[web2py] Re: Web2py scheduler timeout

2012-12-17 Thread Niphlod
you could attach the log to the message, so the thread doesn't get long:P
 I see 2 rounds only COMPLETED, then a huge gap
 

 2012-12-16 21:39:30,330 - web2py.scheduler - INFO - task completed 
 (COMPLETED)
 2012-12-16 23:12:23,296 - web2py.scheduler - DEBUG - new scheduler_run 
 record
 2012-12-16 23:12:23,298 - web2py.scheduler - INFO - new task 1 search for 
 files ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,298 - web2py.scheduler - DEBUG -  new task allocated: 
 ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,299 - web2py.scheduler - DEBUG -task starting
 2012-12-16 23:12:23,303 - web2py.scheduler - DEBUG - task started
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG - new task report: 
 COMPLETED
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG -result: success
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -  partial output: 
 serach for files
 /usr/local/ss_server/web2py_ss_server
 processing file: 
 S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
 IO Error
 processing file: 
 S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
 IO Error
 processing file: 
 S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
 IO Error
 processing file: 
 S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
 IO Error
 
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -   task completed or 
 failed
 2012-12-16 23:12:23,574 - web2py.scheduler - DEBUG -  recording task 
 report in db (COMPLETED)
 2012-12-16 23:12:23,580 - web2py.scheduler - INFO - task completed 
 (COMPLETED)

HUGE GAP here 

 2012-12-17 03:13:26,360 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:46,026 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:49,068 - web2py.scheduler - DEBUG - recording 
 heartbeat

 then practically nothing. Can you tell me how the task in the 
scheduler_task table is at this time ? 


 

-- 





[web2py] Re: webgrid and row_created

2012-12-17 Thread Adi

this is how i use onclick for confirmation purpose in a grid:

lambda row: A('Copy',
_class='btn',
_onclick='return confirm(Duplicate %s?)' % row.po_number, 
_href=URL('duplicate_po',args=[row.id])),







On Monday, December 17, 2012 2:46:59 PM UTC-5, Kenneth wrote:

 Hi,

 anybody have any ideas?

 tablerow.components.insert(2, TD(IMG(_src=URL('static', 
 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), 
 _width=15)))

 Kenneth


 Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth:

 Hello,

 I'm using webgrid in an application and I'm trying to insert an delete 
 image into the table to shows all rows in an table. When clicking on the 
 delete image I want an onclick event to trigger a Javascript that confirms 
 and deletes that row. To do that I need the rownumber. 

 Looks like this:
 def controller that uses webgrid():
 grid.row_created = add_add_serial_link

 def add_add_serial_link(tablerow,rowtype,rowdata):
 if rowtype == 'datarow':

 tablerow.components.insert(2, TD(IMG(_src=URL('static', 
 'delete-article.png'), _onclick=confirmation(rowdata.asset_id), 
 _width=15)))

 How do I write that _onclick so that the asset_id is sent to the 
 confirmation Javascript? If I write 
 _onclick='confirmation(rowdata.asset_id)' Javascript gets the text 
 rowdata.asset_id and not the ID I'm tryin to send to it.


 Kenneth





-- 





[web2py] Re: Web2py scheduler timeout

2012-12-17 Thread Mike D
Sorry about that. I just tried to attach the log and it keeps giving me an 
error. The scheduler_task record is marked QUEUED and the last 
scheduler_run record is marked COMPLETED. The task just isn't being run for 
some reason.

On Monday, December 17, 2012 12:29:34 PM UTC-8, Niphlod wrote:

 you could attach the log to the message, so the thread doesn't get long:P
  I see 2 rounds only COMPLETED, then a huge gap
  

 2012-12-16 21:39:30,330 - web2py.scheduler - INFO - task completed 
 (COMPLETED)
 2012-12-16 23:12:23,296 - web2py.scheduler - DEBUG - new 
 scheduler_run record
 2012-12-16 23:12:23,298 - web2py.scheduler - INFO - new task 1 search 
 for files ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,298 - web2py.scheduler - DEBUG -  new task allocated: 
 ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,299 - web2py.scheduler - DEBUG -task starting
 2012-12-16 23:12:23,303 - web2py.scheduler - DEBUG - task started
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG - new task report: 
 COMPLETED
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG -result: success
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -  partial output: 
 serach for files
 /usr/local/ss_server/web2py_ss_server
 processing file: 
 S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
 IO Error
 processing file: 
 S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
 IO Error
 processing file: 
 S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
 IO Error
 processing file: 
 S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
 IO Error
 
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -   task completed or 
 failed
 2012-12-16 23:12:23,574 - web2py.scheduler - DEBUG -  recording task 
 report in db (COMPLETED)
 2012-12-16 23:12:23,580 - web2py.scheduler - INFO - task completed 
 (COMPLETED)

 HUGE GAP here 

 2012-12-17 03:13:26,360 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:46,026 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:49,068 - web2py.scheduler - DEBUG - recording 
 heartbeat

 then practically nothing. Can you tell me how the task in the 
 scheduler_task table is at this time ? 


  


-- 





[web2py] Re: problem with update

2012-12-17 Thread cabildocl
was an error with a registry. thanks

El lunes, 17 de diciembre de 2012 16:16:00 UTC-3, Massimo Di Pierro 
escribió:

 Please I need the complete traceback. I think you have a datetime field 
 which you later converted in date or time format. The data is still 
 datetime and therefore you cannot take it out.

 On Monday, 17 December 2012 12:17:44 UTC-6, cabildocl wrote:

 the problem is that it throws me this error. 

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 10: 
 '-1 day,'


 This began to occur when  upgrade web2py. Now I tried again an older 
 version but the error persists

 El lunes, 17 de diciembre de 2012 14:59:54 UTC-3, Massimo Di Pierro 
 escribió:

 Sorry I do not understand. Do you still have an error? What is the error?

 On Monday, 17 December 2012 11:55:27 UTC-6, cabildocl wrote:

 apologies.
 when doing tests to check the error makes that line. This is the code that 
 shows me the error



 El lunes, 17 de diciembre de 2012 12:08:57 UTC-3, Massimo Di Pierro 
 escribió:

 That line is definitively not commented in the web2py source code for 
 2.3.1 and 2.3.2
 Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]


 On Monday, 17 December 2012 08:48:34 UTC-6, cabildocl wrote:

 hi, i have a problem from to update web2py  to latest version, the 
 error is the next:

 Ticket ID 

 10.0.0.28.2012-12-17.11-32-22.3cb0b23c-4656-47da-8acd-5a44016ed107
 type 'exceptions.ValueError' invalid literal for int() with base 
 10: '-1 day,'

 Function argument list 

 (self=gluon.dal.MySQLAdapter object at 0x8e030ac, 
 value=datetime.timedelta(-1, 41400), field_type='time')
  Code listing 

 1837.
 1838.
 1839.
 1840.
 1841.
 1842.

 1843.
 1844.
 1845.
 1846.

 value = datetime.date(y, m, d)
 return value

 def parse_time(self, value, field_type):
 if not isinstance(value, datetime.time):
 #time_items = map(int,str(value)[:8].strip().split(':')[:3])

 if len(time_items) == 3:
 (h, mi, s) = time_items
 else:
 (h, mi, s) = time_items + [0]

  Variables builtinlen built-in function len  time_items undefined

 this worked ok, your help please






-- 





[web2py] Re: Web2py scheduler timeout

2012-12-17 Thread Mike D
I have now tried with two different browsers to attach the log with no 
success. I keep getting error (340) occurred while communicating with the 
server. Do you want me to just email you the log?

On Monday, December 17, 2012 12:45:45 PM UTC-8, Mike D wrote:

 Sorry about that. I just tried to attach the log and it keeps giving me an 
 error. The scheduler_task record is marked QUEUED and the last 
 scheduler_run record is marked COMPLETED. The task just isn't being run for 
 some reason.

 On Monday, December 17, 2012 12:29:34 PM UTC-8, Niphlod wrote:

 you could attach the log to the message, so the thread doesn't get long:P
  I see 2 rounds only COMPLETED, then a huge gap
  

 2012-12-16 21:39:30,330 - web2py.scheduler - INFO - task completed 
 (COMPLETED)
 2012-12-16 23:12:23,296 - web2py.scheduler - DEBUG - new 
 scheduler_run record
 2012-12-16 23:12:23,298 - web2py.scheduler - INFO - new task 1 search 
 for files ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,298 - web2py.scheduler - DEBUG -  new task 
 allocated: ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,299 - web2py.scheduler - DEBUG -task starting
 2012-12-16 23:12:23,303 - web2py.scheduler - DEBUG - task started
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG - new task 
 report: COMPLETED
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG -result: success
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -  partial output: 
 serach for files
 /usr/local/ss_server/web2py_ss_server
 processing file: 
 S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
 IO Error
 processing file: 
 S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
 IO Error
 processing file: 
 S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
 IO Error
 processing file: 
 S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
 IO Error
 
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -   task completed or 
 failed
 2012-12-16 23:12:23,574 - web2py.scheduler - DEBUG -  recording task 
 report in db (COMPLETED)
 2012-12-16 23:12:23,580 - web2py.scheduler - INFO - task completed 
 (COMPLETED)

 HUGE GAP here 

 2012-12-17 03:13:26,360 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:46,026 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:49,068 - web2py.scheduler - DEBUG - recording 
 heartbeat

 then practically nothing. Can you tell me how the task in the 
 scheduler_task table is at this time ? 


  



-- 





[web2py] Linking the view button on a grid to the correct table for a multi-table query

2012-12-17 Thread simon
I have a grid where I want to show all payments for a customer. It is 
driven by this query:

   ((db.payment.id  0)  (db.payment.salesorder==db.salesorder.id)  
(db.salesorder.customer == customerid))

It shows the correct rows. However the view button links to the salesorder 
and I want it to show the payment. Is this possible?

-- 





[web2py] Re: Web2py scheduler timeout

2012-12-17 Thread Niphlod
no probl, the email is kinda obvious, at gmail.com

On Monday, December 17, 2012 9:54:38 PM UTC+1, Mike D wrote:

 I have now tried with two different browsers to attach the log with no 
 success. I keep getting error (340) occurred while communicating with the 
 server. Do you want me to just email you the log?

 On Monday, December 17, 2012 12:45:45 PM UTC-8, Mike D wrote:

 Sorry about that. I just tried to attach the log and it keeps giving me 
 an error. The scheduler_task record is marked QUEUED and the last 
 scheduler_run record is marked COMPLETED. The task just isn't being run for 
 some reason.

 On Monday, December 17, 2012 12:29:34 PM UTC-8, Niphlod wrote:

 you could attach the log to the message, so the thread doesn't get long:P
  I see 2 rounds only COMPLETED, then a huge gap
  

 2012-12-16 21:39:30,330 - web2py.scheduler - INFO - task completed 
 (COMPLETED)
 2012-12-16 23:12:23,296 - web2py.scheduler - DEBUG - new 
 scheduler_run record
 2012-12-16 23:12:23,298 - web2py.scheduler - INFO - new task 1 search 
 for files ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,298 - web2py.scheduler - DEBUG -  new task 
 allocated: ss_server/appadmin.searchForFiles
 2012-12-16 23:12:23,299 - web2py.scheduler - DEBUG -task starting
 2012-12-16 23:12:23,303 - web2py.scheduler - DEBUG - task started
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG - new task 
 report: COMPLETED
 2012-12-16 23:12:23,531 - web2py.scheduler - DEBUG -result: 
 success
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -  partial output: 
 serach for files
 /usr/local/ss_server/web2py_ss_server
 processing file: 
 S-1014.D-20121214121351.L-WIKILONG.I-00055032,.P-2.jpg
 IO Error
 processing file: 
 S-1014.D-20121214135116.L-KONGS.I-00055055,.P-1.jpg
 IO Error
 processing file: 
 S-1019.D-20121214122954.L-WIKILONG.I-TEST,.P-8.jpg
 IO Error
 processing file: 
 S-1021.D-20121214125548.L-WIKILONG.I-10055006,.P-1.jpg
 IO Error
 
 2012-12-16 23:12:23,573 - web2py.scheduler - DEBUG -   task completed 
 or failed
 2012-12-16 23:12:23,574 - web2py.scheduler - DEBUG -  recording task 
 report in db (COMPLETED)
 2012-12-16 23:12:23,580 - web2py.scheduler - INFO - task completed 
 (COMPLETED)

 HUGE GAP here 

 2012-12-17 03:13:26,360 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:46,026 - web2py.scheduler - DEBUG - recording 
 heartbeat
 2012-12-17 03:28:49,068 - web2py.scheduler - DEBUG - recording 
 heartbeat

 then practically nothing. Can you tell me how the task in the 
 scheduler_task table is at this time ? 


  



-- 





[web2py] Re: Single page apps vs Web2py

2012-12-17 Thread Niphlod
every request done to /app/static/file.something is automatically served by 
web2py (matching a file into applications/app/static/file.something).


On Monday, December 17, 2012 2:55:19 PM UTC+1, Arnon Marcus wrote:

 Another general issue regarding that:

 How would web2py behave using various modular javascript loaders?
 Do I HAVE to configure my web server so serve the static folder?
 How about AMD solutions (such as require.js and r.js), how would they 
 behave?
 Is there a way to rout those requests through web2py?
 Can the request be dependecy-calculated in the client-side, and 
 accumulated into a single request?
 What are the proes/cons of doing that through web2py and/or through the 
 web server directly?


-- 





[web2py] Re: Webassets in web2py

2012-12-17 Thread Niphlod


On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:

 Holy shit...

 Where did you say you got all that info from?


quoted the link and scanning the source code 
 

 Is this what that module needs?

 I thought it's just a stand-alone pythonic-module doing everything...
 Guess I was a bit optimistic...

 little bit too much :P
 

 What about coffeeCup?


meaning coffeescript ? 
 

 - is it just something like edit the less file in static/less/file.less 
 and have it recompiled as /static/css/file.css
 Well, either that and/or sass/scss, as well as coffescript transpiling, 
 with optional minification/zipping for the resaulting js/css, yeah, 
 basically that.


I'm not that much advanced, but as long as there is a list of extensions 
that follow the same rule, a contrib script continuosly checking for 
changed files is not hard to do.
 

 But if there is ANY need for node.js in this kind of solution, than forget 
 it.


I gave you the list of what webasset provide with python modules. I think 
the author researched a lot and resorted to external binaries only when 
needed  

Is web2py minifying css/js scripts by default? If so, in what 
 circumstances? And since what version?


nope. Web2py includes contrib.minify (containing jsmin and cssmin) that is 
activated by response.optimize_css and response.optimize_js . It's a 
feature I think since 1.99.7.

Gzipping is not done within web2py. Usually that is something done only 
one-time-only before releasing to production and for that there is 
scripts/zip_static_files.py (meant to be run from shell as web2py.py -S 
yourapp -R scripts/zip_static_files.py). It creates automatically .gz files 
with the same mtime in order to be recognized as valid replacement by 
apache, nginx  co. Standalone web2py serves automatically gz files in the 
static folder with the same mtime without any configuration at all (meaning 
that a request for /app/static/js/jquery.js as long as there is a 
/app/static/js/jquery.js.gz with the same mtime will serve the gzipped one 
automatically)

 

-- 





[web2py] help with login

2012-12-17 Thread samuel bonilla
@servicios_publicos.json
def login(usuario, password):
respuesta = {}
user = auth.login_bare(usuario, password)
if not user:
respuesta['estado'] = 'Error'
respuesta['mensaje'] = 'Nombre de usuario o contraseña incorrecta'
else:
respuesta['estado'] = 'OK'
respuesta['mensaje'] = 'Login correcto'
return respuesta

i get this error

type 'exceptions.ValueError' unsupported hash type |pbkdf2(1000,20,sha512)

-- 





[web2py] Re: help with login

2012-12-17 Thread Derek
This is telling me that your system doesn't support sha512?

On Monday, December 17, 2012 3:31:48 PM UTC-7, samuel bonilla wrote:

 @servicios_publicos.json
 def login(usuario, password):
 respuesta = {}
 user = auth.login_bare(usuario, password)
 if not user:
 respuesta['estado'] = 'Error'
 respuesta['mensaje'] = 'Nombre de usuario o contraseña incorrecta'
 else:
 respuesta['estado'] = 'OK'
 respuesta['mensaje'] = 'Login correcto'
 return respuesta

 i get this error

 type 'exceptions.ValueError' unsupported hash type 
 |pbkdf2(1000,20,sha512)

-- 





[web2py] Re: help with login

2012-12-17 Thread Derek
Make sure you have OpenSSL installed.

On Monday, December 17, 2012 4:04:51 PM UTC-7, Derek wrote:

 This is telling me that your system doesn't support sha512?

 On Monday, December 17, 2012 3:31:48 PM UTC-7, samuel bonilla wrote:

 @servicios_publicos.json
 def login(usuario, password):
 respuesta = {}
 user = auth.login_bare(usuario, password)
 if not user:
 respuesta['estado'] = 'Error'
 respuesta['mensaje'] = 'Nombre de usuario o contraseña incorrecta'
 else:
 respuesta['estado'] = 'OK'
 respuesta['mensaje'] = 'Login correcto'
 return respuesta

 i get this error

 type 'exceptions.ValueError' unsupported hash type 
 |pbkdf2(1000,20,sha512)



-- 





[web2py] Re: Single page apps vs Web2py

2012-12-17 Thread Arnon Marcus
I know it does for direct script-tag requests and also for that 
web2py-python-api-usage done in the layout.html/ajax_whatever.html thing...

I mean how would a javascript-based loader do that?
I'm not that well versed in requier.js, but from what I read, the A in 
AMD stands for asynchronous, so my guess is that the javascript in the 
loader-library does some ajax-voodo or somethin... What is the base-folder 
it requests? I mean, is web2py's ajax file-requests work fine with this? Or 
do I have to do something special? Because I did have some issues, for 
example with the kickstrap stack.that I suspected had something or other 
to do with a custom javascript loader... 

On Monday, December 17, 2012 1:59:20 PM UTC-8, Niphlod wrote:

 every request done to /app/static/file.something is automatically served 
 by web2py (matching a file into applications/app/static/file.something).


 On Monday, December 17, 2012 2:55:19 PM UTC+1, Arnon Marcus wrote:

 Another general issue regarding that:

 How would web2py behave using various modular javascript loaders?
 Do I HAVE to configure my web server so serve the static folder?
 How about AMD solutions (such as require.js and r.js), how would they 
 behave?
 Is there a way to rout those requests through web2py?
 Can the request be dependecy-calculated in the client-side, and 
 accumulated into a single request?
 What are the proes/cons of doing that through web2py and/or through the 
 web server directly?



-- 





[web2py] Re: Webassets in web2py

2012-12-17 Thread Arnon Marcus
That sounds very cool, thanks for the detailed answered, this makes my head 
a little calmer now...

BTW, I actually DID mean coffeCup, It refers to the python module I 
referenced in my second post here:

http://42coffeecups.com/

It does coffeeScript-to-javascript transipling.
I think this one is not dependant on node, but I might be mistaken here as 
well...

On Monday, December 17, 2012 2:26:38 PM UTC-8, Niphlod wrote:



 On Monday, December 17, 2012 2:50:09 PM UTC+1, Arnon Marcus wrote:

 Holy shit...

 Where did you say you got all that info from?


 quoted the link and scanning the source code 
  

 Is this what that module needs?

 I thought it's just a stand-alone pythonic-module doing everything...
 Guess I was a bit optimistic...

 little bit too much :P
  

 What about coffeeCup?


 meaning coffeescript ? 
  

 - is it just something like edit the less file in static/less/file.less 
 and have it recompiled as /static/css/file.css
 Well, either that and/or sass/scss, as well as coffescript transpiling, 
 with optional minification/zipping for the resaulting js/css, yeah, 
 basically that.


 I'm not that much advanced, but as long as there is a list of extensions 
 that follow the same rule, a contrib script continuosly checking for 
 changed files is not hard to do.
  

 But if there is ANY need for node.js in this kind of solution, than 
 forget it.


 I gave you the list of what webasset provide with python modules. I think 
 the author researched a lot and resorted to external binaries only when 
 needed  

 Is web2py minifying css/js scripts by default? If so, in what 
 circumstances? And since what version?


 nope. Web2py includes contrib.minify (containing jsmin and cssmin) that is 
 activated by response.optimize_css and response.optimize_js . It's a 
 feature I think since 1.99.7.

 Gzipping is not done within web2py. Usually that is something done only 
 one-time-only before releasing to production and for that there is 
 scripts/zip_static_files.py (meant to be run from shell as web2py.py -S 
 yourapp -R scripts/zip_static_files.py). It creates automatically .gz files 
 with the same mtime in order to be recognized as valid replacement by 
 apache, nginx  co. Standalone web2py serves automatically gz files in the 
 static folder with the same mtime without any configuration at all (meaning 
 that a request for /app/static/js/jquery.js as long as there is a 
 /app/static/js/jquery.js.gz with the same mtime will serve the gzipped one 
 automatically)

  


-- 





[web2py] Re: Single page apps vs Web2py

2012-12-17 Thread Niphlod
as long as the resource loader asks for /app/static/something.js there is 
no absolute problem. AMD if used to load js files works his magic 
completely on client-side (vodoo-magic is requesting 5 js scripts at the 
same time without waiting and organize the evaluation in the right order).

From the server standpoint, they are 5 totally normal requests coming for 5 
resources, as if they were images in a blog.

On Tuesday, December 18, 2012 12:12:24 AM UTC+1, Arnon Marcus wrote:

 I know it does for direct script-tag requests and also for that 
 web2py-python-api-usage done in the layout.html/ajax_whatever.html 
 thing...

 I mean how would a javascript-based loader do that?
 I'm not that well versed in requier.js, but from what I read, the A in 
 AMD stands for asynchronous, so my guess is that the javascript in the 
 loader-library does some ajax-voodo or somethin... What is the 
 base-folder it requests? I mean, is web2py's ajax file-requests work fine 
 with this? Or do I have to do something special? Because I did have some 
 issues, for example with the kickstrap stack.that I suspected had 
 something or other to do with a custom javascript loader... 

 On Monday, December 17, 2012 1:59:20 PM UTC-8, Niphlod wrote:

 every request done to /app/static/file.something is automatically served 
 by web2py (matching a file into applications/app/static/file.something).


 On Monday, December 17, 2012 2:55:19 PM UTC+1, Arnon Marcus wrote:

 Another general issue regarding that:

 How would web2py behave using various modular javascript loaders?
 Do I HAVE to configure my web server so serve the static folder?
 How about AMD solutions (such as require.js and r.js), how would they 
 behave?
 Is there a way to rout those requests through web2py?
 Can the request be dependecy-calculated in the client-side, and 
 accumulated into a single request?
 What are the proes/cons of doing that through web2py and/or through the 
 web server directly?



-- 





Re: [web2py] Re: Single page apps vs Web2py

2012-12-17 Thread Arnon Marcus
Swt! :)

I like this kind of voodoo...

10x a lot for clearing that out.


On Mon, Dec 17, 2012 at 3:24 PM, Niphlod niph...@gmail.com wrote:

 as long as the resource loader asks for /app/static/something.js there is
 no absolute problem. AMD if used to load js files works his magic
 completely on client-side (vodoo-magic is requesting 5 js scripts at the
 same time without waiting and organize the evaluation in the right order).

 From the server standpoint, they are 5 totally normal requests coming for
 5 resources, as if they were images in a blog.


 On Tuesday, December 18, 2012 12:12:24 AM UTC+1, Arnon Marcus wrote:

 I know it does for direct script-tag requests and also for that
 web2py-python-api-usage done in the layout.html/ajax_whatever.html
 thing...

 I mean how would a javascript-based loader do that?
 I'm not that well versed in requier.js, but from what I read, the A in
 AMD stands for asynchronous, so my guess is that the javascript in the
 loader-library does some ajax-voodo or somethin... What is the
 base-folder it requests? I mean, is web2py's ajax file-requests work
 fine with this? Or do I have to do something special? Because I did have
 some issues, for example with the kickstrap stack.that I suspected had
 something or other to do with a custom javascript loader...

 On Monday, December 17, 2012 1:59:20 PM UTC-8, Niphlod wrote:

 every request done to /app/static/file.something is automatically served
 by web2py (matching a file into applications/app/static/file.**
 something).


 On Monday, December 17, 2012 2:55:19 PM UTC+1, Arnon Marcus wrote:

 Another general issue regarding that:

 How would web2py behave using various modular javascript loaders?
 Do I HAVE to configure my web server so serve the static folder?
 How about AMD solutions (such as require.js and r.js), how would they
 behave?
 Is there a way to rout those requests through web2py?
 Can the request be dependecy-calculated in the client-side, and
 accumulated into a single request?
 What are the proes/cons of doing that through web2py and/or through the
 web server directly?

  --





-- 





[web2py] Re: Webassets in web2py

2012-12-17 Thread Niphlod



 BTW, I actually DID mean coffeCup, It refers to the python module I 
 referenced in my second post here:

 http://42coffeecups.com/

  
that page lends to something I can't trace to some source code doing that. 
I found only tddspry and django couchdb adapter and some sites they made in 
django.
Googling around , this https://github.com/dsc/coffeecup is what are you 
pointing to, I think. As stated clearly in the readme

*CoffeeCup depends on CoffeeScript, which depends on node.jshttp://nodejs.org
.*
 
Sorry.

-- 





Re: [web2py] Caution: 2.2.1 jquery ui tabs break menu dropdowns

2012-12-17 Thread Cliff Kachinske
There appears to be an exception in bootstrap.min.js

e(...).on is not a function 

The debugger reports the problem occurring in column zero.

On Monday, December 17, 2012 12:50:30 PM UTC-5, rochacbruno wrote:

 do you have JS error message?

 Bruno Rocha
 http://rochacbruno.com.br
 mobile
  Em 17/12/2012 15:46, Cliff Kachinske cjk...@gmail.com javascript: 
 escreveu:

 Just a cautionary note for anyone planning to upgrade to 2.2.1

 I don't have an answer for this.

 -- 
  
  
  



-- 





[web2py] Re: editable=lambda row: check(row), : make user's row editable, and the rest read only

2012-12-17 Thread villas
In this case I usually make editable=False and then make my own 'Edit' link 
button for just those records the user is allowed to change.


On Monday, December 17, 2012 8:09:47 PM UTC, Adi wrote:

 Is it possible to display all rows in grid, but make editable only a row 
 that belongs to a particular user? Tried searching if someone else did it, 
 but couldn't find any reference... 

 Tried following code, without success: 

 def check(row): return (row.created_by == 1) #auth.user_id

 def suppliers():
grid=SQLFORM.grid(q, ...
 editable=lambda row: check(row),
 # or, a second solution: 
 # editable=lambda row: row.created_by==auth.user_id,


 A filter will do it, but all other rows will not be displayed, which is 
 not what I want:
 db.supplier._common_filter = lambda query: 
 (db.supplier.created_by   auth.user_id)


 Thanks,
 Adnan



-- 





[web2py] dependent validator for grid update

2012-12-17 Thread Eric Seidler
Hi.

I have a grid object that I'm using to update records.
I'd like to be able to limit the input value of field B based on the fixed 
value of field A when the update button is clicked for that record.


For example:

step, outcome
1, A
1, B
1, C
2, C
2, D
3, A
3, D
 ...

So if step==1 for a record, the 'outcome' dropdown on the edit page should 
display 'A','B', and 'C' when
the update button is clicked for that record. Similarly, 'C' and 'D' should 
be displayed if step==2.
Note that the value for the 'step' field is constant for that record, it is 
not a field that can be updated, so it's not a dropdown.


I've been trying to use the requires method on field B, but I can't 
figure out how to send the value of field A
_for a specific record_ to that method. I've seen 
request.vars.fieldname but that seems to
work only after the form is submitted and I'd like to see the options for 
field B _before_ the field is
submitted.

Can I handle this using only web2py or do I need some javascript?

-- 





[web2py] Re: dependent validator for grid update

2012-12-17 Thread villas
Hi Eric,
You can just use JS.  And load the data through ajax too (if there is a 
lot).
Search for cascading or cascading drop down lists on this group and on 
web2pyslices.com to get yourself started.


On Monday, December 17, 2012 11:48:00 PM UTC, Eric Seidler wrote:

 Hi.

 I have a grid object that I'm using to update records.
 I'd like to be able to limit the input value of field B based on the fixed 
 value of field A when the update button is clicked for that record.


 For example:

 step, outcome
 1, A
 1, B
 1, C
 2, C
 2, D
 3, A
 3, D
  ...

 So if step==1 for a record, the 'outcome' dropdown on the edit page should 
 display 'A','B', and 'C' when
 the update button is clicked for that record. Similarly, 'C' and 'D' 
 should be displayed if step==2.
 Note that the value for the 'step' field is constant for that record, it 
 is not a field that can be updated, so it's not a dropdown.


 I've been trying to use the requires method on field B, but I can't 
 figure out how to send the value of field A
 _for a specific record_ to that method. I've seen 
 request.vars.fieldname but that seems to
 work only after the form is submitted and I'd like to see the options for 
 field B _before_ the field is
 submitted.

 Can I handle this using only web2py or do I need some javascript?


-- 





[web2py] Mongodb and db.py

2012-12-17 Thread Mike Veltman
Hello People,

I am looking into converting my mysql database setup into a mongodb and
I was wondering about how at the moment db.py does translate the tables.
Because I would like to have some control/understanding about it.

-- 





[web2py] web2py performance, without db

2012-12-17 Thread Daniel Gonzalez
Hi,

I am trying to get some metrics on my installation. For that I have 
disabled the database (db=None) and I am requesting a very simple 
controller:

def hello1():
return Hello World

I have a multi-threaded test program which is sending requests to web2py 
(using WebClient). I have let my test run for several iterations, and I got 
the following metrics:

CLIENTS ROUNDS ELLAPSED (s)TOT REQ   AVG (ms)  REQ/s
  8 72 17.969576 31.197  32.05
  9 25  6.973225 30.991  32.27
  6  4  0.748 24 31.179  32.07
  7 17  3.645119 30.634  32.64
  7 58 12.340406 30.393  32.90
  3 73  6.751219 30.827  32.44
 10 12  3.399120 28.329  35.30
  4 32  3.941128 30.791  32.48
  1 27  0.742 27 27.496  36.37
  8 58 14.156464 30.508  32.78
  4 31  3.574124 28.819  34.70
  8 14  3.274112 29.232  34.21
  9 68 18.722612 30.591  32.69
  9 81 22.070729 30.275  33.03
  4 47  6.031188 32.079  31.17
  7 75 15.491525 29.506  33.89
  1 90  2.495 90 27.719  36.08
  8 38  9.495304 31.234  32.02
  2 60  4.000120 33.335  30.00
  2 81  5.057162 31.214  32.04

(CLIENTS is the number of active threads, ROUNDS is the number of requests 
that each thread performs)

As you see, I am getting quite stable speed of between 30 and 36 requests/s.
This is fine, but 32 req/s is quite low. My system is (this is my 
development system, an HP 635):

   - web2py 2.0.2
   - 2 cores, AMD E-450 
   - 4 GB RAM
   - Linux 2.6.32-5-686
   - CrunchBang Linux statler
   - Python 2.7.2
   - I am using Rocket
   - No apache (or any other frontend). Directly accessing localhost:8000
   - web2py and my test program are sharing the same machine.

I would like to optimize these parameters before moving to production. Is 
there something obvious that I could try to improve these metrics?
Is 30 req/s an expected value for such a simple test? I expected more than 
100 req/s.

Now that I am writing and thinking about this, I am not even sure if the 
limiting factor is web2py or my test program ... How could I know which 
party is saturating?

Thanks,

Daniel

-- 





[web2py] Re: web2py book now free in PDF

2012-12-17 Thread ionel
Thank you very much!

On Tuesday, 12 June 2012 13:17:46 UTC, Massimo Di Pierro wrote:

 The official web2py book is now free for everybody:

 https://dl.dropbox.com/u/18065445/web2py/web2py_manual_4th.1.pdf

 Massimo


-- 





[web2py] Re: editable=lambda row: check(row), : make user's row editable, and the rest read only

2012-12-17 Thread Adi
Thanks Villas. 

That did it :) I thought I could do it directly through editable, so spent 
some time trying in different ways, but didn't realize that created_by 
(field i was filtering on) was readable=writable=False, hahaha... 

Thanks for a quick answer


On Monday, December 17, 2012 6:46:41 PM UTC-5, villas wrote:

 In this case I usually make editable=False and then make my own 'Edit' 
 link button for just those records the user is allowed to change.


 On Monday, December 17, 2012 8:09:47 PM UTC, Adi wrote:

 Is it possible to display all rows in grid, but make editable only a row 
 that belongs to a particular user? Tried searching if someone else did it, 
 but couldn't find any reference... 

 Tried following code, without success: 

 def check(row): return (row.created_by == 1) #auth.user_id

 def suppliers():
grid=SQLFORM.grid(q, ...
 editable=lambda row: check(row),
 # or, a second solution: 
 # editable=lambda row: row.created_by==auth.user_id,


 A filter will do it, but all other rows will not be displayed, which is 
 not what I want:
 db.supplier._common_filter = lambda query: 
 (db.supplier.created_by   auth.user_id)


 Thanks,
 Adnan



-- 





[web2py] Reusing expensive objects

2012-12-17 Thread Daniel Gonzalez
Hi,

My application uses some objects which are quite slow to setup. I create 
this object in the models file, so that they are available for all 
controllers.

Specifically, most of my processing is delegated to a celery queue (based 
on rabbitmq). The interface to this queue is wrapped by a class 
(MessageQueueClient) which I instantiate in the model file db.py. If I 
understand things correctly, this object will be instantiated for each 
request coming to web2py.

Would it be possible to reuse these objects, so that successive requests do 
not need to create them again? How could this be done?

Thanks,
Daniel

-- 





[web2py] Re: Help on rewrite using parameter-based

2012-12-17 Thread Tito Garrido
Or another question, is there a way to use domain names redirect using
pattern-based rewrite?

Regards,

Tito


On Mon, Dec 17, 2012 at 2:07 PM, Tito Garrido titogarr...@gmail.com wrote:

 Hi Folks!

 I have a bunch of domain using the same application so I have something
 like:
 routers = dict(
   BASE  = dict(
   domains = {
   'domain1.net' : 'app/principal',
   'www.domain1.net' : 'app/principal',
   'domain2.net.br' : 'app/principal',
   'www.domain2.net.br' : 'app/principal' }

 Now I need to have (for migration proposes) something like:

 www.domain1.net/something.php mapped to app/content(my
 controler)/something(parameter) but it still needs to show
 www.domain1.net/something.php on the browser and something may vary...

 How can I do that using parameter-based rewrite?

 Thanks in advance!

 --

 Linux User #387870
 .
  _/_õ|__|
 ..º[ .-.___.-._| . . . .
 .__( o)__( o).:___





-- 

Linux User #387870
.
 _/_õ|__|
..º[ .-.___.-._| . . . .
.__( o)__( o).:___

-- 





Re: [web2py] web2py inline editable grid

2012-12-17 Thread Richard Vézina
One of your need could be achieve with this plugin:
http://dev.s-cubism.com/plugin_lazy_options_widget

You may find some thread on this list on how to avoid to use suggest
dependency plugin to trigger the conditional dropdown.

Richard

On Thu, Dec 13, 2012 at 1:46 PM, Eric Seidler eric.seid...@gmail.comwrote:

 r, many people seem to think that writing my own UI

-- 





Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2012-12-17 Thread Richard Vézina
Hello Simone

Here some improvement :

*The following is an example configuration, to reduce the CPU load it is
recommended to run one worker process only and to enable keep-alive
connections:*

*worker_processes
http://wiki.nginx.org/NginxHttpCoreModule#worker_processes 1;*http
http://wiki.nginx.org/NginxHttpCoreModule#http {
  server http://wiki.nginx.org/NginxHttpCoreModule#server {
listen http://wiki.nginx.org/NginxHttpCoreModule#listen   443;
ssl http://wiki.nginx.org/NginxHttpSslModule#ssl  on;
ssl_certificate
http://wiki.nginx.org/NginxHttpSslModule#ssl_certificate
/usr/local/nginx/conf/cert.pem;
ssl_certificate_key
http://wiki.nginx.org/NginxHttpSslModule#ssl_certificate_key
/usr/local/nginx/conf/cert.key;*keepalive_timeout
http://wiki.nginx.org/NginxHttpCoreModule#keepalive_timeout70;*
}}

When using a chain of certificates, just append the extra certificates to
your .crt file (cert.pem in the example). The server certificate needs to
be the first on the file, otherwise you'll get a mismatch between private
and public keys.

*Since Nginx version 0.7.14 the preferred way of enabling SSL is by using
the `ssl` parameter of the `listen` directive:*

server http://wiki.nginx.org/NginxHttpCoreModule#server {*  listen
http://wiki.nginx.org/NginxHttpCoreModule#listen 443 default_server
ssl http://wiki.nginx.org/NginxHttpSslModule#ssl;*  ssl_certificate
http://wiki.nginx.org/NginxHttpSslModule#ssl_certificate
/usr/local/nginx/conf/cert.pem;
  ssl_certificate_key
http://wiki.nginx.org/NginxHttpSslModule#ssl_certificate_key
/usr/local/nginx/conf/cert.key;
  ...}

Ref : http://wiki.nginx.org/HttpSslModule

I put the parameter and the reason in bold.

You do what you want, I report because they are suggested best practices
that I found reading a bit about ssl and Nginx.

Richard

On Mon, Dec 17, 2012 at 12:37 PM, Richard Vézina 
ml.richard.vez...@gmail.com wrote:

 I am not sure, the only thing that I know is that Nginx is not showing up
 until I stop and restart it. Maybe it was needing a reload as you said at
 last...

 Richard


 On Fri, Dec 14, 2012 at 3:01 PM, Niphlod niph...@gmail.com wrote:

 tly with the install and this line is the culprit ?




-- 





[web2py] bootstrap themes generator

2012-12-17 Thread Massimo Di Pierro
http://www.boottheme.com/#generatetheme

-- 





[web2py] Re: fail to use web2py in IPython Notebook

2012-12-17 Thread Massimo Di Pierro
Interesting. If dal works everything should work then. I will take a look 
asap.

On Monday, 17 December 2012 13:19:03 UTC-6, wwwgong wrote:

 Massimo,
 Thanks for your quick reply. For most part, web2py worked with IPython 
 Notebook like DAL, which is pretty good.
 My interest is to to reuse web2py for managing notebooks without 
 developing Tornado apps myself as I am new to python and web2py.

 W.

 On Sunday, December 16, 2012 10:13:16 PM UTC-5, Massimo Di Pierro wrote:

 Unfortunately I am not sure you can run web2py with Ipython notebook. The 
 reason is that the notebook is a web interface and the statements are 
 executed server side. The notebook server may execute the statements in 
 different threads (I am not sure but from the tracebacks that is what it 
 looks like). The web2py modules assume no data is shared among threads 
 since one tread serves one request at the time.

 I would need to understand better the notebook concurrency model before 
 this can be addressed.

 Massimo



 On Sunday, 16 December 2012 18:35:06 UTC-6, wwwgong wrote:

 I have watched video at https://vimeo.com/21185623 and try to use 
 web2py inside IPython Notebook, but run into 
 the following error:

 form = SQLFORM(db.ipynotebooks)

 ---AttributeError
 Traceback (most recent call 
 last)ipython-input-36-c6b1cb76b770 in module() 1 form = 
 SQLFORM(db.ipynotebooks)
 D:\web2py_git\gluon\sqlhtml.pyc in __init__(self, table, record, deletable, 
 linkto, upload, fields, labels, col3, submit_button, delete_label, showid, 
 readonly, comments, keepopts, ignore_rw, record_id, formstyle, buttons, 
 separator, **attributes)911linkto=URL(f='table/db/')
 912 -- 913 T = current.T914 915 
 self.ignore_rw = ignore_rw
 AttributeError: 'thread._local' object has no attribute 'T'


 I have created a gist at http://nbviewer.ipython.org/4314583/

 Thanks,
 W



-- 





[web2py] Re: Using contrib.webclient to test JSONRPC interfaces

2012-12-17 Thread Massimo Di Pierro
 you point me to the file? Is it this one?

https://github.com/gonvaled/web2py/blob/webclient_add_jsonrpc/gluon/contrib/webclient.py


On Monday, 17 December 2012 14:01:18 UTC-6, Daniel Gonzalez wrote:

 I have slightly modified the WebClient to support jsonrpc. I am not sure 
 everything is correctly covered, but it is suiting my needs.

 In case you are interested, you can see the changes here:

 https://github.com/gonvaled/web2py/tree/webclient_add_jsonrpc

 The biggest problem I had was 
 that opener.addheaders.append((key,str(value))) is not working as (I) 
 expected: the content-type is not rewritten:

 http://stackoverflow.com/questions/13920211/not-possible-to-set-content-type-to-application-json-using-urllib2

 On Monday, December 17, 2012 6:38:30 PM UTC+1, Daniel Gonzalez wrote:

 Hi,

 I am trying to understand how to use the included WebClient to test a 
 JSONRPC interface. One showstopper for me at the moment is that I see the 
 following in WebClient.post:

 # time the POST request
 data = urllib.urlencode(data)
 t0 = time.time()
 self.response = opener.open(self.url,data)
 self.time = time.time()-t0

 When doing JSONRPC accesses I do not want the data to be urlencoded. 
 Actually, I will prepare the data with json.dump, and I want WebClient to 
 POST it transparently (I guess this goes in the body of the POST request). 
 Is this at all possible? Is there an example of WebClient usage 
 for JSONRPC interfaces somewhere?

 Thanks,
 Daniel Gonzalez



-- 





[web2py] Re: web2py 2.3.2 is OUT

2012-12-17 Thread apps in tables

another advantage:

2.3.1 is 45 mb
2.3.2 is 15 mb

smaller is nicer...:)


On Monday, December 17, 2012 6:11:19 PM UTC+3, Massimo Di Pierro wrote:

 It is the same as 2.3.2 but fixed a major bug with NEWINSTALL being 
 ignored and therefore not creating the welcome.w2p for the new scaffolding 
 app.

 If you are using 2.3.1 you may still be using an older welcome instead of 
 the cool new one. Upgrade to 2.3.2 to fix this.

 Massimo


-- 





[web2py] Re: web2py performance, without db

2012-12-17 Thread Massimo Di Pierro
Do you have model files at all?
tricks for speedup:
- use web2py 2.3.2 (the 2.2.1 had some tricks for speedup)
- bytecode compile the app
- use a production web sever like nginx
- remove language files

I also would expect more then 100reqs/sec.


On Monday, 17 December 2012 18:23:57 UTC-6, Daniel Gonzalez wrote:

 Hi,

 I am trying to get some metrics on my installation. For that I have 
 disabled the database (db=None) and I am requesting a very simple 
 controller:

 def hello1():
 return Hello World

 I have a multi-threaded test program which is sending requests to web2py 
 (using WebClient). I have let my test run for several iterations, and I got 
 the following metrics:

 CLIENTS ROUNDS ELLAPSED (s)TOT REQ   AVG (ms)  REQ/s
   8 72 17.969576 31.197  32.05
   9 25  6.973225 30.991  32.27
   6  4  0.748 24 31.179  32.07
   7 17  3.645119 30.634  32.64
   7 58 12.340406 30.393  32.90
   3 73  6.751219 30.827  32.44
  10 12  3.399120 28.329  35.30
   4 32  3.941128 30.791  32.48
   1 27  0.742 27 27.496  36.37
   8 58 14.156464 30.508  32.78
   4 31  3.574124 28.819  34.70
   8 14  3.274112 29.232  34.21
   9 68 18.722612 30.591  32.69
   9 81 22.070729 30.275  33.03
   4 47  6.031188 32.079  31.17
   7 75 15.491525 29.506  33.89
   1 90  2.495 90 27.719  36.08
   8 38  9.495304 31.234  32.02
   2 60  4.000120 33.335  30.00
   2 81  5.057162 31.214  32.04

 (CLIENTS is the number of active threads, ROUNDS is the number of requests 
 that each thread performs)

 As you see, I am getting quite stable speed of between 30 and 36 
 requests/s.
 This is fine, but 32 req/s is quite low. My system is (this is my 
 development system, an HP 635):

- web2py 2.0.2
- 2 cores, AMD E-450 
- 4 GB RAM
- Linux 2.6.32-5-686
- CrunchBang Linux statler
- Python 2.7.2
- I am using Rocket
- No apache (or any other frontend). Directly accessing localhost:8000
- web2py and my test program are sharing the same machine.

 I would like to optimize these parameters before moving to production. Is 
 there something obvious that I could try to improve these metrics?
 Is 30 req/s an expected value for such a simple test? I expected more than 
 100 req/s.

 Now that I am writing and thinking about this, I am not even sure if the 
 limiting factor is web2py or my test program ... How could I know which 
 party is saturating?

 Thanks,

 Daniel


-- 





[web2py] Re: Running the scheduler as a windows service using nssm

2012-12-17 Thread Tim Richardson


On Monday, December 17, 2012 2:08:29 PM UTC+11, Massimo Di Pierro wrote:

 Agreed. Can you help us write it?


I just tried my first pull request so you should see that in the 
web2py-book repository on github. I hope. 

-- 





[web2py] Re: web2py 2.3.2 is OUT

2012-12-17 Thread Massimo Di Pierro
Are you sure about this? I cannot explain it. What's in the extra +30MB?

On Monday, 17 December 2012 21:27:44 UTC-6, apps in tables wrote:


 another advantage:

 2.3.1 is 45 mb
 2.3.2 is 15 mb

 smaller is nicer...:)


 On Monday, December 17, 2012 6:11:19 PM UTC+3, Massimo Di Pierro wrote:

 It is the same as 2.3.2 but fixed a major bug with NEWINSTALL being 
 ignored and therefore not creating the welcome.w2p for the new scaffolding 
 app.

 If you are using 2.3.1 you may still be using an older welcome instead of 
 the cool new one. Upgrade to 2.3.2 to fix this.

 Massimo



-- 





[web2py] Re: Upload file from bash script

2012-12-17 Thread Alfonso Pastor Sierra
Works fine, just a comment:

curl -POST --data-binary @localfilename 

to avoid loss of CR / LF in text files

Thank you very much.

El sábado, 15 de diciembre de 2012 20:20:11 UTC+1, Massimo Di Pierro 
escribió:

 auth.settings.allow_basic_login = True
 db.define_table('test',Field('storedfilename','upload'))

 @auth.requires_login()
 def upload():
 return db.test.insert(storedfilename = 
 db.test.storedfilename.store(request.body, filename=request.args(0))


 curl -X POST -d @localfilename 
 http://user:pass@m127.0.0.1:8000/yourapp/default/upload/givenfilename.txt

  



 On Saturday, 15 December 2012 05:49:08 UTC-6, Alfonso Pastor Sierra wrote:

 Hi, 

 I want upload a file to a upload field in a table automatically, 
 sending the file from a bash script using wget. How can I do it?.

 Thanks



-- 





[web2py] Login manually

2012-12-17 Thread Wonton
Hello everyone,

I'm developing a backend site with web2py. I have 2 web services, one to 
register a user and a second one to login the user.
This is the first one:

def register(user, email, password):
 db.auth_user.insert(username=user, email=email, 
password=db.auth_user.password.validate(password)) 
...
 return 'OK'

It's working ok and the users are created without problem.

This is the second one:

def login(user, password):
response = auth.login_bare(user, password)
 if not response:
message = 'Error'
else:
 message = 'OK'
   return message

With this service I have the following error:
type 'exceptions.ValueError' unsupported hash type |pbkdf2(1000,20,sha512)

I've tried to find any solution to this problem without success.

Any of you has any idea of what is happening?

Thank you very much and kind regards!

Wonton

-- 





Re: [web2py] 'Row' object has no attribute powerTable SOLVED

2012-12-17 Thread FERNANDO VILLARROEL
Dear.
After looking some solution in google, i found this solution:
https://groups.google.com/forum/?fromgroups=#!topic/web2py-usuarios/gvxQAC3Xfts
I  added this lines to my controller:
@auth.requires_login()def pagos():
         class Virtual(object):                
@virtualsettings(label=T('Information:'))                def 
virtualtooltip(self):                        return T('This is a virtual 
tooltip for record %s' % self.pagos.id)
Now powerTable works, anyone could me explain why?
Regards.
--- On Mon, 12/17/12, FERNANDO VILLARROEL fvillarr...@yahoo.com wrote:

From: FERNANDO VILLARROEL fvillarr...@yahoo.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 3:46 PM

Dear.
Why when i run:
def test():    
return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)
Works fine.
But when i use powerTable occur the error:
reg=db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha) 
        powerTable = plugins.powerTable         powerTable.datasource = reg     
    powerTable.dtfeatures['sScrollY'] = '100%'         
powerTable.dtfeatures['sScrollX'] = '100%'         
powerTable.dtfeatures['bPaginate'] =
  True         powerTable.dtfeatures['bAutoWidth'] = True          
powerTable._width='1020'         powerTable.dtfeatures['bSort'] = False #Se 
muestra ordenado por Query         
#powerTable.extra=dict(editable={'editablecallback':URL('llamadas','editablefunction')})  
        powerTable.dtfeatures['iDisplayLength'] = 50          
powerTable.virtualfields = None          powerTable.headers='labels'         
powerTable.showkeycolumn = False         powerTable.dtfeatures['bJQueryUI'] = 
request.vars.get('jqueryui',True)         powerTable.uitheme =
 'redmond'#request.vars.get('theme','cupertino')#'smoothness' / 'redmond'       
  powerTable.dtfeatures['sPaginationType'] = 
'full_numbers'#request.vars.get('pager','full_numbers') # two_button scrolling  
       powerTable.columns =  
['pagos.id','pagos.fecha','pagos.monto','pagos.comments']         
#powerTable.extra = dict(autoresize={})         powerTable.keycolumn = 
'pagos.id'         powerTable.hiddecolumns=['pagos.id']         
table=powerTable.create()         return dict(table=table) 

type 'exceptions.AttributeError' 'Row' object has no attribute 'pagos'
Any idea what is wrong?

--- On Mon, 12/17/12, FERNANDO VILLARROEL fvillarr...@yahoo.com wrote:

From: FERNANDO VILLARROEL fvillarr...@yahoo.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 11:02 AM

Dear Bruno.
Yes works fine without powerTable
The problem occur when i use powerTable.
Regards

--- On Mon, 12/17/12, Bruno Rocha
 rochacbr...@gmail.com wrote:

From: Bruno Rocha rochacbr...@gmail.com
Subject: Re: [web2py] 'Row' object has no attribute powerTable
To: web2py@googlegroups.com
Date: Monday, December 17, 2012, 1:04 AM

what happens if you just return the Rows without using powerTable, it works?
def test():    
return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)



-- 

 

 

 





-- 

 

 

 





-- 

 

 

 

-- 





Re: [web2py] Re: webgrid and row_created

2012-12-17 Thread Kenneth Lundström

Hi Adi,

very many thanks. That was exactly what I was looking for.


Kenneth



this is how i use onclick for confirmation purpose in a grid:

|
lambdarow:A('Copy',
_class='btn',
_onclick='return confirm(Duplicate %s?)'%row.po_number,
_href=URL('duplicate_po',args=[row.id])),


|





On Monday, December 17, 2012 2:46:59 PM UTC-5, Kenneth wrote:

Hi,

anybody have any ideas?

tablerow.components.insert(2, TD(IMG(_src=URL('static',
'delete-article.png'), _onclick=confirmation(rowdata.asset_id),
_width=15)))

Kenneth


Den måndagen den 17:e december 2012 kl. 00:40:10 UTC+2 skrev Kenneth:

Hello,

I'm using webgrid in an application and I'm trying to insert
an delete image into the table to shows all rows in an table.
When clicking on the delete image I want an onclick event to
trigger a Javascript that confirms and deletes that row. To do
that I need the rownumber.

Looks like this:
def controller that uses webgrid():
grid.row_created = add_add_serial_link

def add_add_serial_link(tablerow,rowtype,rowdata):
if rowtype == 'datarow':

tablerow.components.insert(2,
TD(IMG(_src=URL('static', 'delete-article.png'),
_onclick=confirmation(rowdata.asset_id), _width=15)))

How do I write that _onclick so that the asset_id is sent to
the confirmation Javascript? If I write
_onclick='confirmation(rowdata.asset_id)' Javascript gets
the text rowdata.asset_id and not the ID I'm tryin to send to it.


Kenneth



--





--





Re: [web2py] 'Row' object has no attribute powerTable SOLVED

2012-12-17 Thread Bruno Rocha
are you using virtual fields?

In powertable virtualfields properties is implemented with this
@virtualsettings decorator, but only nedded if you are using virtual fields

Bruno Rocha
http://rochacbruno.com.br
mobile
 Em 18/12/2012 02:53, FERNANDO VILLARROEL fvillarr...@yahoo.com
escreveu:

 Dear.

 After looking some solution in google, i found this solution:


 https://groups.google.com/forum/?fromgroups=#!topic/web2py-usuarios/gvxQAC3Xfts

 I  added this lines to my controller:

 @auth.requires_login()
 def pagos():

  class Virtual(object):
 @virtualsettings(label=T('Information:'))
 def virtualtooltip(self):
 return T('This is a virtual tooltip for record %s'
 % self.pagos.id)

 Now powerTable works, anyone could me explain why?

 Regards.

 --- On *Mon, 12/17/12, FERNANDO VILLARROEL fvillarr...@yahoo.com* wrote:


 From: FERNANDO VILLARROEL fvillarr...@yahoo.com
 Subject: Re: [web2py] 'Row' object has no attribute powerTable
 To: web2py@googlegroups.com
 Date: Monday, December 17, 2012, 3:46 PM

 Dear.

 Why when i run:

 def test():
 return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id
 ,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)

 Works fine.

 But when i use powerTable occur the error:

 reg=db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id
 ,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)
  powerTable = plugins.powerTable
  powerTable.datasource = reg
  powerTable.dtfeatures['sScrollY'] = '100%'
  powerTable.dtfeatures['sScrollX'] = '100%'
  powerTable.dtfeatures['bPaginate'] =  True
  powerTable.dtfeatures['bAutoWidth'] = True
  powerTable._width='1020'
  powerTable.dtfeatures['bSort'] = False #Se muestra ordenado por
 Query

  
 #powerTable.extra=dict(editable={'editablecallback':URL('llamadas','editablefunction')})
  powerTable.dtfeatures['iDisplayLength'] = 50
  powerTable.virtualfields = None
  powerTable.headers='labels'
  powerTable.showkeycolumn = False
  powerTable.dtfeatures['bJQueryUI'] =
 request.vars.get('jqueryui',True)
  powerTable.uitheme =
 'redmond'#request.vars.get('theme','cupertino')#'smoothness' / 'redmond'
  powerTable.dtfeatures['sPaginationType'] =
 'full_numbers'#request.vars.get('pager','full_numbers') # two_button
 scrolling
  powerTable.columns =  ['pagos.id
 ','pagos.fecha','pagos.monto','pagos.comments']
  #powerTable.extra = dict(autoresize={})
  powerTable.keycolumn = 'pagos.id'
  powerTable.hiddecolumns=['pagos.id']
  table=powerTable.create()
  return dict(table=table)


 type 'exceptions.AttributeError' 'Row' object has no attribute 'pagos'

 Any idea what is wrong?


 --- On *Mon, 12/17/12, FERNANDO VILLARROEL fvillarr...@yahoo.com* wrote:


 From: FERNANDO VILLARROEL fvillarr...@yahoo.com
 Subject: Re: [web2py] 'Row' object has no attribute powerTable
 To: web2py@googlegroups.com
 Date: Monday, December 17, 2012, 11:02 AM

 Dear Bruno.

 Yes works fine without powerTable

 The problem occur when i use powerTable.

 Regards

 --- On *Mon, 12/17/12, Bruno Rocha rochacbr...@gmail.com* wrote:


 From: Bruno Rocha rochacbr...@gmail.com
 Subject: Re: [web2py] 'Row' object has no attribute powerTable
 To: web2py@googlegroups.com
 Date: Monday, December 17, 2012, 1:04 AM

 what happens if you just return the Rows without using powerTable, it
 works?

 def test():
 return db(db.pagos.id_clientes==session.cliente_id).select(db.pagos.id
 ,db.pagos.fecha,db.pagos.monto,db.pagos.comments,orderby=~db.pagos.fecha)

 --




  --




  --




  --





-- 





Re: [web2py] Re: REF: SQLFORM.grid error

2012-12-17 Thread Teddy Nyambe
Hi Massimo!

It works thanks, the slice I am following is very useful and popular that
error must be edited.

Teddy L.


On Mon, Dec 17, 2012 at 5:09 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Replace

  fields = 
 (db.file_transaction.file_id,**db.file_transaction.source_**office_id,
 \
 db.file_transaction.**destination_office_id,
 db.file_transaction.**transaction_date_time)

 with

  fields = 
 [db.file_transaction.file_id,**db.file_transaction.source_**office_id,
 \
 db.file_transaction.**destination_office_id,
 db.file_transaction.**transaction_date_time]

 On Monday, 17 December 2012 08:58:36 UTC-6, software.ted wrote:

 I am trying to set the fields to display in my grid...I am following the
 slice at 
 http://www.web2pyslices.**com/slice/show/1471/**sqlformgridhttp://www.web2pyslices.com/slice/show/1471/sqlformgrid,
  however, I am having an error with fields...I am using it as follows and
 I getting an error as below:

 links = [lambda row: A('View Post',_href=URL(**
 administration,file_details**,args=[row.file_transaction.**file_id]))]
 fields = 
 (db.file_transaction.file_id,**db.file_transaction.source_**office_id,
 \
 db.file_transaction.**destination_office_id,
 db.file_transaction.**transaction_date_time)
 query = ((db.file_subject_issue.**circulation_status==True) 
 (db.file_transaction.file_**subject_issue_id == db.file_subject_issue.id
 ))
 form = SQLFORM.grid(query,searchable=**True,links=links,
 fields=fields, deletable=False, \
 details=False, editable=False, \
 selectable=False,csv=False , paginate=20,
 user_signature=False)

 Error:

 type 'exceptions.AttributeError' 'tuple' object has no attribute
 'append'


 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.

 Traceback (most recent call last):
   File /home/www-data/web2py/gluon/**restricted.py, line 212, in restricted

 exec ccode in environment
   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 175, in module

   File /home/www-data/web2py/gluon/**globals.py, line 188, in lambda

 self._caller = lambda f: f()

   File 
 /home/www-data/web2py/**applications/intranet/**controllers/administration.py
  
 https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py**,
  line 70, in file_track

 selectable=False,csv=False , paginate=20, user_signature=False)

   File /home/www-data/web2py/gluon/**sqlhtml.py, line 1799, in grid

 fields.append(field_id)
 AttributeError: 'tuple' object has no attribute 'append'


 -- Teddy L

  --







-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





[web2py] Unable to create/Insert-in tables in potgre database

2012-12-17 Thread at

Hi,

Previously I was working on sqlite database with web2py. Now I've installed 
postgresql-9.1.7-1-windows-x64, created a user role (testuser) and database 
(testdb) and tested connectivity using psql; all went fine.

Then I've define following statement in db.py:
*db = DAL('postgres://testuser:12345@localhost/testdb')*

Previously it was:
#db = DAL('sqlite://storage.sqlite')

Web2py and application started successfully, but it doesn't create tables 
defined in db.py; consider the following def:
*db.define_table('taxpayer',
Field('name'),
Field('married', 'boolean'),
Field('spouse_name'))
*
When I try to insert records in this table, I get following error message:
class 'gluon.contrib.pg8000.errors.ProgrammingError' ('ERROR', '42P01', 
'relation taxpayer does not exist')

Can somebody help please ?

Thanks  Regards
AT



-- 





[web2py] REF: Displaying a Virtual Field in SQLFORM.grid throws an exception....

2012-12-17 Thread Teddy Nyambe
Does SQLFORM.grid support adding and display of a virtual field...am
getting an exception...my code:

db.file_subject_issue.file_name = Field.Virtual(lambda row:
get_file_name(row.file_subject_issue.file_id))
fields = [db.file_subject_issue.file_id,
db.file_subject_issue.date_created, db.file_subject_issue.file_name]
query =

form = SQLFORM.grid(query,fields=fields,...)

I am getting the error

type 'exceptions.AttributeError' 'FieldVirtual' object has no attribute
'_tablename'

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/restricted.py, line 212, in restricted
exec ccode in environment
  File 
/home/www-data/web2py/applications/intranet/controllers/administration.py
https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
line 176, in module
  File /home/www-data/web2py/gluon/globals.py, line 188, in lambda
self._caller = lambda f: f()
  File 
/home/www-data/web2py/applications/intranet/controllers/administration.py
https://192.168.0.251/admin/default/edit/intranet/controllers/administration.py,
line 71, in file_track
selectable=False,csv=False , paginate=20, user_signature=False)
  File /home/www-data/web2py/gluon/sqlhtml.py, line 1796, in grid
if field._tablename in tablenames]
AttributeError: 'FieldVirtual' object has no attribute '_tablename'




-- 
...
Teddy Lubasi Nyambe
Opensource Zambia
Lusaka, ZAMBIA

Cell: +260 97 7760473
website: http://www.opensource.org.zm

~/
Human Knowledge belongs to the world! - AntiTrust

Man is a tool-using animal. Without tools he is nothing, with tools he is
all - Thomas Carlyle 1795-1881

/~

-- 





  1   2   >