[web2py] Re: looking for volunteers to help proof-read book 5th ed.

2013-01-25 Thread Andrew W
I won't get it done before Saturday, but here's one:
replace the first http://code.google.com/p/instant-press/;
with
https://github.com/rochacbruno/Movuca;


On Tuesday, January 22, 2013 1:29:25 AM UTC+13, dhmorgan wrote:

 Signed, I hope! 

 I just downloaded diff and am looking forward to the task. 


-- 





[web2py] Re: selecting database entries

2013-01-25 Thread BlueShadow
I do want to select images because Images are added to articles later on. I 
want to show a list of the newest pictures but I don't want to show 6 
images for the same article(the list I show will contain 6 images)

On Thursday, January 24, 2013 8:41:42 PM UTC+1, Derek wrote:

 Well, you don't want to select images then, you want to select articles - 
 then get a single image attached to the article. 

 On Thursday, January 24, 2013 8:51:42 AM UTC-7, BlueShadow wrote:

 Hi I got two tables in my application one for images and one for 
 articles. an artical can have multiple images attached to it.
 What I want to do is displaying a list of the newest images but there 
 should only be one per article
 db.define_table('Images',
 Field('Headline',length=1024),
 Field('Image','upload'),
 Field('Submitted','datetime',default=datetime.datetime.now(),writable
 =False,readable=False),
 format = '%(Headline)s' 
 )

 db.define_table('Article',
 Field('Title',length=512),
 Field('Content','text'),
 Field('Submitted','datetime',default=datetime.datetime.now()),
 Field('TopImage','reference Images', requires=IS_EMPTY_OR(IS_IN_DB(db
 , db.Images.id), null=None)),
 Field('BottomlImage','reference Images', requires=IS_EMPTY_OR(
 IS_IN_DB(db, db.Images.id), null=None)),
 Field('BottomrImage','reference Images', requires=IS_EMPTY_OR(
 IS_IN_DB(db, db.Images.id), null=None)),
 Field('InTextImage','list:reference Images')
 )

 Right now I got no clue how I should start to solve the problem. 
 I want to do this because one article could have like 10 pictures and 
 would completly fill the list of new images.



-- 





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

2013-01-25 Thread Arnon Marcus
I am deploying on VMs that are relatively easy to clone, so I opted for
separate servers for redmine and web2py, for performance and security. I
obviously also separated the database to be on its own server. Since it's
all VMs on the same physical machine, the virtual-network is really fast,
and since every VM uses its own set of hard-drive space, its own memory
space, and its own CPU core, they can all run concurrently, even in single
threaded cases. Security comes from each only having the services they each
require and nothing more (so no python in the redmine or postgres servers,
no ruby on the web2py or postgres servers, etc.)

As for old-version of web2py, I am actually not kidding.
We have a web2py application that we've been working on for 3 years now,
and moving that to the new web2py version revealed itself to be non-trivial.
Backward compatibility is apparently not as well adhered to as we would
expect. I am all for going for the latest and greatest, but we have a
schedule to keep in development, and upgrading web2py is not too much a
priority now... Unless it provides measurable performance benefits, which
it doesn't in our case, from what I briefly tested.


On Thu, Jan 24, 2013 at 7:01 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 I will look at Niphold changes and update my script when I get time. I
 have no intention to port the w2p-redmine script to CentOS. I would not put
 redmine and web2py on 2 differents servers, I would put all the web app on
 one server (one html server) and the database on an other server. But that
 is fancy stuff and the script will not integrate that since it only help
 deploy faster with a basic config that you should adapt to your particular
 needs.

 Old version of web2py are you kinding me or what?!

 Richard


 On Thu, Jan 24, 2013 at 7:12 PM, Arnon Marcus a.m.mar...@gmail.comwrote:

 Great to see this coming along !

 Few questions:

 1. Would it be moduralized enough to separate the redmine and web2py
 parts?
 2. if not, can I use it on 2 servers, and then remove redmine in one and
 web2py on the other?
 3. Does this supports older web2py versions (say, 1.8) ?
 4. Can somebody port this to CentOS ? Is there a CentOS expert in this
 group?


 On Thursday, January 24, 2013 12:40:18 PM UTC-8, Niphlod wrote:

 ok, made it more modular, and now web2py config for uwsgi is in
 ini-style (far more readable).
 If you come from previous script, before executing this please delete
 /etc/uwsgi/web2py.xml . the new /etc/uwsgi/web2py.ini will be created with
 the exact same options.

 thanks Paolo, patch attached.

  --





  --





-- 





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

2013-01-25 Thread Arnon Marcus
Is there a benefit for using nginx as rps for apache?
What are the pros/cons for such an arrangement over uwsgi ?


On Fri, Jan 25, 2013 at 4:36 AM, Arnon Marcus a.m.mar...@gmail.com wrote:

 I am deploying on VMs that are relatively easy to clone, so I opted for
 separate servers for redmine and web2py, for performance and security. I
 obviously also separated the database to be on its own server. Since it's
 all VMs on the same physical machine, the virtual-network is really fast,
 and since every VM uses its own set of hard-drive space, its own memory
 space, and its own CPU core, they can all run concurrently, even in single
 threaded cases. Security comes from each only having the services they each
 require and nothing more (so no python in the redmine or postgresservers, no
 ruby on the web2py or postgres servers, etc.)

 As for old-version of web2py, I am actually not kidding.
 We have a web2py application that we've been working on for 3 years now,
 and moving that to the new web2py version revealed itself to be non-trivial.
 Backward compatibility is apparently not as well adhered to as we would
 expect. I am all for going for the latest and greatest, but we have a
 schedule to keep in development, and upgrading web2py is not too much a
 priority now... Unless it provides measurable performance benefits, which
 it doesn't in our case, from what I briefly tested.


 On Thu, Jan 24, 2013 at 7:01 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I will look at Niphold changes and update my script when I get time. I
 have no intention to port the w2p-redmine script to CentOS. I would not put
 redmine and web2py on 2 differents servers, I would put all the web app on
 one server (one html server) and the database on an other server. But that
 is fancy stuff and the script will not integrate that since it only help
 deploy faster with a basic config that you should adapt to your particular
 needs.

 Old version of web2py are you kinding me or what?!

 Richard


 On Thu, Jan 24, 2013 at 7:12 PM, Arnon Marcus a.m.mar...@gmail.comwrote:

 Great to see this coming along !

 Few questions:

 1. Would it be moduralized enough to separate the redmine and web2py
 parts?
 2. if not, can I use it on 2 servers, and then remove redmine in one
 and web2py on the other?
 3. Does this supports older web2py versions (say, 1.8) ?
 4. Can somebody port this to CentOS ? Is there a CentOS expert in this
 group?


 On Thursday, January 24, 2013 12:40:18 PM UTC-8, Niphlod wrote:

 ok, made it more modular, and now web2py config for uwsgi is in
 ini-style (far more readable).
 If you come from previous script, before executing this please delete
 /etc/uwsgi/web2py.xml . the new /etc/uwsgi/web2py.ini will be created with
 the exact same options.

 thanks Paolo, patch attached.

  --





  --







-- 





[web2py] auth.wiki how to format all fields

2013-01-25 Thread Paolo valleri
Dear all, I've just came across the fact that with the following code:
def wiki():
return auth.wiki(render='html')
and visiting something like app/controller/wiki/about
in the view I will get only the 'content' field without any 
other useful wiki's field such as Title, modified_on just to name a few.
Checking the code, I figured out that the problem is due to the test: 
 extension==html (see tools.py:5090)
Could we return the other fields too?

Paolo

-- 





[web2py] Re: How do I use web2py to make a simple GUI?

2013-01-25 Thread Dirk Krause
my two cents:
as long as you don't need web services (and you don't if I understood you 
correctly) you are probably better off with a JavaScript framework without 
a server component (i.e. without web2py).

The AngularJS framework is one of many frameworks that come with good 
documentation. I'd recommend digging into these examples, if you want to go 
this way:
http://rabidgadfly.com/2012/12/angularjs-simple-calculator/
The example there also works on mobile devices.
Also: http://docs.angularjs.org/tutorial/


Am Mittwoch, 23. Januar 2013 22:27:22 UTC+1 schrieb Kaare Mikkelsen:

 Hi, the answer to this question may well be that I should leave web2py 
 alone and use something else, so I had better start explaining what I'm 
 trying to do. I'm sorry if my post comes across as long-winded, feel free 
 to skip to the question at the bottom:

 I want to make a small app for a special, quite simple, calculation that I 
 do fairly often. I thought it would be a good exercise to learn how to make 
 this as a web-application (rather than digging into how to make apps for my 
 smartphone OS) that I could use through the browser on my phone. I'm 
 reasonably comfortable with programming, and getting better at python 
 (though I must say I'm still more comfortable with Matlab and c++). So, 
 really, first I just need to make input fields, a go-button, and 
 preferably learn how to accommodate different display sizes. Later, 
 naturally, there is a range of features that could be fun to tackle.

 But, when reading the online book, it seems the focus is on very different 
 things, with much more advanced functionality than what I need. Somehow I 
 feel there should be a bit more detail between hello world and making my 
 own wiki. I have read the Overview thoroughly, and bits and pieces of the 
 rest.

 I found web2py from googling how to use python to build a web application, 
 which lead me to django, which lead to comparisons of web2py and django, 
 leading me to think that this was the more beginner-friendly tool.

 QUESTION:
 Is there a place where I can learn about making input forms (animating the 
 buttons, defining what happens when they're clicked etc.), either from 
 scratch or a general class? I have no experience with html, but of course I 
 am expecting to have to get familiar with that as well. Are these simple 
 objects things one should be comfortable with before tackling advanced 
 tools such as web2py? (if so, how?)

 I hope the above wasn't too long, and that someone can point me in the 
 right direction :)


-- 





Re: [web2py] Re: How do I use web2py to make a simple GUI?

2013-01-25 Thread Alec Taylor
On Fri, Jan 25, 2013 at 1:59 AM, Alan Etkin spame...@gmail.com wrote:
 Hi, the answer to this question may well be that I should leave web2py
 alone and use something else, so I had better start


 Note that there's a special mobile plugin for web2py. See the instructions
 at web2py dev server/admin/plugin_jqmobile/about

 --




Hi Alan,

That mobile thing is interesting, but have you noticed that 'edit' doesn't work?

Also does that provide a mechanism for generating files that I can
then package into a PhoneGap app?

-- 





[web2py] web2py and PhoneGap — Do we really have to completely rewrite our views in e.g.: AngularJS?

2013-01-25 Thread Alec Taylor
I have written all my models, controllers and views in web2py.

Now I am refactoring my various apps as services. So the controllers
will expose the model as JSON and handle any input JSON; and my
AngularJS app consumes the service.

This leaves me without form generation+manipulation and without
authentication (hacky solutions do exist though).

For PhoneGap, do I really have to rewrite my views in e.g.: AngularJS?

Thanks for all suggestions,

Alec Taylor

PS: One solution is iframe, but I found that to be very slow and
lacking history and [most] storage related features. Another solution
would be to write some JavaScript to grab the initial homepage; and
let web2py take over from there, however I doubt that'll work nicely.

PPS: Perhaps a script to generate the relevant web2py view components
as HTML+JS could be arranged?

-- 





Re: [web2py] Re: Auth with migrate=False

2013-01-25 Thread paolo.vall...@gmail.com
Hi Massimo, just wondering if you have found something better for this.
Paolo


2013/1/17 Massimo Di Pierro massimo.dipie...@gmail.com

 Me neither. Let's think of a solution on web2py_developers.


 On Wednesday, 16 January 2013 01:59:27 UTC-6, Paolo valleri wrote:

 Hi Massimo, personally I don't like this:

 db._LAZY_TABLES['**yourtablename'][2]['on_define'**] = 

 it is neither easy to remember nor easy to understand what it dows.
 Something more friendly would be better from my point of view, If adding an
 on_define could create misunderstanding since the parameter is different
 from the 'common' on_define, we could use an other totally fresh name,
 i.e., auth.set_settings, auth.customize and so on to do the same thing.

 --
  Paolo

  --







-- 
 Paolo

-- 





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

2013-01-25 Thread Richard Vézina
The only benefit I see nginx over apache from my reading, is that nginx
memory usage and cpu usage will not grow that much even if you add massive
number of users since Nginx is event-based it doesn't need to spawn new
processes or threads for each request, so its memory usage is very low

http://www.wikivs.com/wiki/Apache_vs_nginx

Richard


On Fri, Jan 25, 2013 at 9:08 AM, Arnon Marcus a.m.mar...@gmail.com wrote:

 Is there a benefit for using nginx as rps for apache?
 What are the pros/cons for such an arrangement over uwsgi ?


 On Fri, Jan 25, 2013 at 4:36 AM, Arnon Marcus a.m.mar...@gmail.comwrote:

 I am deploying on VMs that are relatively easy to clone, so I opted for
 separate servers for redmine and web2py, for performance and security. I
 obviously also separated the database to be on its own server. Since it's
 all VMs on the same physical machine, the virtual-network is really fast,
 and since every VM uses its own set of hard-drive space, its own memory
 space, and its own CPU core, they can all run concurrently, even in single
 threaded cases. Security comes from each only having the services they each
 require and nothing more (so no python in the redmine or postgresservers, no
 ruby on the web2py or postgres servers, etc.)

 As for old-version of web2py, I am actually not kidding.
 We have a web2py application that we've been working on for 3 years now,
 and moving that to the new web2py version revealed itself to be non-trivial.
 Backward compatibility is apparently not as well adhered to as we would
 expect. I am all for going for the latest and greatest, but we have a
 schedule to keep in development, and upgrading web2py is not too much a
 priority now... Unless it provides measurable performance benefits, which
 it doesn't in our case, from what I briefly tested.


 On Thu, Jan 24, 2013 at 7:01 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 I will look at Niphold changes and update my script when I get time. I
 have no intention to port the w2p-redmine script to CentOS. I would not put
 redmine and web2py on 2 differents servers, I would put all the web app on
 one server (one html server) and the database on an other server. But that
 is fancy stuff and the script will not integrate that since it only help
 deploy faster with a basic config that you should adapt to your particular
 needs.

 Old version of web2py are you kinding me or what?!

 Richard


 On Thu, Jan 24, 2013 at 7:12 PM, Arnon Marcus a.m.mar...@gmail.comwrote:

 Great to see this coming along !

 Few questions:

 1. Would it be moduralized enough to separate the redmine and web2py
 parts?
 2. if not, can I use it on 2 servers, and then remove redmine in one
 and web2py on the other?
 3. Does this supports older web2py versions (say, 1.8) ?
 4. Can somebody port this to CentOS ? Is there a CentOS expert in this
 group?


 On Thursday, January 24, 2013 12:40:18 PM UTC-8, Niphlod wrote:

 ok, made it more modular, and now web2py config for uwsgi is in
 ini-style (far more readable).
 If you come from previous script, before executing this please delete
 /etc/uwsgi/web2py.xml . the new /etc/uwsgi/web2py.ini will be created with
 the exact same options.

 thanks Paolo, patch attached.

  --





  --






  --





-- 





Re: [web2py] Re: web2py 2.0 DAL no longer usable for mysql stored procedures

2013-01-25 Thread Angelo Compagnucci
Hi Massimo,

I think this is a real problem.

In a web2py shell you can do:

rows = db.executesql(select * from charts)

but you cannot do:

rows = db.executesql(select * from charts; select * from charts;)

it raises the error above.

I think the problem is related to multiple resultsets. That example query
return 2 resultset, as well a stored procedure could return multiple
resultset. I think web2py mess something when a multiquery or a stored
procudere returns more than one resultset.


Mysql user guide says here (
http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html):

If you get Commands out of sync; you can't run this command now in your
client code, you are calling client functions in the wrong order.

This can happen, for example, if you are using
mysql_use_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html
and
try to execute a new query before you have called
mysql_free_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-free-result.html.
It can also happen if you try to execute two queries that return data
without calling
mysql_use_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html
 or 
mysql_store_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-store-result.html
in
between.



2012/9/28 Yarin ykess...@gmail.com

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


 On Thursday, September 27, 2012 4:33:37 PM UTC-4, Massimo Di Pierro wrote:

 Is this issue still open? If so, can you open a ticket about it?

 Massimo

 On Monday, 24 September 2012 14:38:14 UTC-5, Yarin wrote:



 db.py:
 db.define_table('mytable',Fiel**d('myfield','string'))

 sproc:
 DELIMITER //
 CREATE PROCEDURE TestSproc()
   BEGIN
   SELECT COUNT(*) FROM mytable;
   END //
 DELIMITER;

 tests.py
 NOTE: Tests 1-3 will fail every time in wsgi/linux environments.
 From the web2py command line, they will work once, until another
 operation is called on the db, INCLUDING commit().

 In web2py 1, you can run these once successfully, but subsequent sql
 operations on the current connection return None results.
 

 def test_1():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant
 run this command now) '''

  sql = '''CALL TestSproc();'''
  results = db.executesql(sql, as_dict=True)
  return str(results)

 def test_2():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant
 run this command now) '''

  sql = CALL TestSproc();
  results = db.executesql(sql, as_dict=True)
  db.commit()
  return str(results)

 def test_3():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant
 run this command now) '''

  sql = CALL TestSproc();
  db._adapter.execute(sql)
  results = db._adapter.cursor.fetchall()
  return str(results)

 def test_4():
  ''' RESULT: Works '''

  import contrib.pymysql as pymysql
  sql = CALL TestSproc();
  conn = pymysql.connect(host='127.0.0.**1', port=3306, user='root',passwd
 ='root', db='test')
  cur = conn.cursor(pymysql.cursors.Di**ctCursor)
  cur.execute(sql)
  results = cur.fetchall()
  cur.close()
  conn.close()
  return str(results)





 On Monday, September 24, 2012 1:10:14 PM UTC-4, Massimo Di Pierro wrote:

 can you show us some of your code. This may be a concurrency issues. I
 cannot thing anything we change that would affect the behavior.

 On Sunday, 23 September 2012 22:43:28 UTC-5, Yarin wrote:

 After upgrading to web2py 2.0, we can no longer use the DAL or mysql
 adapters to make MySQL stored procedure calls.

 In web2py 1.x I had 
 reportedhttps://groups.google.com/d/msg/web2py/VaGJjwE3eYQ/GPa3xRe-HVsJhow
  mysql stored procedures weren't working for us in certain
 circumstances- however we were able to circumvent those issues by simply
 creating a new DAL instance everytime we had to call a sproc. With the new
 DAL, that's no longer an option- indeed, any call to a stored procedure
 seems to fail in any attempt through the DAL or mysql adapter.

- Fails with both pymysql and mysqldb drivers
- Fails when calling commit() immediately after
- We did side-by-side comparisons with web2py 1.x on same server,
pointing to same db, and confirmed this fails only in 2.0
- You can make sproc calls using the DAL straight from the web2py
shell, but only if you don't call commit.


 Stack trace:


 Traceback (most recent call last):
   File /opt/web-apps/web2py/gluon/**main.py, line 580, in wsgibase

 BaseAdapter.close_all_**instances('rollback')
   File /opt/web-apps/web2py/gluon/**dal.py, line 511, in 
 close_all_instances

 getattr(instance, action)()
   File /opt/web-apps/web2py/gluon/**dal.py, line 1633, in rollback

 return self.connection.rollback()
 ProgrammingError: (2014, Commands out of sync; you can't run this 
 command now)



 Right now the only option we've arrive at is to make sproc calls
 directly through the pymysql driver API, one per connection.


  --







-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

-- 





Re: [web2py] Re: web2py 2.0 DAL no longer usable for mysql stored procedures

2013-01-25 Thread Massimo Di Pierro
True. For now you need to separate calls to db.executesql if you have 
multiple queries.

On Friday, 25 January 2013 11:54:18 UTC-6, AngeloC wrote:

 Hi Massimo,

 I think this is a real problem.

 In a web2py shell you can do:

 rows = db.executesql(select * from charts)

 but you cannot do:

 rows = db.executesql(select * from charts; select * from charts;)

 it raises the error above.

 I think the problem is related to multiple resultsets. That example query 
 return 2 resultset, as well a stored procedure could return multiple 
 resultset. I think web2py mess something when a multiquery or a stored 
 procudere returns more than one resultset.


 Mysql user guide says here (
 http://dev.mysql.com/doc/refman/5.0/en/commands-out-of-sync.html):

 If you get Commands out of sync; you can't run this command now in your 
 client code, you are calling client functions in the wrong order.

 This can happen, for example, if you are using 
 mysql_use_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html
  and 
 try to execute a new query before you have called 
 mysql_free_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-free-result.html.
  
 It can also happen if you try to execute two queries that return data 
 without calling 
 mysql_use_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-use-result.html
  or 
 mysql_store_result()http://dev.mysql.com/doc/refman/5.0/en/mysql-store-result.html
  in 
 between.



 2012/9/28 Yarin ykes...@gmail.com javascript:

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


 On Thursday, September 27, 2012 4:33:37 PM UTC-4, Massimo Di Pierro wrote:

 Is this issue still open? If so, can you open a ticket about it?

 Massimo

 On Monday, 24 September 2012 14:38:14 UTC-5, Yarin wrote:



 db.py:
 db.define_table('mytable',Fiel**d('myfield','string'))

 sproc:
 DELIMITER //
 CREATE PROCEDURE TestSproc()
   BEGIN
   SELECT COUNT(*) FROM mytable;
   END //
 DELIMITER;

 tests.py
 NOTE: Tests 1-3 will fail every time in wsgi/linux environments. 
 From the web2py command line, they will work once, until another 
 operation is called on the db, INCLUDING commit().

 In web2py 1, you can run these once successfully, but subsequent sql 
 operations on the current connection return None results.
 

 def test_1():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant 
 run this command now) '''
  
  sql = '''CALL TestSproc();'''
  results = db.executesql(sql, as_dict=True)
  return str(results)
  
 def test_2():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant 
 run this command now) '''
  
  sql = CALL TestSproc();
  results = db.executesql(sql, as_dict=True)
  db.commit()
  return str(results)
  
 def test_3():
  ''' RESULT: ProgrammingError: (2014, Commands out of sync; you cant 
 run this command now) '''
  
  sql = CALL TestSproc();
  db._adapter.execute(sql)
  results = db._adapter.cursor.fetchall()
  return str(results)
  
 def test_4():
  ''' RESULT: Works '''
  
  import contrib.pymysql as pymysql
  sql = CALL TestSproc();
  conn = pymysql.connect(host='127.0.0.**1', port=3306, user='root',passwd
 ='root', db='test')
  cur = conn.cursor(pymysql.cursors.Di**ctCursor)
  cur.execute(sql)
  results = cur.fetchall()
  cur.close()
  conn.close()
  return str(results)



  

 On Monday, September 24, 2012 1:10:14 PM UTC-4, Massimo Di Pierro wrote:

 can you show us some of your code. This may be a concurrency issues. I 
 cannot thing anything we change that would affect the behavior.

 On Sunday, 23 September 2012 22:43:28 UTC-5, Yarin wrote:

 After upgrading to web2py 2.0, we can no longer use the DAL or mysql 
 adapters to make MySQL stored procedure calls.

 In web2py 1.x I had 
 reportedhttps://groups.google.com/d/msg/web2py/VaGJjwE3eYQ/GPa3xRe-HVsJhow
  mysql stored procedures weren't working for us in certain 
 circumstances- however we were able to circumvent those issues by simply 
 creating a new DAL instance everytime we had to call a sproc. With the 
 new 
 DAL, that's no longer an option- indeed, any call to a stored procedure 
 seems to fail in any attempt through the DAL or mysql adapter. 

- Fails with both pymysql and mysqldb drivers
- Fails when calling commit() immediately after
- We did side-by-side comparisons with web2py 1.x on same server, 
pointing to same db, and confirmed this fails only in 2.0 
- You can make sproc calls using the DAL straight from the web2py 
shell, but only if you don't call commit. 


 Stack trace:

 Traceback (most recent call last):
   File /opt/web-apps/web2py/gluon/**main.py, line 580, in wsgibase


 BaseAdapter.close_all_**instances('rollback')
   File /opt/web-apps/web2py/gluon/**dal.py, line 511, in 
 close_all_instances


 getattr(instance, action)()
   File /opt/web-apps/web2py/gluon/**dal.py, line 1633, in rollback


 return self.connection.rollback()
 ProgrammingError: (2014, Commands out of sync; you can't run this 
 

[web2py] Re: auth.wiki how to format all fields

2013-01-25 Thread Alan Etkin


 Dear all, I've just came across the fact that with the following code:


A workaround:

(in the model)
auth.wiki(resolve=False)
page = db(db.wiki_page.slug==request.function).select().first()

(in the view)
{{=page.title}}

-- 





[web2py] Re: web2py and PhoneGap — Do we really have to completely rewrite our views in e.g.: AngularJS?

2013-01-25 Thread Alan Etkin
 So the controllers 
 will expose the model as JSON and handle any input JSON; and my 
 AngularJS app consumes the service. 

For exposing the model, there's a proposal for new dal methods here
http://code.google.com/p/web2py/issues/detail?id=1301

A working prototype for testing:
http://www.web2pyslices.com/slice/show/1592/exposing-a-db-model-for-client-side-processing

-- 





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

2013-01-25 Thread Arnon Marcus
Yeah, I already know that, I was asking something else:
You can have a hybrid setup of Apache +nginx, where nginx is hosting apache as
a reverse-proxy. According to what I read, this kind of setup is very
common, especially for php servers, as the php processing that apache
 operates is single-threaded, and so apache becomes a bottleneck without a
reverse-proxy hosting it. Once you add-in something like nginx in front of
it, then now the php processing will not be blocking the process of the
hosted session, and will run in parallel to it.
Now, I'm by far not a technical expert on these issues, but I am very good
at conceptualized understanding of performance.
My question was referring to the way nginx would handle the web2py
processes via uwsgi, and how it would compare to the php case, if/when an
apache server is plugged-in between nginx and web2py.
I hope my question is clearer now.

-- 





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

2013-01-25 Thread Arnon Marcus
My second question, was basically to get a vibe for the pros/cons of this
hybrid setup vs. the plain and pure vanilla setup that this script
probably generates.


On Fri, Jan 25, 2013 at 12:08 PM, Arnon Marcus a.m.mar...@gmail.com wrote:

 Yeah, I already know that, I was asking something else:
 You can have a hybrid setup of Apache +nginx, where nginx is hosting
 apache as a reverse-proxy. According to what I read, this kind of setup
 is very common, especially for php servers, as the php processing that
 apache   operates is single-threaded, and so apache becomes a bottleneck
 without a reverse-proxy hosting it. Once you add-in something like nginxin 
 front of it, then now the
 php processing will not be blocking the process of the hosted session,
 and will run in parallel to it.
 Now, I'm by far not a technical expert on these issues, but I am very good
 at conceptualized understanding of performance.
 My question was referring to the way nginx would handle the web2py
 processes via uwsgi, and how it would compare to the php case, if/when an
 apache server is plugged-in between nginx and web2py.
 I hope my question is clearer now.


-- 





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

2013-01-25 Thread Niphlod
seems you missed a point uwsgi here is not a module, is an executable 
that does one job and it does it well (actually, very well, and there's a 
lot of it that can be used that is outside the scope of this script). 
It could be used as a standalone highperformance webserver, but nginx is 
placed in front of it to serve static files and to take care of Ddos 
attacks.

If you want to use apache behind nginx instead of uwsgi behind nginx you're 
going basically to suffer wasted cpu, ram, a much harder to maintain 
config. 
If you want to run python on apache because it's your default webserver, 
than mod_wsgi is the way to go. Have to install apache just to run python, 
it's only a waste of resources.

-- 





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

2013-01-25 Thread Arnon Marcus
10x for clearing things out - you're right, I didn't do too much resource
on uwsgi, and just assumed that it is, for nginx. what mod_wsgi is for
apache.
So I guess I had it wrong.
My current (soon to be old) setup is running apache + mod_wsgi on windows
7, so I know all about the headaches that comes from setting this up...
I would be more than glad to put apache behind me for good, if it would
offer not performance improvements to this script's setup the way it does
for php...

On that note, how exactly is uwsgi handling web2py processes, as would be
configured in this script? Is it easily customizable after the fact?
Are there any any pros/cons for different scenarios that one should be
aware of?



On Fri, Jan 25, 2013 at 12:21 PM, Niphlod niph...@gmail.com wrote:

 seems you missed a point uwsgi here is not a module, is an executable
 that does one job and it does it well (actually, very well, and there's a
 lot of it that can be used that is outside the scope of this script).
 It could be used as a standalone highperformance webserver, but nginx is
 placed in front of it to serve static files and to take care of Ddos
 attacks.

 If you want to use apache behind nginx instead of uwsgi behind nginx
 you're going basically to suffer wasted cpu, ram, a much harder to maintain
 config.
 If you want to run python on apache because it's your default webserver,
 than mod_wsgi is the way to go. Have to install apache just to run python,
 it's only a waste of resources.

 --





-- 





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

2013-01-25 Thread Arnon Marcus
Oh, and what about memcache?
Can web2py benefit from it? Is there somewhere an explanation about this?


On Fri, Jan 25, 2013 at 12:48 PM, Arnon Marcus a.m.mar...@gmail.com wrote:

 10x for clearing things out - you're right, I didn't do too much resource
 on uwsgi, and just assumed that it is, for nginx. what mod_wsgi is for
 apache.
 So I guess I had it wrong.
 My current (soon to be old) setup is running apache + mod_wsgi on
 windows 7, so I know all about the headaches that comes from setting this
 up...
 I would be more than glad to put apache behind me for good, if it would
 offer not performance improvements to this script's setup the way it does
 for php...

 On that note, how exactly is uwsgi handling web2py processes, as would be
 configured in this script? Is it easily customizable after the fact?
 Are there any any pros/cons for different scenarios that one should be
 aware of?



 On Fri, Jan 25, 2013 at 12:21 PM, Niphlod niph...@gmail.com wrote:

 seems you missed a point uwsgi here is not a module, is an executable
 that does one job and it does it well (actually, very well, and there's a
 lot of it that can be used that is outside the scope of this script).
 It could be used as a standalone highperformance webserver, but nginx is
 placed in front of it to serve static files and to take care of Ddos
 attacks.

 If you want to use apache behind nginx instead of uwsgi behind nginx
 you're going basically to suffer wasted cpu, ram, a much harder to maintain
 config.
 If you want to run python on apache because it's your default webserver,
 than mod_wsgi is the way to go. Have to install apache just to run python,
 it's only a waste of resources.

 --







-- 





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

2013-01-25 Thread Paolo valleri
I am using memcached for caching cache.ram and cache.disk, the 
configuration is really easy, this is mine:
if not request.is_local:
from gluon.contrib.memcache import MemcacheClient
memcache_servers = ['127.0.0.1:11211']
cache.memcache = MemcacheClient(request, memcache_servers)
cache.ram = cache.disk = cache.memcache
but I don't know how to understand the gain of using it. Any idea?

paolo

On Friday, January 25, 2013 9:51:22 PM UTC+1, Arnon Marcus wrote:

 Oh, and what about memcache?
 Can web2py benefit from it? Is there somewhere an explanation about this?


 On Fri, Jan 25, 2013 at 12:48 PM, Arnon Marcus 
 a.m.m...@gmail.comjavascript:
  wrote:

 10x for clearing things out - you're right, I didn't do too much resource 
 on uwsgi, and just assumed that it is, for nginx. what mod_wsgi is for 
 apache.
 So I guess I had it wrong.
 My current (soon to be old) setup is running apache + mod_wsgi on 
 windows 7, so I know all about the headaches that comes from setting this 
 up...
 I would be more than glad to put apache behind me for good, if it would 
 offer not performance improvements to this script's setup the way it does 
 for php...

 On that note, how exactly is uwsgi handling web2py processes, as would 
 be configured in this script? Is it easily customizable after the fact?
 Are there any any pros/cons for different scenarios that one should be 
 aware of?



 On Fri, Jan 25, 2013 at 12:21 PM, Niphlod nip...@gmail.com javascript:
  wrote:

 seems you missed a point uwsgi here is not a module, is an 
 executable that does one job and it does it well (actually, very well, and 
 there's a lot of it that can be used that is outside the scope of this 
 script). 
 It could be used as a standalone highperformance webserver, but nginx is 
 placed in front of it to serve static files and to take care of Ddos 
 attacks.

 If you want to use apache behind nginx instead of uwsgi behind nginx 
 you're going basically to suffer wasted cpu, ram, a much harder to maintain 
 config. 
 If you want to run python on apache because it's your default webserver, 
 than mod_wsgi is the way to go. Have to install apache just to run python, 
 it's only a waste of resources.

 -- 
  
  
  





-- 





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

2013-01-25 Thread Arnon Marcus
Well, the way I currently understand this, is as follows:
Web2py uses execfile for most of it's work (models, controllers and views),
so no reload() is needed in production whenever a file get's modified.
The flip-side of this, is that there can be no cache in these module-files.
Then the ram/disk cache is for getting from these executed-modules to the
python process running web2py. But this is still assuming that there is a
single process. If nginx/uwsgi launches multiple processes of web2py, than
this cache will no longer be helpful - each time a process is launched, the
cache would have to be re-populated - this could mostly mean doing database
queries. That's a very bad thing for performance.
I don't know about web2py's implementation of memcached or about
memcacheat all, but I guess
its meant for solving that issue, right?


On Fri, Jan 25, 2013 at 1:00 PM, Paolo valleri paolo.vall...@gmail.comwrote:

 I am using memcached for caching cache.ram and cache.disk, the
 configuration is really easy, this is mine:
 if not request.is_local:
 from gluon.contrib.memcache import MemcacheClient
 memcache_servers = ['127.0.0.1:11211']
 cache.memcache = MemcacheClient(request, memcache_servers)
 cache.ram = cache.disk = cache.memcache
 but I don't know how to understand the gain of using it. Any idea?

 paolo


 On Friday, January 25, 2013 9:51:22 PM UTC+1, Arnon Marcus wrote:

 Oh, and what about memcache?
 Can web2py benefit from it? Is there somewhere an explanation about this?


 On Fri, Jan 25, 2013 at 12:48 PM, Arnon Marcus a.m.m...@gmail.comwrote:

 10x for clearing things out - you're right, I didn't do too much
 resource on uwsgi, and just assumed that it is, for nginx. whatmod_wsgi is 
 for
 apache.
 So I guess I had it wrong.
 My current (soon to be old) setup is running apache + mod_wsgi on
 windows 7, so I know all about the headaches that comes from setting this
 up...
 I would be more than glad to put apache behind me for good, if it would
 offer not performance improvements to this script's setup the way it does
 for php...

 On that note, how exactly is uwsgi handling web2py processes, as would
 be configured in this script? Is it easily customizable after the fact?
 Are there any any pros/cons for different scenarios that one should be
 aware of?



 On Fri, Jan 25, 2013 at 12:21 PM, Niphlod nip...@gmail.com wrote:

 seems you missed a point uwsgi here is not a module, is an
 executable that does one job and it does it well (actually, very well, and
 there's a lot of it that can be used that is outside the scope of this
 script).
 It could be used as a standalone highperformance webserver, but nginx
 is placed in front of it to serve static files and to take care of Ddos
 attacks.

 If you want to use apache behind nginx instead of uwsgi behind nginx
 you're going basically to suffer wasted cpu, ram, a much harder to maintain
 config.
 If you want to run python on apache because it's your default
 webserver, than mod_wsgi is the way to go. Have to install apache just to
 run python, it's only a waste of resources.

 --






  --





-- 





[web2py] Detect change in sqlform.grid

2013-01-25 Thread Keith Edmunds
I have a SQLFORM.grid, and I hook into edits with 'onupdate'.

Is there an easy way to tell which field(s) have been edited? It seems
that by the time onupdate is called, the database has already been
updated, so comparing the form record with the db shows no differences.

Thanks.
-- 
We're looking for smart Linux people:
http://www.tiger-computing.co.uk/jobs/linux-support-consultant/

-- 





[web2py] Re: error in alwaydata ?

2013-01-25 Thread samuel bonilla

thanks alan, is perfect, but the password admin 
El miércoles, 23 de enero de 2013 20:51:32 UTC-5, samuel bonilla escribió:

 i am trying this command in alwaysdata hosting with ssh, for up my web2py 
 application, but i get this error:

 http://forum.alwaysdata.com/viewtopic.php?id=1859

 chmod +x web2py/web2py.fcgi
 chmod: cannot acess 'web2py/web2py.fcgi' : no such file or directory


 help me ?


-- 





[web2py] line contains NULL byte

2013-01-25 Thread Alex Glaros
am trying to import CSV file

error states either:

line contains null byte

or

'NoneType' object has no attribute 'type'


there are no null lines in the data.  Here is all of the data:

Adipose Tissue,A specialized form of connective tissue consisting primarily 
of adipocytes -fat cells-- surrounded by a meshwork of collagen 
fibers.,Body Fat


db.define_table('Word5',Field('Wordname','string',notnull=False), Field 
('definition', 'string',notnull=False), Field ('synonyms', 
'string',notnull=False))

Is there any way to force Web2py to accept anything?

thanks,

Alex

-- 





[web2py] Re: Detect change in sqlform.grid

2013-01-25 Thread Massimo Di Pierro
SQLFORM(...).process(...)

takes two callback functions

process(onvalidation=lambda form:, onaccept=lambda form:)

on validation is called when form is submitted, passes validation, and 
before the database is updated.


On Friday, 25 January 2013 17:16:40 UTC-6, backseat wrote:

 I have a SQLFORM.grid, and I hook into edits with 'onupdate'. 

 Is there an easy way to tell which field(s) have been edited? It seems 
 that by the time onupdate is called, the database has already been 
 updated, so comparing the form record with the db shows no differences. 

 Thanks. 
 -- 
 We're looking for smart Linux people: 
 http://www.tiger-computing.co.uk/jobs/linux-support-consultant/ 


-- 





[web2py] Re: Running web2py on Hostgator Shared hosting!

2013-01-25 Thread Timothy McDonald
This is really just a run web2py using apache question if you are using a 
dedicated host. It should be no different from setting it up on a Cent OS 
or RedHat Linux box at home.

On Friday, January 4, 2013 9:06:43 PM UTC-6, Abdiel Cruz Robaina wrote:

 Sorry  revive  so late the post, but I need help, I want to run web2py in 
 a subdomain from a dedicated server in Hostgator, now how make to configure 
 a virtualhost with mod_wsgi ? 
 if anyone has any idea how I would appreciate help
 Thank


--