Re: [web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Johann Spies
On 19 April 2012 04:26, Cliff  wrote:

> Should that not be current.request?
>
>
Yes!  Thanks Cliff.  Well spotted.

Regards
Johann

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


[web2py] can't find logging message in gae admin console

2012-04-18 Thread castanets
Hi,
I deployed a web2py app on gae.
for logging,
*.copied "logging.example.conf" and renamed it to "logging.conf"

*.added myapp to [loggers]
[loggers]
keys=root,rocket,markdown,web2py,rewrite,app,welcome,myapp

*.added [logger_myapp]
[logger_myapp]
level=WARNING
qualname=web2py.app.myapp
handlers=consoleHandler
propagate=0

*.imported logging in controller(default.py)
import logging
logger = logging.getLogger("web2py.app.myapp')
logger.setLevel(logging.WARNING)

*.logged in index():
logger.warn('logging test')

but, I can't find this logging message in gae admin console.
is there something that I missed??

Thanks.



Re: [web2py] Re: Please help me to understand the use of components and ajax in this case

2012-04-18 Thread Johann Spies
On 18 April 2012 17:00, Anthony  wrote:

>
> Three problems:
>
>
Thanks Anthony and Simon.  I have seen the 'return false' in the Web2py
book but this was the first time I have seen an explanation on why that has
to be so.

Anthony, your explanation helped me a lot  while I am busy learning how to
use JQuery and Ajax.

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


Re: [web2py] Web2py templates for HamlPY

2012-04-18 Thread Khalil KHAMLICHI
Doez this means i have to indent my html and javascript with python code?
Just to not use {{pass}}, man thats a lot of work.


Re: [web2py] Re: CPU 210%

2012-04-18 Thread Bruce Wade
isn't loaded but*** required

On Wed, Apr 18, 2012 at 11:00 PM, Bruce Wade  wrote:

> youadworld.com isn't the web2py version yet, http://96.126.99.73 is :D
>
> Just loading the page was causing problems, when sessions in database it
> will just load and load then shows the page that nginx will show if uwsgi
> isn't loaded buy required. Checking all the log files and there were no
> errors. Very confusing as the apache2 version loads without any problems.
>
>
> On Wed, Apr 18, 2012 at 10:54 PM, pbreit  wrote:
>
>> What's your site? YourAdWorld? What's causing the problems, the web site
>> or serving the ads?
>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: CPU 210%

2012-04-18 Thread Bruce Wade
youadworld.com isn't the web2py version yet, http://96.126.99.73 is :D

Just loading the page was causing problems, when sessions in database it
will just load and load then shows the page that nginx will show if uwsgi
isn't loaded buy required. Checking all the log files and there were no
errors. Very confusing as the apache2 version loads without any problems.

On Wed, Apr 18, 2012 at 10:54 PM, pbreit  wrote:

> What's your site? YourAdWorld? What's causing the problems, the web site
> or serving the ads?




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread Khalil KHAMLICHI
I ended up removing this field from my models, since they can accept
defaults at db level, so everyone of my inserts works now.
The problem comes from the fact that the 3d party db was designed wrongly,
I might not face this problem again for years but wouldnt it be wonderful
if theDAL was able to work on those columns without problem?
Just by simply wrapping column names in brackets before creating queries ?
Or the backquote for mysql for example?


[web2py] Re: CPU 210%

2012-04-18 Thread pbreit
What's your site? YourAdWorld? What's causing the problems, the web site or 
serving the ads?

Re: [web2py] CPU 210%

2012-04-18 Thread Roberto De Ioris

> Any ideas what would cause the system to stop working without errors when
> using database sessions?
>

I suggest you to start with a uWSGI config resembling mod_wsgi:

--lazy
--enable-threads

Should be enough, and start with a single process (and a single thread).

If it works (and it should), remove --lazy (in that way you will abuse
fork() cow). And then remove --enable-threads (even if web2py uses threads
in a couple of areas, so i would not remove it)



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


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Any ideas what would cause the system to stop working without errors when
using database sessions?

On Wed, Apr 18, 2012 at 4:08 PM, Bruce Wade  wrote:

> Why I have no idea, there were not errors in any of the logs, the site
> would just not load. However the apache one loaded without a problem. as
> soon as I put it to use the FS again it work.
>
>
> On Wed, Apr 18, 2012 at 4:02 PM, Bruno Rocha wrote:
>
>> why?
>>
>>
>> On Wed, Apr 18, 2012 at 7:24 PM, Bruce Wade  wrote:
>>
>>> After changing sessions to use the database instead of the FS I can no
>>> longer use uwsgi
>>>
>>>
>>> On Wed, Apr 18, 2012 at 3:17 PM, Bruce Wade wrote:
>>>
 I am about to give up on uwsgi. Everything was working, and I pulled
 the latest code now it doesn't work, but my other server with the same code
 works.


 On Wed, Apr 18, 2012 at 2:40 PM, Bruce Wade wrote:

> Thanks for the explanation the error was strange because first I was
> getting permission connecting to the database error I updated that then I
> got that error.
>
> Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi)
> on a load balancer going to add a 3rd nginx + uwsgi
> --
> Regards,
> Bruce
>
>
> On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris 
> wrote:
>
>>
>> > Ok got it running, restarted uwsgi not sure what the issue was.
>> >
>> > However following the guides I my static content isn't being loaded:
>> > http://50.116.6.124
>>
>>
>> The error you got earlier, happens when you do not read the body of
>> the
>> request (for example when you have POST data, but you do not read
>> them).
>> This is how nginx works. You can avoid that (if you do not want to
>> read
>> post data) with --post-buffering  in uWSGI. It is a trick to force
>> uWSGI to blindly read the http body independently by your app.
>>
>> Regarding static files, you have to fight with nginx (uWSGI should
>> only
>> manage the python part)
>>
>> Normally working on the location directives and root/alias options is
>> enough
>>
>> >
>> > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
>> wrote:
>> >
>> >> uwsgi is sure not as easy to get working correctly as apache is.
>> Keep
>> >> getting the following:
>> >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely
>> closed
>> >> connection while reading response header from upstream, client:
>> >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
>> upstream:
>> >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>> >>
>> >>
>> >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
>> >> wrote:
>> >>
>> >>> There are directions for this on book
>> >>> http://web2py.com/books/default/chapter/29/4#session
>> >>>
>> >>> Store session on db or set separate=True
>> >>>
>> >>>
>> >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
>> >>> wrote:
>> >>>
>>  I recommend you to store sessions on db or cache like memcached,
>>  redis... If you are going to run in a load balance, sessions in
>> disk
>>  will
>>  be a problem.
>> 
>> 
>>  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
>>  wrote:
>> 
>> > Currently FS
>> >
>> >
>> > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
>> > wrote:
>> >
>> >> Are you storing sessions in db or FS?
>> >>
>> >> http://zerp.ly/rochacbruno
>> >> Em 18/04/2012 02:18, "Bruce Wade" 
>> escreveu:
>> >>
>> >> Yeah, I am not sure how well web2py can handle load but I am
>> going
>> >> to
>> >>> find out pretty fast. I finished setting up a load balancer
>> today,
>> >>> going to
>> >>> have 3 servers under it running nginx + uwsgi + web2py a
>> single
>> >>> dedicated
>> >>> DB server for now, but figure I am going to need some slave
>> read
>> >>> only
>> >>> servers. The speed at which web2py allows you to develop
>> >>> applications
>> >>> will surpass any load issues, well unless it could only handle
>> >>> 50,000
>> >>> users/per second then that would be a big issue :D
>> >>>
>> >>> My one concern is how good the sticky sessions on linode's
>> >>> nodebalancer works.
>> >>>
>> >>> Regarding uwsgi I have ready time out issues when using it
>> with
>> >>> web2py.
>> >>>
>> >>> --
>> >>> Regards,
>> >>> Bruce
>> >>>
>> >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
>> >>> wrote:
>> >>>
>>  I've never read anything but good things about uwsgi. Django
>> and
>>  Flask both promote it.
>> >>>
>>

[web2py] Re: WARNING:web2py:Mail.send failure:'module' object has no attribute 'SMTP_SSL'

2012-04-18 Thread weheh
After looking at web2py Mail code, it looks like mail.settings.ssl and 
mail.settings.tls are mutually exclusive? So I set mail.settings.ssl = 
False. Still didn't work.

---

After much further testing, I'm concluding that the problem is with the 
mail server not being configured properly. I tried a different mail server 
and was able to get through.


Re: [web2py] Web2py templates for HamlPY

2012-04-18 Thread Bruno Rocha
Excellent!

Can you write a short recipe in http://www.web2pyslices.com explaining how
to use that?

Thank you!

Bruno.

On Sun, Jan 9, 2011 at 11:07 PM, Dane  wrote:

> Hey all, thought you might be interested to know that I just patched a
> project HamlPy, a library for converting a pythonic haml-like syntax
> to django templates/html, to work with web2py templates.
>
> It allows for a less crufty, indentation-based syntax. Because it's
> indentation-based, {{ pass }} is no longer needed to close flow-
> control statements, and blocks are self-closed. Overall I think it's a
> much cleaner and quicker way of creating templates. And if you do want
> to use traditional {{ }} syntax, you can also do that in the .hamlpy
> files and they'll be converted as-is.
>
> https://github.com/danenania/HamlPy
>
> Hope someone gets some use out of this. My first real open source
> effort!




-- 

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


[web2py] pure css skins?

2012-04-18 Thread Massimo Di Pierro
Are you aware of any template/layout/skin system based on one and the same 
html but different CSS/images? Something like zengarden.
It is ok if it is PHP based as long as it is possible to convert one php 
file into HTML and re-use the CSS.


[web2py] Error on web2py book

2012-04-18 Thread Cody Goodman


Going through the web2py book, and noticed an error on this page:

http://web2py.com/books/default/chapter/29/3

def find_by(keyword):
 "finds pages that contain keyword for XML-RPC"
 return db(db.page.title.contains(keyword).select().as_list()


should be:

def find_by(keyword):
 "finds pages that contain keyword for XML-RPC"
 return db(db.page.title.contains(keyword)).select().as_list()


Just thought this might be the best place to get this noticed. If not let me 
know, and I'll use the appropriate means next time.



[web2py] Re: Digitally signed URLs

2012-04-18 Thread pyhead
Thanks Niphlod, adding request works!   The book should be corrected.


[web2py] Re: Web2py templates for HamlPY

2012-04-18 Thread Michael Toomim
This is cool! how do we use it?

On Sunday, January 9, 2011 5:07:28 PM UTC-8, Dane wrote:
>
> Hey all, thought you might be interested to know that I just patched a 
> project HamlPy, a library for converting a pythonic haml-like syntax 
> to django templates/html, to work with web2py templates. 
>
> It allows for a less crufty, indentation-based syntax. Because it's 
> indentation-based, {{ pass }} is no longer needed to close flow- 
> control statements, and blocks are self-closed. Overall I think it's a 
> much cleaner and quicker way of creating templates. And if you do want 
> to use traditional {{ }} syntax, you can also do that in the .hamlpy 
> files and they'll be converted as-is. 
>
> https://github.com/danenania/HamlPy 
>
> Hope someone gets some use out of this. My first real open source 
> effort!



[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Cliff
Should that not be current.request?

On Wednesday, April 18, 2012 5:09:06 AM UTC-4, Johann Spies wrote:
>
> I have the following function in a module.  When I comment out the 'links' 
> it works without a problem, but with the links active I get the error in 
> the subject line:
>
> def artikels(query = None):
> db = current.db
> if not query:
> query = db.akb_articles.id > 0 
>
> links = [lambda row: A(T('show article'), _href = URL(r = request, c = 
> 'default',
>   f = 
> 'show_akb_article',
>   args = row.id
>   ))]
> fields = [db.akb_articles.title, db.akb_articles.primaryauthor,
>   db.akb_articles.authors,
>   db.akb_articles.journal, db.akb_articles.pubyear, db.
> akb_articles.url]
> 
> 
> form = SQLFORM.grid(query,
> fields = fields,
> orderby = db.akb_articles.title,
> maxtextlength = 90,
> editable = False, deletable = False,
> details = False,
> searchable = False,
> links = links,
> ui = 'jquery-ui')
> return form
>
> Why?  
>
> Regards
> Johann
>
>

[web2py] Re: Memory leak in standalone DAL (issue #731), can you please help test?

2012-04-18 Thread Massimo Di Pierro
In order to isolate the problem, let's check if this is a sqlite:memory 
issue. Can you reproduce the problem with sqlite://storage.db ?

On Wednesday, 18 April 2012 17:41:22 UTC-5, nick name wrote:
>
> I can reproduce this problem on both Linux and Windows (have no access to 
> a Mac), and Massimo cannot reproduce this on his Mac. Perhaps something is 
> borked about all my python installations (some site-packages I use or 
> something). Can you help test? Just go into the web2py directory, and start 
> python with the following script (or just start python and paste the script 
> into the python console)
>
> #!/usr/bin/python
> #encoding: utf-8
>
> # get a web2py database environment
> import sys
> sys.path.append('../../')
> from gluon.dal import DAL
>
> while 1:
> mydal = DAL('sqlite:memory')
> sys.stdout.write('.')
> sys.stdout.flush()
> mydal._adapter.close()
>
> For me: memory usage grows at about 20MB/sec, measured with htop on linux 
> and TaskManager on windows. If I wait enough time, all the memory is eaten 
> up. If you drop the last line (mydal._adapter.close()) the memory will be 
> eaten much more quickly for me.
>
> Thanks.
> Issue reference: 731: 
> Standalone DAL is leaking memory+resources (don't know whether or not 
> inside web2py)



Re: [web2py] Re: customized edit for using .smartgrid

2012-04-18 Thread Massimo Di Pierro
Thanks for checking this. I made one more change to trunk that should fix 
it. Please try it again.

BTW. make sure you use grid and not smartgrid.

On Wednesday, 18 April 2012 11:25:07 UTC-5, Jim S wrote:
>
>  Massimo
>
> I updated from trunk today and now I'm getting the following traceback:
>
> Traceback (most recent call last):
>   File "C:\dev\web2py\gluon\restricted.py", line 205, in restricted
> exec ccode in environment
>   File "C:/dev/web2py/applications/InfoCenter/controllers/applications.py" 
> ,
>  line 1711, in 
>   File "C:\dev\web2py\gluon\globals.py", line 175, in 
> self._caller = lambda f: f()
>   File "C:\dev\web2py\gluon\tools.py", line 2670, in f
> return action(*a, **b)
>   File "C:/dev/web2py/applications/InfoCenter/controllers/applications.py" 
> ,
>  line 1704, in railUnloading
> form = grid.create_form
> AttributeError: 'DIV' object has no attribute 'create_form'
>
>
> on creates and 
>
> Traceback (most recent call last):
>   File "C:\dev\web2py\gluon\restricted.py", line 205, in restricted
> exec ccode in environment
>   File "C:/dev/web2py/applications/InfoCenter/controllers/applications.py" 
> ,
>  line 1711, in 
>   File "C:\dev\web2py\gluon\globals.py", line 175, in 
> self._caller = lambda f: f()
>   File "C:\dev\web2py\gluon\tools.py", line 2670, in f
> return action(*a, **b)
>   File "C:/dev/web2py/applications/InfoCenter/controllers/applications.py" 
> ,
>  line 1707, in railUnloading
> form = grid.update_form
> AttributeError: 'DIV' object has no attribute 'update_form'
>
>
> on updates.  This worked with trunk from the 9th.  (although update_form 
> was then edit_form).  Seems like there is something else I need to change 
> to get this functionality back.  Any ideas?
>
> -Jim
>
> On 4/10/2012 11:39 PM, Massimo Di Pierro wrote: 
>
> It actually was renamed update_form in trunk
>
> On Tuesday, 10 April 2012 13:53:47 UTC-5, Jim S wrote: 
>>
>>  In the example below you specify grid.update_form for the edit action.  
>> But, my testing shows that this is actually grid.edit_form.  Should it be 
>> renamed to 'update_form' for consistency with CRUD?
>>
>> -Jim
>>
>> On 4/9/2012 3:58 PM, Massimo Di Pierro wrote: 
>>
>> You should be able to customize the create and edit forms in the same 
>> way: 
>>
>>  {{if grid.create_form:}}
>>{{=grid.create_form}}
>> {{elif grid.update_form:}}
>>{{=grid.update_form}}
>>  {{elif grid.view_form:}}
>>{{=grid.view_form}}
>>  {{else:}}
>>{{=grid}}
>>  {{pass}}
>>
>>  You need the current trunk because I just found an issue about this.
>>
>>  On Monday, 9 April 2012 11:55:24 UTC-5, Jim S wrote: 
>>>
>>> Hi 
>>>
>>> I want to customize the edit form of a .smartgrid the way that you can 
>>> customize SQLFORM forms as specified in the manual under section 7.5.
>>>
>>> Is this possible?  If so, what do I use in place of 
>>> {{=form.custom.begin}}?  How do I reference the form portion of the 
>>> returned grid?
>>>
>>>  -Jim
>>>
>>

Re: [web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread Massimo Di Pierro
At this point we do not support table names and field names that are 
keywords in SQL. In fact the DAL has a parameter 

DAL(..., check_reserved=True)

that will check for you and will prevent you from using the field name 
"order". The check is normally disabled for speed.


On Wednesday, 18 April 2012 10:47:07 UTC-5, Khalil KHAMLICHI wrote:
>
> looks like its a DAL issue, 
>
> The DAL need to include the [ ] by default around column names, I also 
> tested using " " around the columns and it works too.
>
> Hopefully Massimo you will look at this, in the meantime I will try to 
> hack my way in the source files.
>
> here is a code I tested outside w2p : 
>
> con = pyodbc.connect('DRIVER={SQL 
> Server};SERVER=chi-c7269ceba93\\SQLEXPRESS;DATABASE=SambaData2;UID=sa;PWD=sambapos.1234')
> cur = con.cursor()
>
> >>> x = cur.execute('select * from MenuItems')
>
> >>> x = cur.execute('select Id, Order from ScreenMenuCategories')
> Traceback (most recent call last):
>   File "", line 1, in 
> x = cur.execute('select Id, Order from ScreenMenuCategories')
> ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server 
> Driver][SQL Server]Incorrect syntax near the keyword 'Order'. (156) 
> (SQLExecDirectW)")
>
> >>> x = cur.execute('select "Id", "Order" from ScreenMenuCategories')
> >>> for i in x:
> print i
>
> (1, 0)
> (2, 0)
> (3, 0)
> (4, 0)
> (5, 0)
> (6, 0)
> (7, 0)
>
> >>> x = cur.execute('select Id, [Order] from ScreenMenuCategories')
> >>> for i in x:
> print i
>
> (1, 0)
> (2, 0)
> (3, 0)
> (4, 0)
> (5, 0)
> (6, 0)
> (7, 0)
>
>

[web2py] WARNING:web2py:Mail.send failure:'module' object has no attribute 'SMTP_SSL'

2012-04-18 Thread weheh
mail.settings.ssl = True
mail.settings.tls = True
mail.settings.login = True
mail.settings.server = 'server:port'  # your SMTP server
mail.settings.login = 'login:password'  # your credentials
mail.settings.sender = 'm...@server.com'  # your email

This is an SSL mail server. When I try to send an email I get this warning:

WARNING:web2py:Mail.send failure:'module' object has no attribute 'SMTP_SSL'

and the mail isn't sent.


Re: [web2py] Dart - New Google Language

2012-04-18 Thread villas
I don't know too much about node.js but I was dismissing it on the basis 
that JS was fundamentally a light-weight language.  I may be wrong about 
that and the way it will evolve.  For now,  I have it in the next pigeon 
hole to php.  

I long for the time that I will be able to program in a proper IDE (like 
Delphi for the desktop) using proven libraries,  and run my code 
everywhere. I can only see that happening with a VM running in a ubiquitous 
and free browser but then I wonder whether JS can also provide a solid 
codebase for all heavy lifting on the server-side.  

Will developers (and their patrons) really begin to trust JS for all tasks? 
 With the current confusion of libraries and dynamic typing etc,  it seems 
like JS is strongest plant in a weedy pot, but could it really flourish in 
the open garden. I can't quite see it.  

In the meantime,  I have delphi, php, python,  JS,  bash scripting, html, 
css, and sql,  not to mention web2py,  cakephp, and my own (terrible 
in-house) framework, a reporting system, a whole heap of apache and linux 
configurations, and a load of OS, network and database admin and deployment 
scripts clogging up my brain.

I just hope that something like Node.js or Dart can succeed and have a 
proper eco-system of libraries so I can start reducing the number of things 
I'm expected to know so I can concentrate on ranting about other things.



On Wednesday, 18 April 2012 19:11:55 UTC+1, mikech wrote:
>
> Isn't that the goal of Node.js?  I agree Dart is an interesting language, 
> I'm currently following it.  It does seem with efforts like Node.js and 
> Meteor that JS is advancing on both the server and client.
>
>
>>

[web2py] jsonrpc and db insert - do jsonrpc protect database insert?

2012-04-18 Thread Memorysaver
I really appreciate that web2py has a wonderful jsonrpc server, but I have 
a question about implementing a safe remote database insertion. According 
to  http://json-rpc.org/  's specification, jsonrpc has a strict rpc 
protocol to ensure the transaction. However, I don't understand the 
behavior behind this if I use jsonrpc to create a function with db insert. 
For example, I want to create a transaction jsonrpc method to handle the 
invoice record. When the remote side send the data to the jsonrpc server, 
then jsonrpc server will return a response to inform remote side it receive 
the data. Finally, the remote side must send another response to the 
jsonrpc server to close the connection according to the specification. 
Hence, I am wondering what happen if the connection drops when the remote 
side try to send the close response. Do the db transaction roll back if the 
db insert code has executed when the jsonrpc server send the response to 
the remote site or the code actually execute after jsonrpc receive the 
close response from remote side, so that the remote site won't send the 
duplicate transaction ?  or I need to handle the exception in my jsonrpc 
server to roll back the db insert? I hope I explain this correctly 
 Please let me know if my English doesn't make sense to you. I really 
appreciate your answer. Thank you so much!

Re: [web2py] Re: Database design

2012-04-18 Thread Anthony
db.property.property_type.writable = False

Anthony

On Wednesday, April 18, 2012 4:32:02 PM UTC-4, leftcase wrote:
>
> I've put this into the controller to test this out:
>
> def create_newbuild():
> #newbuild and resale properties share the same table.
> #the extraneous fields are rendered non-writable by the below
> db.property.land.writable = False
> db.property.reference_number.writable = False
> db.property.habitable_area.writable = False
> db.property.utilities.writable = False
> db.property.address.writable = False
> db.property.postcode.writable = False
> db.property.land.readable = False
> db.property.reference_number.readable = False
> db.property.habitable_area.readable = False
> db.property.utilities.readable = False
> db.property.address.readable = False
> db.property.postcode.readable = False
> db.property.property_type.default="2" #select the newbuild property 
> type and hide the option from the user
> db.property.property_type.readable = False
> form=SQLFORM(db.property)
> if form.process().accepted:
> response.flash = 'form accepted'
> elif form.errors:
> response.flash = 'form has errors'
> else:
> response.flash = 'please fill out the form'
> return dict(form=form)
>
> Strange thing is though that the property_type field still appears on the 
> form. Any ideas why?
>
> Thank you,
>
> Chris
>
> On Wed, Apr 18, 2012 at 3:43 PM, Chris Rowson  > wrote:
>
>> Thanks for confirming this for me, this did seem to be the most sensible 
>> way to approach the problem :-)
>>
>> Chris
>>
>>
>> On Wed, Apr 18, 2012 at 1:04 AM, simon  wrote:
>>
>>> You can do this with a single form. At the top of the controller set 
>>> readable=false,  writable=false for the fields you do not want on the form.
>>>
>>> On Tuesday, 17 April 2012 23:44:54 UTC+1, leftcase wrote:
>>>
 I'm a new adopter of web2py and I'm trying to learn the framework by 
 building a simple property site. 

 I have two types of properties, new or old. 

 New properties have a few core attributes, let's say name, price, 
 location, bedrooms 

 Old properties have the same core attributes with a few more added on, 
 for instance utilities, land, lease type.

 I've tried making a table for new properties and a table for old 
 properties but it seems to complicate things if I for instance want to 
 list 
 all types of properties (new and old) and order by price (I've been 
 struggling to figure out how to aggregate the results from both tables 
 then 
 order by price).

 Would it make more sense to have one table with all of the fields for 
 new and old properties and simply create two different forms with 
 different 
 fields exposed depending on whether or not the user wants to create a new 
 or an old property?

 Thanks in advance,

 Chris

>>>
>>
>

[web2py] Re: Memory leak in standalone DAL (issue #731), can you please help test?

2012-04-18 Thread Anthony
I can confirm the same behavior with this script on both Ubuntu 12.04 and 
Windows 7 -- both running Python 2.7 and web2py trunk.

Anthony

On Wednesday, April 18, 2012 6:41:22 PM UTC-4, nick name wrote:
>
> I can reproduce this problem on both Linux and Windows (have no access to 
> a Mac), and Massimo cannot reproduce this on his Mac. Perhaps something is 
> borked about all my python installations (some site-packages I use or 
> something). Can you help test? Just go into the web2py directory, and start 
> python with the following script (or just start python and paste the script 
> into the python console)
>
> #!/usr/bin/python
> #encoding: utf-8
>
> # get a web2py database environment
> import sys
> sys.path.append('../../')
> from gluon.dal import DAL
>
> while 1:
> mydal = DAL('sqlite:memory')
> sys.stdout.write('.')
> sys.stdout.flush()
> mydal._adapter.close()
>
> For me: memory usage grows at about 20MB/sec, measured with htop on linux 
> and TaskManager on windows. If I wait enough time, all the memory is eaten 
> up. If you drop the last line (mydal._adapter.close()) the memory will be 
> eaten much more quickly for me.
>
> Thanks.
> Issue reference: 731: 
> Standalone DAL is leaking memory+resources (don't know whether or not 
> inside web2py)



[web2py] Postgres expers -- interesting design issue

2012-04-18 Thread Cliff
There are two tables, as follows:

db.define_table('A', Field('name'))

db.define_table('B', Field('name'), Field('id_from_table_a))

Also there are two applications.  One, called 'both_a_and_b', uses both 
tables and uses 'table_a_id'  as a foreign key in table B.  The other, 
called 'table_b_only' needs CRUD access to the information in table B, but 
it is not able to supply a value for 'id_from_table_a.'

I think because Postgres recognizes foreign key constraints, 'table_b_only' 
will not be able to create records in table B.  

What Is the right solution?

I can think of two.  First, create a third table, C, for all the data that 
'table_b_only' needs.  This table would not have the 'id_from_table_a' 
field.  The other application would need to write also to this table 
whenever it creates a record in table B.

A second possibility might be to define table B this way:
db.define_table('B', 
  Field('name') , 
  Field('id_from_table_a', requires= IS_EMPTY_OR(IS_IN_DB(db, 'A.id', ...)))
)

I would be grateful for any guidance,
Cliff Kachinske


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Why I have no idea, there were not errors in any of the logs, the site
would just not load. However the apache one loaded without a problem. as
soon as I put it to use the FS again it work.

On Wed, Apr 18, 2012 at 4:02 PM, Bruno Rocha  wrote:

> why?
>
>
> On Wed, Apr 18, 2012 at 7:24 PM, Bruce Wade  wrote:
>
>> After changing sessions to use the database instead of the FS I can no
>> longer use uwsgi
>>
>>
>> On Wed, Apr 18, 2012 at 3:17 PM, Bruce Wade  wrote:
>>
>>> I am about to give up on uwsgi. Everything was working, and I pulled the
>>> latest code now it doesn't work, but my other server with the same code
>>> works.
>>>
>>>
>>> On Wed, Apr 18, 2012 at 2:40 PM, Bruce Wade wrote:
>>>
 Thanks for the explanation the error was strange because first I was
 getting permission connecting to the database error I updated that then I
 got that error.

 Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi) on
 a load balancer going to add a 3rd nginx + uwsgi
 --
 Regards,
 Bruce


 On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris wrote:

>
> > Ok got it running, restarted uwsgi not sure what the issue was.
> >
> > However following the guides I my static content isn't being loaded:
> > http://50.116.6.124
>
>
> The error you got earlier, happens when you do not read the body of the
> request (for example when you have POST data, but you do not read
> them).
> This is how nginx works. You can avoid that (if you do not want to read
> post data) with --post-buffering  in uWSGI. It is a trick to force
> uWSGI to blindly read the http body independently by your app.
>
> Regarding static files, you have to fight with nginx (uWSGI should only
> manage the python part)
>
> Normally working on the location directives and root/alias options is
> enough
>
> >
> > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
> wrote:
> >
> >> uwsgi is sure not as easy to get working correctly as apache is.
> Keep
> >> getting the following:
> >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely
> closed
> >> connection while reading response header from upstream, client:
> >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
> upstream:
> >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
> >>
> >>
> >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
> >> wrote:
> >>
> >>> There are directions for this on book
> >>> http://web2py.com/books/default/chapter/29/4#session
> >>>
> >>> Store session on db or set separate=True
> >>>
> >>>
> >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
> >>> wrote:
> >>>
>  I recommend you to store sessions on db or cache like memcached,
>  redis... If you are going to run in a load balance, sessions in
> disk
>  will
>  be a problem.
> 
> 
>  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
>  wrote:
> 
> > Currently FS
> >
> >
> > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
> > wrote:
> >
> >> Are you storing sessions in db or FS?
> >>
> >> http://zerp.ly/rochacbruno
> >> Em 18/04/2012 02:18, "Bruce Wade" 
> escreveu:
> >>
> >> Yeah, I am not sure how well web2py can handle load but I am
> going
> >> to
> >>> find out pretty fast. I finished setting up a load balancer
> today,
> >>> going to
> >>> have 3 servers under it running nginx + uwsgi + web2py a single
> >>> dedicated
> >>> DB server for now, but figure I am going to need some slave
> read
> >>> only
> >>> servers. The speed at which web2py allows you to develop
> >>> applications
> >>> will surpass any load issues, well unless it could only handle
> >>> 50,000
> >>> users/per second then that would be a big issue :D
> >>>
> >>> My one concern is how good the sticky sessions on linode's
> >>> nodebalancer works.
> >>>
> >>> Regarding uwsgi I have ready time out issues when using it with
> >>> web2py.
> >>>
> >>> --
> >>> Regards,
> >>> Bruce
> >>>
> >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
> >>> wrote:
> >>>
>  I've never read anything but good things about uwsgi. Django
> and
>  Flask both promote it.
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> --
> >>> Regards,
> >>> Bruce Wade
> >>> http://ca.linkedin.com/in/brucelwade
> >>> http://www.wadecybertech.com
> >>> http://www.fittraineronline.com - Fitness Personal Trainers
> Online
> >>> http://www.warplydesigned.

Re: [web2py] CPU 210%

2012-04-18 Thread Bruno Rocha
why?

On Wed, Apr 18, 2012 at 7:24 PM, Bruce Wade  wrote:

> After changing sessions to use the database instead of the FS I can no
> longer use uwsgi
>
>
> On Wed, Apr 18, 2012 at 3:17 PM, Bruce Wade  wrote:
>
>> I am about to give up on uwsgi. Everything was working, and I pulled the
>> latest code now it doesn't work, but my other server with the same code
>> works.
>>
>>
>> On Wed, Apr 18, 2012 at 2:40 PM, Bruce Wade  wrote:
>>
>>> Thanks for the explanation the error was strange because first I was
>>> getting permission connecting to the database error I updated that then I
>>> got that error.
>>>
>>> Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi) on
>>> a load balancer going to add a 3rd nginx + uwsgi
>>> --
>>> Regards,
>>> Bruce
>>>
>>>
>>> On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris wrote:
>>>

 > Ok got it running, restarted uwsgi not sure what the issue was.
 >
 > However following the guides I my static content isn't being loaded:
 > http://50.116.6.124


 The error you got earlier, happens when you do not read the body of the
 request (for example when you have POST data, but you do not read them).
 This is how nginx works. You can avoid that (if you do not want to read
 post data) with --post-buffering  in uWSGI. It is a trick to force
 uWSGI to blindly read the http body independently by your app.

 Regarding static files, you have to fight with nginx (uWSGI should only
 manage the python part)

 Normally working on the location directives and root/alias options is
 enough

 >
 > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
 wrote:
 >
 >> uwsgi is sure not as easy to get working correctly as apache is. Keep
 >> getting the following:
 >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely
 closed
 >> connection while reading response header from upstream, client:
 >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
 upstream:
 >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
 >>
 >>
 >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
 >> wrote:
 >>
 >>> There are directions for this on book
 >>> http://web2py.com/books/default/chapter/29/4#session
 >>>
 >>> Store session on db or set separate=True
 >>>
 >>>
 >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
 >>> wrote:
 >>>
  I recommend you to store sessions on db or cache like memcached,
  redis... If you are going to run in a load balance, sessions in
 disk
  will
  be a problem.
 
 
  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
  wrote:
 
 > Currently FS
 >
 >
 > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
 > wrote:
 >
 >> Are you storing sessions in db or FS?
 >>
 >> http://zerp.ly/rochacbruno
 >> Em 18/04/2012 02:18, "Bruce Wade" 
 escreveu:
 >>
 >> Yeah, I am not sure how well web2py can handle load but I am
 going
 >> to
 >>> find out pretty fast. I finished setting up a load balancer
 today,
 >>> going to
 >>> have 3 servers under it running nginx + uwsgi + web2py a single
 >>> dedicated
 >>> DB server for now, but figure I am going to need some slave read
 >>> only
 >>> servers. The speed at which web2py allows you to develop
 >>> applications
 >>> will surpass any load issues, well unless it could only handle
 >>> 50,000
 >>> users/per second then that would be a big issue :D
 >>>
 >>> My one concern is how good the sticky sessions on linode's
 >>> nodebalancer works.
 >>>
 >>> Regarding uwsgi I have ready time out issues when using it with
 >>> web2py.
 >>>
 >>> --
 >>> Regards,
 >>> Bruce
 >>>
 >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
 >>> wrote:
 >>>
  I've never read anything but good things about uwsgi. Django
 and
  Flask both promote it.
 >>>
 >>>
 >>>
 >>>
 >>> --
 >>> --
 >>> Regards,
 >>> Bruce Wade
 >>> http://ca.linkedin.com/in/brucelwade
 >>> http://www.wadecybertech.com
 >>> http://www.fittraineronline.com - Fitness Personal Trainers
 Online
 >>> http://www.warplydesigned.com
 >>>
 >>>
 >
 >
 > --
 > --
 > Regards,
 > Bruce Wade
 > http://ca.linkedin.com/in/brucelwade
 > http://www.wadecybertech.com
 > http://www.fittraineronline.com - Fitness Personal Trainers
 Online
 > http://www.warplydesigned.com
 >
 >
 
 
  --
 
 

[web2py] web2py logging to firePHP using firepy?

2012-04-18 Thread JimK
Has anyone figured out how to get logging to firePHP using firepy for 
web2py?  A bit of web searching shows that someone figured it out a while 
back but his script no longer exists for download.  This would really 
be useful for debugging.


[web2py] Memory leak in standalone DAL (issue #731), can you please help test?

2012-04-18 Thread nick name
I can reproduce this problem on both Linux and Windows (have no access to a 
Mac), and Massimo cannot reproduce this on his Mac. Perhaps something is 
borked about all my python installations (some site-packages I use or 
something). Can you help test? Just go into the web2py directory, and start 
python with the following script (or just start python and paste the script 
into the python console)

#!/usr/bin/python
#encoding: utf-8

# get a web2py database environment
import sys
sys.path.append('../../')
from gluon.dal import DAL

while 1:
mydal = DAL('sqlite:memory')
sys.stdout.write('.')
sys.stdout.flush()
mydal._adapter.close()

For me: memory usage grows at about 20MB/sec, measured with htop on linux 
and TaskManager on windows. If I wait enough time, all the memory is eaten 
up. If you drop the last line (mydal._adapter.close()) the memory will be 
eaten much more quickly for me.

Thanks.
Issue reference: 731 : 
Standalone DAL is leaking memory+resources (don't know whether or not 
inside web2py)

Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
After changing sessions to use the database instead of the FS I can no
longer use uwsgi

On Wed, Apr 18, 2012 at 3:17 PM, Bruce Wade  wrote:

> I am about to give up on uwsgi. Everything was working, and I pulled the
> latest code now it doesn't work, but my other server with the same code
> works.
>
>
> On Wed, Apr 18, 2012 at 2:40 PM, Bruce Wade  wrote:
>
>> Thanks for the explanation the error was strange because first I was
>> getting permission connecting to the database error I updated that then I
>> got that error.
>>
>> Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi) on a
>> load balancer going to add a 3rd nginx + uwsgi
>> --
>> Regards,
>> Bruce
>>
>>
>> On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris wrote:
>>
>>>
>>> > Ok got it running, restarted uwsgi not sure what the issue was.
>>> >
>>> > However following the guides I my static content isn't being loaded:
>>> > http://50.116.6.124
>>>
>>>
>>> The error you got earlier, happens when you do not read the body of the
>>> request (for example when you have POST data, but you do not read them).
>>> This is how nginx works. You can avoid that (if you do not want to read
>>> post data) with --post-buffering  in uWSGI. It is a trick to force
>>> uWSGI to blindly read the http body independently by your app.
>>>
>>> Regarding static files, you have to fight with nginx (uWSGI should only
>>> manage the python part)
>>>
>>> Normally working on the location directives and root/alias options is
>>> enough
>>>
>>> >
>>> > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
>>> wrote:
>>> >
>>> >> uwsgi is sure not as easy to get working correctly as apache is. Keep
>>> >> getting the following:
>>> >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
>>> >> connection while reading response header from upstream, client:
>>> >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
>>> upstream:
>>> >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>>> >>
>>> >>
>>> >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
>>> >> wrote:
>>> >>
>>> >>> There are directions for this on book
>>> >>> http://web2py.com/books/default/chapter/29/4#session
>>> >>>
>>> >>> Store session on db or set separate=True
>>> >>>
>>> >>>
>>> >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
>>> >>> wrote:
>>> >>>
>>>  I recommend you to store sessions on db or cache like memcached,
>>>  redis... If you are going to run in a load balance, sessions in disk
>>>  will
>>>  be a problem.
>>> 
>>> 
>>>  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
>>>  wrote:
>>> 
>>> > Currently FS
>>> >
>>> >
>>> > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
>>> > wrote:
>>> >
>>> >> Are you storing sessions in db or FS?
>>> >>
>>> >> http://zerp.ly/rochacbruno
>>> >> Em 18/04/2012 02:18, "Bruce Wade" 
>>> escreveu:
>>> >>
>>> >> Yeah, I am not sure how well web2py can handle load but I am going
>>> >> to
>>> >>> find out pretty fast. I finished setting up a load balancer
>>> today,
>>> >>> going to
>>> >>> have 3 servers under it running nginx + uwsgi + web2py a single
>>> >>> dedicated
>>> >>> DB server for now, but figure I am going to need some slave read
>>> >>> only
>>> >>> servers. The speed at which web2py allows you to develop
>>> >>> applications
>>> >>> will surpass any load issues, well unless it could only handle
>>> >>> 50,000
>>> >>> users/per second then that would be a big issue :D
>>> >>>
>>> >>> My one concern is how good the sticky sessions on linode's
>>> >>> nodebalancer works.
>>> >>>
>>> >>> Regarding uwsgi I have ready time out issues when using it with
>>> >>> web2py.
>>> >>>
>>> >>> --
>>> >>> Regards,
>>> >>> Bruce
>>> >>>
>>> >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
>>> >>> wrote:
>>> >>>
>>>  I've never read anything but good things about uwsgi. Django and
>>>  Flask both promote it.
>>> >>>
>>> >>>
>>> >>>
>>> >>>
>>> >>> --
>>> >>> --
>>> >>> Regards,
>>> >>> Bruce Wade
>>> >>> http://ca.linkedin.com/in/brucelwade
>>> >>> http://www.wadecybertech.com
>>> >>> http://www.fittraineronline.com - Fitness Personal Trainers
>>> Online
>>> >>> http://www.warplydesigned.com
>>> >>>
>>> >>>
>>> >
>>> >
>>> > --
>>> > --
>>> > Regards,
>>> > Bruce Wade
>>> > http://ca.linkedin.com/in/brucelwade
>>> > http://www.wadecybertech.com
>>> > http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> > http://www.warplydesigned.com
>>> >
>>> >
>>> 
>>> 
>>>  --
>>> 
>>>  Bruno Rocha
>>>  [http://rochacbruno.com.br]
>>> 
>>> 
>>> >>>
>>> >>>
>>> >>> --
>>> >>>
>>> >>> Bruno Rocha
>>> >>> [http://rochacbruno.com.br]
>>> >>>
>>> >>>
>>> >>
>>> >>
>>> >> --
>>> >> --
>>> >> Regards,
>>> >> Bruce Wad

Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
I am about to give up on uwsgi. Everything was working, and I pulled the
latest code now it doesn't work, but my other server with the same code
works.

On Wed, Apr 18, 2012 at 2:40 PM, Bruce Wade  wrote:

> Thanks for the explanation the error was strange because first I was
> getting permission connecting to the database error I updated that then I
> got that error.
>
> Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi) on a
> load balancer going to add a 3rd nginx + uwsgi
> --
> Regards,
> Bruce
>
>
> On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris wrote:
>
>>
>> > Ok got it running, restarted uwsgi not sure what the issue was.
>> >
>> > However following the guides I my static content isn't being loaded:
>> > http://50.116.6.124
>>
>>
>> The error you got earlier, happens when you do not read the body of the
>> request (for example when you have POST data, but you do not read them).
>> This is how nginx works. You can avoid that (if you do not want to read
>> post data) with --post-buffering  in uWSGI. It is a trick to force
>> uWSGI to blindly read the http body independently by your app.
>>
>> Regarding static files, you have to fight with nginx (uWSGI should only
>> manage the python part)
>>
>> Normally working on the location directives and root/alias options is
>> enough
>>
>> >
>> > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
>> wrote:
>> >
>> >> uwsgi is sure not as easy to get working correctly as apache is. Keep
>> >> getting the following:
>> >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
>> >> connection while reading response header from upstream, client:
>> >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
>> upstream:
>> >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>> >>
>> >>
>> >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
>> >> wrote:
>> >>
>> >>> There are directions for this on book
>> >>> http://web2py.com/books/default/chapter/29/4#session
>> >>>
>> >>> Store session on db or set separate=True
>> >>>
>> >>>
>> >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
>> >>> wrote:
>> >>>
>>  I recommend you to store sessions on db or cache like memcached,
>>  redis... If you are going to run in a load balance, sessions in disk
>>  will
>>  be a problem.
>> 
>> 
>>  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
>>  wrote:
>> 
>> > Currently FS
>> >
>> >
>> > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
>> > wrote:
>> >
>> >> Are you storing sessions in db or FS?
>> >>
>> >> http://zerp.ly/rochacbruno
>> >> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>> >>
>> >> Yeah, I am not sure how well web2py can handle load but I am going
>> >> to
>> >>> find out pretty fast. I finished setting up a load balancer today,
>> >>> going to
>> >>> have 3 servers under it running nginx + uwsgi + web2py a single
>> >>> dedicated
>> >>> DB server for now, but figure I am going to need some slave read
>> >>> only
>> >>> servers. The speed at which web2py allows you to develop
>> >>> applications
>> >>> will surpass any load issues, well unless it could only handle
>> >>> 50,000
>> >>> users/per second then that would be a big issue :D
>> >>>
>> >>> My one concern is how good the sticky sessions on linode's
>> >>> nodebalancer works.
>> >>>
>> >>> Regarding uwsgi I have ready time out issues when using it with
>> >>> web2py.
>> >>>
>> >>> --
>> >>> Regards,
>> >>> Bruce
>> >>>
>> >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
>> >>> wrote:
>> >>>
>>  I've never read anything but good things about uwsgi. Django and
>>  Flask both promote it.
>> >>>
>> >>>
>> >>>
>> >>>
>> >>> --
>> >>> --
>> >>> Regards,
>> >>> Bruce Wade
>> >>> http://ca.linkedin.com/in/brucelwade
>> >>> http://www.wadecybertech.com
>> >>> http://www.fittraineronline.com - Fitness Personal Trainers
>> Online
>> >>> http://www.warplydesigned.com
>> >>>
>> >>>
>> >
>> >
>> > --
>> > --
>> > Regards,
>> > Bruce Wade
>> > http://ca.linkedin.com/in/brucelwade
>> > http://www.wadecybertech.com
>> > http://www.fittraineronline.com - Fitness Personal Trainers Online
>> > http://www.warplydesigned.com
>> >
>> >
>> 
>> 
>>  --
>> 
>>  Bruno Rocha
>>  [http://rochacbruno.com.br]
>> 
>> 
>> >>>
>> >>>
>> >>> --
>> >>>
>> >>> Bruno Rocha
>> >>> [http://rochacbruno.com.br]
>> >>>
>> >>>
>> >>
>> >>
>> >> --
>> >> --
>> >> Regards,
>> >> Bruce Wade
>> >> http://ca.linkedin.com/in/brucelwade
>> >> http://www.wadecybertech.com
>> >> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> >> http://www.warplydesigned.com
>> >>
>> >>
>> >
>> >
>> > --
>> > --
>> > Regards,
>> > Bruce Wade
>> > http://ca.linkedin.com/in/brucelwade
>> > http://www.wa

Re: [web2py] Uploaded files path discovery

2012-04-18 Thread Khalil KHAMLICHI
for every field you can specify the upload folder,

uploadfolder=os.path.join(request.folder,'uploads'),


also "request.folder" might be what you re looking for.

from http://web2py.com/books/default/chapter/29/6

Field(name, 'string', length=None, default=None,

  required=False, requires='',

  ondelete='CASCADE', notnull=False, unique=False,

  uploadfield=True, widget=None, label=None, comment=None,

  writable=True, readable=True, update=None, authorize=None,

  autodelete=False, represent=None, compute=None,

  uploadfolder=os.path.join(request.folder,'uploads'),

  uploadseparate=None)




On Wed, Apr 18, 2012 at 8:32 PM, rdodev  wrote:

> So, as per documentation, the default upload file location is:
> web2py\applications\application_name\uploads however, I'd like to avoid
> hard-coding this path since the app might be deployed in different environs
> and relative paths don't seem to work (i.e. '../uploads/' + file_name') .
> So from a controller is there a more elegant way to get the path? Thx.
>


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Thanks for the explanation the error was strange because first I was
getting permission connecting to the database error I updated that then I
got that error.

Oh well it is all working now. 2 systems (1 apache, 1 nginx + uwsgi) on a
load balancer going to add a 3rd nginx + uwsgi
--
Regards,
Bruce

On Wed, Apr 18, 2012 at 11:08 AM, Roberto De Ioris  wrote:

>
> > Ok got it running, restarted uwsgi not sure what the issue was.
> >
> > However following the guides I my static content isn't being loaded:
> > http://50.116.6.124
>
>
> The error you got earlier, happens when you do not read the body of the
> request (for example when you have POST data, but you do not read them).
> This is how nginx works. You can avoid that (if you do not want to read
> post data) with --post-buffering  in uWSGI. It is a trick to force
> uWSGI to blindly read the http body independently by your app.
>
> Regarding static files, you have to fight with nginx (uWSGI should only
> manage the python part)
>
> Normally working on the location directives and root/alias options is
> enough
>
> >
> > On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade 
> wrote:
> >
> >> uwsgi is sure not as easy to get working correctly as apache is. Keep
> >> getting the following:
> >> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
> >> connection while reading response header from upstream, client:
> >> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1",
> upstream:
> >> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
> >>
> >>
> >> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
> >> wrote:
> >>
> >>> There are directions for this on book
> >>> http://web2py.com/books/default/chapter/29/4#session
> >>>
> >>> Store session on db or set separate=True
> >>>
> >>>
> >>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
> >>> wrote:
> >>>
>  I recommend you to store sessions on db or cache like memcached,
>  redis... If you are going to run in a load balance, sessions in disk
>  will
>  be a problem.
> 
> 
>  On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
>  wrote:
> 
> > Currently FS
> >
> >
> > On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
> > wrote:
> >
> >> Are you storing sessions in db or FS?
> >>
> >> http://zerp.ly/rochacbruno
> >> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
> >>
> >> Yeah, I am not sure how well web2py can handle load but I am going
> >> to
> >>> find out pretty fast. I finished setting up a load balancer today,
> >>> going to
> >>> have 3 servers under it running nginx + uwsgi + web2py a single
> >>> dedicated
> >>> DB server for now, but figure I am going to need some slave read
> >>> only
> >>> servers. The speed at which web2py allows you to develop
> >>> applications
> >>> will surpass any load issues, well unless it could only handle
> >>> 50,000
> >>> users/per second then that would be a big issue :D
> >>>
> >>> My one concern is how good the sticky sessions on linode's
> >>> nodebalancer works.
> >>>
> >>> Regarding uwsgi I have ready time out issues when using it with
> >>> web2py.
> >>>
> >>> --
> >>> Regards,
> >>> Bruce
> >>>
> >>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
> >>> wrote:
> >>>
>  I've never read anything but good things about uwsgi. Django and
>  Flask both promote it.
> >>>
> >>>
> >>>
> >>>
> >>> --
> >>> --
> >>> Regards,
> >>> Bruce Wade
> >>> http://ca.linkedin.com/in/brucelwade
> >>> http://www.wadecybertech.com
> >>> http://www.fittraineronline.com - Fitness Personal Trainers Online
> >>> http://www.warplydesigned.com
> >>>
> >>>
> >
> >
> > --
> > --
> > Regards,
> > Bruce Wade
> > http://ca.linkedin.com/in/brucelwade
> > http://www.wadecybertech.com
> > http://www.fittraineronline.com - Fitness Personal Trainers Online
> > http://www.warplydesigned.com
> >
> >
> 
> 
>  --
> 
>  Bruno Rocha
>  [http://rochacbruno.com.br]
> 
> 
> >>>
> >>>
> >>> --
> >>>
> >>> Bruno Rocha
> >>> [http://rochacbruno.com.br]
> >>>
> >>>
> >>
> >>
> >> --
> >> --
> >> Regards,
> >> Bruce Wade
> >> http://ca.linkedin.com/in/brucelwade
> >> http://www.wadecybertech.com
> >> http://www.fittraineronline.com - Fitness Personal Trainers Online
> >> http://www.warplydesigned.com
> >>
> >>
> >
> >
> > --
> > --
> > Regards,
> > Bruce Wade
> > http://ca.linkedin.com/in/brucelwade
> > http://www.wadecybertech.com
> > http://www.fittraineronline.com - Fitness Personal Trainers Online
> > http://www.warplydesigned.com
> >
>
>
> --
> Roberto De Ioris
> http://unbit.it
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Uploaded files path discovery

2012-04-18 Thread rdodev
So, as per documentation, the default upload file location is:
web2py\applications\application_name\uploads however, I'd like to avoid 
hard-coding this path since the app might be deployed in different environs 
and relative paths don't seem to work (i.e. '../uploads/' + file_name') . 
So from a controller is there a more elegant way to get the path? Thx.


Re: [web2py] Re: Database design

2012-04-18 Thread Chris Rowson
I've put this into the controller to test this out:

def create_newbuild():
#newbuild and resale properties share the same table.
#the extraneous fields are rendered non-writable by the below
db.property.land.writable = False
db.property.reference_number.writable = False
db.property.habitable_area.writable = False
db.property.utilities.writable = False
db.property.address.writable = False
db.property.postcode.writable = False
db.property.land.readable = False
db.property.reference_number.readable = False
db.property.habitable_area.readable = False
db.property.utilities.readable = False
db.property.address.readable = False
db.property.postcode.readable = False
db.property.property_type.default="2" #select the newbuild property
type and hide the option from the user
db.property.property_type.readable = False
form=SQLFORM(db.property)
if form.process().accepted:
response.flash = 'form accepted'
elif form.errors:
response.flash = 'form has errors'
else:
response.flash = 'please fill out the form'
return dict(form=form)

Strange thing is though that the property_type field still appears on the
form. Any ideas why?

Thank you,

Chris

On Wed, Apr 18, 2012 at 3:43 PM, Chris Rowson
wrote:

> Thanks for confirming this for me, this did seem to be the most sensible
> way to approach the problem :-)
>
> Chris
>
>
> On Wed, Apr 18, 2012 at 1:04 AM, simon  wrote:
>
>> You can do this with a single form. At the top of the controller set
>> readable=false,  writable=false for the fields you do not want on the form.
>>
>> On Tuesday, 17 April 2012 23:44:54 UTC+1, leftcase wrote:
>>
>>> I'm a new adopter of web2py and I'm trying to learn the framework by
>>> building a simple property site.
>>>
>>> I have two types of properties, new or old.
>>>
>>> New properties have a few core attributes, let's say name, price,
>>> location, bedrooms
>>>
>>> Old properties have the same core attributes with a few more added on,
>>> for instance utilities, land, lease type.
>>>
>>> I've tried making a table for new properties and a table for old
>>> properties but it seems to complicate things if I for instance want to list
>>> all types of properties (new and old) and order by price (I've been
>>> struggling to figure out how to aggregate the results from both tables then
>>> order by price).
>>>
>>> Would it make more sense to have one table with all of the fields for
>>> new and old properties and simply create two different forms with different
>>> fields exposed depending on whether or not the user wants to create a new
>>> or an old property?
>>>
>>> Thanks in advance,
>>>
>>> Chris
>>>
>>
>


[web2py] Using _before_insert to implement subsecond precision?

2012-04-18 Thread nick name
I was away for two weeks and finally caught up with the git updates and the 
mailing list; what a pleasant surprise!

The before/after infrastructure is a joy. It is simple and elegant, much 
faster and more effective than the monkeypatching I submitted, AND with 
auditing implemented on top of it. Thank you very much Massimo, this is 
great!

You asked in the ticket -- yes, this is a great, efficient implementation 
of auditing.

A question I keep bugging (and submitting patches about) is the 
implementation of subsecond precision in the database. With the new code, I 
believe it is as simple as doing:

def change_datetime_and_time_to_string(fields):
  for k, v in fields.items():
if isinstance(v, (datetime.datetime, datetime.time)): fields[k] = 
v.isoformat().replace('T', ' ')

_before_insert.append(change_datetime_and_time_to_string)

Is there a reason not to do that?

If not, would it be possible to make the DAL constructor append such a 
before_insert filter to any table? (As it is implemented, I would have to 
add it myself to tables that I want to apply it to).
A filter such as the above could be useful if it comes by default (but not 
inserted to the _before_insert list). Another useful filter would warn or 
raise an error if the time or datetime has a nonzero microsecond field -- 
useful for oracle or db2 which do not have that option.

Massimo, thanks again for the wonderful work - you are doing amazing work!

BTW: for datetime, it is possible to use x.isoformat(' ') instead of 
x.isoformat().replace('T', ' '); but for time, isoformat() takes no 
arguments.


[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Anthony
On Wednesday, April 18, 2012 3:11:39 PM UTC-4, simon wrote:
>
> So there is. That is handy. Not mentioned in the book!
>

In most cases, it's not necessary -- when you exclude "r", it defaults to 
current.request.

Anthony 


Re: [web2py] Dart - New Google Language

2012-04-18 Thread mikech
By the way O'Reilly has a free book on Dart at:  
http://shop.oreilly.com/product/0636920025887.do 

On Wednesday, April 18, 2012 11:11:55 AM UTC-7, mikech wrote:
>
> Isn't that the goal of Node.js?  I agree Dart is an interesting language, 
> I'm currently following it.  It does seem with efforts like Node.js and 
> Meteor that JS is advancing on both the server and client.
>
> On Wednesday, April 18, 2012 10:35:34 AM UTC-7, villas wrote:
>>
>> Naturally JS is extremely popular -- as far as client-side programming 
>> does, it's more or less the only show in town.  But what about 
>> server-side?  At the moment we have to use things like python,  which is 
>> great and IMO much better than JS.  However,  I don't think python will 
>> ever cross over to the client.  Therefore we have to use at least two 
>> development languages/environments.
>>
>> What if someone came along and introduced something which could handle 
>> everything that JS already had,  but then go on to satisfy all the 
>> requirements for writing solid apps that we can run on the server?  I mean 
>> database bindings,  possibility of better data typing and a good IDE 
>> environment which can run natively in a browser,  but still support other 
>> popular browsers too.  It would be brilliant for developers building 
>> desktop apps and running them everywhere via a well supported client 
>> browser.
>>
>> I believe that's what Google are trying to do.  They start off with JS 
>> support and build that into all-encompassing environment suitable for all 
>> tasks.  It an attractive goal and I hope that they can succeed because I 
>> just want to learn one language that does everything.
>>
>>
>>

[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread simon
So there is. That is handy. Not mentioned in the book!

On Wednesday, 18 April 2012 19:53:40 UTC+1, Anthony wrote:
>
> On Wednesday, April 18, 2012 1:56:08 PM UTC-4, simon wrote:
>>
>> There is no "r" parameter for URL. Not sure what you are trying to pass. 
>> You already specify the controller and function.
>
>
> Yes, there is an "r" argument to URL -- it takes a request object and 
> reads the current application, controller, and function from it if not 
> provided explicitly.
>
> Anthony 
>


[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Anthony
On Wednesday, April 18, 2012 1:56:08 PM UTC-4, simon wrote:
>
> There is no "r" parameter for URL. Not sure what you are trying to pass. 
> You already specify the controller and function.


Yes, there is an "r" argument to URL -- it takes a request object and reads 
the current application, controller, and function from it if not provided 
explicitly.

Anthony 


Re: [web2py] Content-type header for HTTP exception incorrectly set ?

2012-04-18 Thread Joseph Piron

Happy to help.
Indeed content should also, for now I json.dumps things..
Just a question, where is the tracker ? This one seems ... not functional ? 
http://code.google.com/p/web2py-issuetracker/updates/list

Br.

On 16 Apr 2012, at 16:19, Jonathan Lundell wrote:

> On Apr 16, 2012, at 7:02 AM, Massimo Di Pierro wrote:
>> Shame on me. Than it is a bug. Please open a ticket on google code. web2py 
>> sets the content-type correctly in gluon/main.html but it seems to lose it 
>> when an HTTP exception is raised.
> 
> It's not just that the content type should be set to text/json; the content 
> itself needs to be JSON. 
> 
> This is slightly tricky when web2py is generating the response (as in a 5xx 
> error), since the exact nature of a JSON response depends on the content of 
> the JSON request (we're supposed to set the id to the id of the request, for 
> example, though null is OK if the id is not known). I think it's safe to 
> return a JSON-RPC 2.0 error response. 
> 
>> 
>> On Monday, 16 April 2012 08:56:07 UTC-5, Joseph.Piron wrote:
>> Json indeed :)
>> 
>> On 16 Apr 2012, at 15:44, Jonathan Lundell wrote:
>> 
>>> On Apr 16, 2012, at 6:24 AM, Massimo Di Pierro wrote:
 Because IE browsers, when they receive a error page (HTTP x!=200) and the 
 content is less than a certain size, they choose to ignore the content and 
 display an uninformative canned message instead. web2py injects in the 
 content an html comment to make it just long enough so that IE browser do 
 not ignore the comment. This is important for example so that IE displays 
 web2py tickets instead of a generic error page.
>>> 
>>> Except that this is a JSON request, not HTML.
>>> 
 
 On Monday, 16 April 2012 07:24:46 UTC-5, Joseph.Piron wrote:
 Hi gents !
 
 I was working on an extjs client intended to discuss with web2py when I 
 stumbled upon this weird behaviour:
 
 with my client calling "PUT /defaut/api/alarms/1.json", I want the server 
 to respond a 409 error code with good json return {success: false, errors: 
 {...}}
 and use raise HTTP(409, {"success":False, "errors":{...}}) to generate 
 this error.
 Unfortunately, even if the call has been done with a ".json", the 
 content-type header of the response is set to "text/html" and thus, the 
 code adds a 
 
 
 at the end for a 4xx code (not for a 5xx code, which works for me).
 Shouldn't the content-type be set to text/json or something similar ?
 
 Thanks for your support !
>>> 
>>> 
>> 
> 
> 



Re: [web2py] Dart - New Google Language

2012-04-18 Thread mikech
Isn't that the goal of Node.js?  I agree Dart is an interesting language, 
I'm currently following it.  It does seem with efforts like Node.js and 
Meteor that JS is advancing on both the server and client.

On Wednesday, April 18, 2012 10:35:34 AM UTC-7, villas wrote:
>
> Naturally JS is extremely popular -- as far as client-side programming 
> does, it's more or less the only show in town.  But what about 
> server-side?  At the moment we have to use things like python,  which is 
> great and IMO much better than JS.  However,  I don't think python will 
> ever cross over to the client.  Therefore we have to use at least two 
> development languages/environments.
>
> What if someone came along and introduced something which could handle 
> everything that JS already had,  but then go on to satisfy all the 
> requirements for writing solid apps that we can run on the server?  I mean 
> database bindings,  possibility of better data typing and a good IDE 
> environment which can run natively in a browser,  but still support other 
> popular browsers too.  It would be brilliant for developers building 
> desktop apps and running them everywhere via a well supported client 
> browser.
>
> I believe that's what Google are trying to do.  They start off with JS 
> support and build that into all-encompassing environment suitable for all 
> tasks.  It an attractive goal and I hope that they can succeed because I 
> just want to learn one language that does everything.
>
>
>

Re: [web2py] CPU 210%

2012-04-18 Thread Roberto De Ioris

> Ok got it running, restarted uwsgi not sure what the issue was.
>
> However following the guides I my static content isn't being loaded:
> http://50.116.6.124


The error you got earlier, happens when you do not read the body of the
request (for example when you have POST data, but you do not read them).
This is how nginx works. You can avoid that (if you do not want to read
post data) with --post-buffering  in uWSGI. It is a trick to force
uWSGI to blindly read the http body independently by your app.

Regarding static files, you have to fight with nginx (uWSGI should only
manage the python part)

Normally working on the location directives and root/alias options is enough

>
> On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade  wrote:
>
>> uwsgi is sure not as easy to get working correctly as apache is. Keep
>> getting the following:
>> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
>> connection while reading response header from upstream, client:
>> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1", upstream:
>> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>>
>>
>> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha
>> wrote:
>>
>>> There are directions for this on book
>>> http://web2py.com/books/default/chapter/29/4#session
>>>
>>> Store session on db or set separate=True
>>>
>>>
>>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha
>>> wrote:
>>>
 I recommend you to store sessions on db or cache like memcached,
 redis... If you are going to run in a load balance, sessions in disk
 will
 be a problem.


 On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade
 wrote:

> Currently FS
>
>
> On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha
> wrote:
>
>> Are you storing sessions in db or FS?
>>
>> http://zerp.ly/rochacbruno
>> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>>
>> Yeah, I am not sure how well web2py can handle load but I am going
>> to
>>> find out pretty fast. I finished setting up a load balancer today,
>>> going to
>>> have 3 servers under it running nginx + uwsgi + web2py a single
>>> dedicated
>>> DB server for now, but figure I am going to need some slave read
>>> only
>>> servers. The speed at which web2py allows you to develop
>>> applications
>>> will surpass any load issues, well unless it could only handle
>>> 50,000
>>> users/per second then that would be a big issue :D
>>>
>>> My one concern is how good the sticky sessions on linode's
>>> nodebalancer works.
>>>
>>> Regarding uwsgi I have ready time out issues when using it with
>>> web2py.
>>>
>>> --
>>> Regards,
>>> Bruce
>>>
>>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit
>>> wrote:
>>>
 I've never read anything but good things about uwsgi. Django and
 Flask both promote it.
>>>
>>>
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


 --

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


>>>
>>>
>>> --
>>>
>>> Bruno Rocha
>>> [http://rochacbruno.com.br]
>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>


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


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Got it work had to change the static path in the config to remove ~*

On Wed, Apr 18, 2012 at 11:00 AM, Bruce Wade  wrote:

> Ok got it running, restarted uwsgi not sure what the issue was.
>
> However following the guides I my static content isn't being loaded:
> http://50.116.6.124
>
>
> On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade  wrote:
>
>> uwsgi is sure not as easy to get working correctly as apache is. Keep
>> getting the following:
>> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
>> connection while reading response header from upstream, client:
>> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1", upstream:
>> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>>
>>
>> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha wrote:
>>
>>> There are directions for this on book
>>> http://web2py.com/books/default/chapter/29/4#session
>>>
>>> Store session on db or set separate=True
>>>
>>>
>>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha wrote:
>>>
 I recommend you to store sessions on db or cache like memcached,
 redis... If you are going to run in a load balance, sessions in disk will
 be a problem.


 On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade wrote:

> Currently FS
>
>
> On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha wrote:
>
>> Are you storing sessions in db or FS?
>>
>> http://zerp.ly/rochacbruno
>> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>>
>> Yeah, I am not sure how well web2py can handle load but I am going to
>>> find out pretty fast. I finished setting up a load balancer today, 
>>> going to
>>> have 3 servers under it running nginx + uwsgi + web2py a single 
>>> dedicated
>>> DB server for now, but figure I am going to need some slave read only
>>> servers. The speed at which web2py allows you to develop applications
>>> will surpass any load issues, well unless it could only handle 50,000
>>> users/per second then that would be a big issue :D
>>>
>>> My one concern is how good the sticky sessions on linode's
>>> nodebalancer works.
>>>
>>> Regarding uwsgi I have ready time out issues when using it with
>>> web2py.
>>>
>>> --
>>> Regards,
>>> Bruce
>>>
>>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit wrote:
>>>
 I've never read anything but good things about uwsgi. Django and
 Flask both promote it.
>>>
>>>
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


 --

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


>>>
>>>
>>> --
>>>
>>> Bruno Rocha
>>> [http://rochacbruno.com.br]
>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Ok got it running, restarted uwsgi not sure what the issue was.

However following the guides I my static content isn't being loaded:
http://50.116.6.124

On Wed, Apr 18, 2012 at 10:46 AM, Bruce Wade  wrote:

> uwsgi is sure not as easy to get working correctly as apache is. Keep
> getting the following:
> 2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
> connection while reading response header from upstream, client:
> 173.180.212.86, server: youadstage, request: "GET / HTTP/1.1", upstream:
> "uwsgi://127.0.0.1:9001", host: "50.116.6.124"
>
>
> On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha wrote:
>
>> There are directions for this on book
>> http://web2py.com/books/default/chapter/29/4#session
>>
>> Store session on db or set separate=True
>>
>>
>> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha wrote:
>>
>>> I recommend you to store sessions on db or cache like memcached,
>>> redis... If you are going to run in a load balance, sessions in disk will
>>> be a problem.
>>>
>>>
>>> On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade wrote:
>>>
 Currently FS


 On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha wrote:

> Are you storing sessions in db or FS?
>
> http://zerp.ly/rochacbruno
> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>
> Yeah, I am not sure how well web2py can handle load but I am going to
>> find out pretty fast. I finished setting up a load balancer today, going 
>> to
>> have 3 servers under it running nginx + uwsgi + web2py a single dedicated
>> DB server for now, but figure I am going to need some slave read only
>> servers. The speed at which web2py allows you to develop applications
>> will surpass any load issues, well unless it could only handle 50,000
>> users/per second then that would be a big issue :D
>>
>> My one concern is how good the sticky sessions on linode's
>> nodebalancer works.
>>
>> Regarding uwsgi I have ready time out issues when using it with
>> web2py.
>>
>> --
>> Regards,
>> Bruce
>>
>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit wrote:
>>
>>> I've never read anything but good things about uwsgi. Django and
>>> Flask both promote it.
>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.com - Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>>
>>>
>>> --
>>>
>>> Bruno Rocha
>>> [http://rochacbruno.com.br]
>>>
>>>
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread simon
There is no "r" parameter for URL. Not sure what you are trying to pass. 
You already specify the controller and function.

On Wednesday, 18 April 2012 10:09:06 UTC+1, Johann Spies wrote:
>
> I have the following function in a module.  When I comment out the 'links' 
> it works without a problem, but with the links active I get the error in 
> the subject line:
>
> def artikels(query = None):
> db = current.db
> if not query:
> query = db.akb_articles.id > 0 
>
> links = [lambda row: A(T('show article'), _href = URL(r = request, c = 
> 'default',
>   f = 
> 'show_akb_article',
>   args = row.id
>   ))]
> fields = [db.akb_articles.title, db.akb_articles.primaryauthor,
>   db.akb_articles.authors,
>   db.akb_articles.journal, db.akb_articles.pubyear, db.
> akb_articles.url]
> 
> 
> form = SQLFORM.grid(query,
> fields = fields,
> orderby = db.akb_articles.title,
> maxtextlength = 90,
> editable = False, deletable = False,
> details = False,
> searchable = False,
> links = links,
> ui = 'jquery-ui')
> return form
>
> Why?  
>
> Regards
> Johann
>
>

Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
uwsgi is sure not as easy to get working correctly as apache is. Keep
getting the following:
2012/04/18 10:44:49 [error] 23686#0: *8454 upstream prematurely closed
connection while reading response header from upstream, client:
173.180.212.86, server: youadstage, request: "GET / HTTP/1.1", upstream:
"uwsgi://127.0.0.1:9001", host: "50.116.6.124"

On Wed, Apr 18, 2012 at 9:43 AM, Bruno Rocha  wrote:

> There are directions for this on book
> http://web2py.com/books/default/chapter/29/4#session
>
> Store session on db or set separate=True
>
>
> On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha wrote:
>
>> I recommend you to store sessions on db or cache like memcached, redis...
>> If you are going to run in a load balance, sessions in disk will be a
>> problem.
>>
>>
>> On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade wrote:
>>
>>> Currently FS
>>>
>>>
>>> On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha wrote:
>>>
 Are you storing sessions in db or FS?

 http://zerp.ly/rochacbruno
 Em 18/04/2012 02:18, "Bruce Wade"  escreveu:

 Yeah, I am not sure how well web2py can handle load but I am going to
> find out pretty fast. I finished setting up a load balancer today, going 
> to
> have 3 servers under it running nginx + uwsgi + web2py a single dedicated
> DB server for now, but figure I am going to need some slave read only
> servers. The speed at which web2py allows you to develop applications
> will surpass any load issues, well unless it could only handle 50,000
> users/per second then that would be a big issue :D
>
> My one concern is how good the sticky sessions on linode's
> nodebalancer works.
>
> Regarding uwsgi I have ready time out issues when using it with
> web2py.
>
> --
> Regards,
> Bruce
>
> On Tue, Apr 17, 2012 at 9:55 PM, pbreit wrote:
>
>> I've never read anything but good things about uwsgi. Django and
>> Flask both promote it.
>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>>
>>
>> --
>>
>> Bruno Rocha
>> [http://rochacbruno.com.br]
>>
>>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Dart - New Google Language

2012-04-18 Thread villas
Naturally JS is extremely popular -- as far as client-side programming 
does, it's more or less the only show in town.  But what about 
server-side?  At the moment we have to use things like python,  which is 
great and IMO much better than JS.  However,  I don't think python will 
ever cross over to the client.  Therefore we have to use at least two 
development languages/environments.

What if someone came along and introduced something which could handle 
everything that JS already had,  but then go on to satisfy all the 
requirements for writing solid apps that we can run on the server?  I mean 
database bindings,  possibility of better data typing and a good IDE 
environment which can run natively in a browser,  but still support other 
popular browsers too.  It would be brilliant for developers building 
desktop apps and running them everywhere via a well supported client 
browser.

I believe that's what Google are trying to do.  They start off with JS 
support and build that into all-encompassing environment suitable for all 
tasks.  It an attractive goal and I hope that they can succeed because I 
just want to learn one language that does everything.




[web2py] annoying behaviour with computed fields

2012-04-18 Thread simon
I have a person table with date of birth and a compute field for age. I 
want my form to show date of birth (writable) and age (read only). When the 
form is accepted I reread the table and create a new SQLFORM with the new 
age.

However I cannot get this to work.

   - On a SQLFORM the age does not show up by default even if readable=True.
   - If I include age in the "fields" parameter and writable=True then it 
   shows up but is editable.
   - If I set writable=False then it does not recalculate the computed 
   field.
   
Wouldn't it be better for computed fields to show up if readable=True;  and 
to be updated even if writable=False?






Re: [web2py] CPU 210%

2012-04-18 Thread Bruno Rocha
There are directions for this on book
http://web2py.com/books/default/chapter/29/4#session

Store session on db or set separate=True

On Wed, Apr 18, 2012 at 1:36 PM, Bruno Rocha  wrote:

> I recommend you to store sessions on db or cache like memcached, redis...
> If you are going to run in a load balance, sessions in disk will be a
> problem.
>
>
> On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade  wrote:
>
>> Currently FS
>>
>>
>> On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha wrote:
>>
>>> Are you storing sessions in db or FS?
>>>
>>> http://zerp.ly/rochacbruno
>>> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>>>
>>> Yeah, I am not sure how well web2py can handle load but I am going to
 find out pretty fast. I finished setting up a load balancer today, going to
 have 3 servers under it running nginx + uwsgi + web2py a single dedicated
 DB server for now, but figure I am going to need some slave read only
 servers. The speed at which web2py allows you to develop applications
 will surpass any load issues, well unless it could only handle 50,000
 users/per second then that would be a big issue :D

 My one concern is how good the sticky sessions on linode's nodebalancer
 works.

 Regarding uwsgi I have ready time out issues when using it with web2py.

 --
 Regards,
 Bruce

 On Tue, Apr 17, 2012 at 9:55 PM, pbreit  wrote:

> I've never read anything but good things about uwsgi. Django and Flask
> both promote it.




 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/brucelwade
 http://www.wadecybertech.com
 http://www.fittraineronline.com - Fitness Personal Trainers Online
 http://www.warplydesigned.com


>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>
>
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]
>
>


-- 

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


Re: [web2py] CPU 210%

2012-04-18 Thread Bruno Rocha
I recommend you to store sessions on db or cache like memcached, redis...
If you are going to run in a load balance, sessions in disk will be a
problem.

On Wed, Apr 18, 2012 at 11:32 AM, Bruce Wade  wrote:

> Currently FS
>
>
> On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha wrote:
>
>> Are you storing sessions in db or FS?
>>
>> http://zerp.ly/rochacbruno
>> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>>
>> Yeah, I am not sure how well web2py can handle load but I am going to
>>> find out pretty fast. I finished setting up a load balancer today, going to
>>> have 3 servers under it running nginx + uwsgi + web2py a single dedicated
>>> DB server for now, but figure I am going to need some slave read only
>>> servers. The speed at which web2py allows you to develop applications
>>> will surpass any load issues, well unless it could only handle 50,000
>>> users/per second then that would be a big issue :D
>>>
>>> My one concern is how good the sticky sessions on linode's nodebalancer
>>> works.
>>>
>>> Regarding uwsgi I have ready time out issues when using it with web2py.
>>>
>>> --
>>> Regards,
>>> Bruce
>>>
>>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit  wrote:
>>>
 I've never read anything but good things about uwsgi. Django and Flask
 both promote it.
>>>
>>>
>>>
>>>
>>> --
>>> --
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


-- 

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


[web2py] Re: Digitally signed URLs

2012-04-18 Thread Sanjeet Roy
you have to use this its working fine :-

def one():
KEY = 'mykey'
return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY))

def two():
if not URL.verify(hmac_key=KEY): raise HTTP(403)
# do something
return locals()


On Sunday, April 15, 2012 7:33:00 AM UTC+5:30, pyhead wrote:
>
> I copied and pasted the examples for web2py Digitally signed URLs andthey are 
> giving errors on the latest stable build.  
>
> http://www.web2py.com/books/default/chapter/29/4#Digitally-signed-urls
> TypeError: verifyURL() takes at least 1 argument (1 given)
> The error is confusing as it seems to confirm the correct syntax is being 
> used.  hmac_key is undefined, but it shouldn't be.  Any ideas?  Thank you!
> KEY = 'mykey'
>
> def one():
> return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY)) # added 
> missing ')'
>
> def two():
> if not URL.verify(hmac_key=KEY): raise HTTP(403)
> # do something
> return locals()
>
>
> Error ticket for "init"
> Ticket ID
> 2012-04-12.02-09-19.a3721873-db4c-4ad1-885f-0912f6bd7a53
>  verifyURL() takes at least 1 argument (1 given)
> Version
> web2py™ (1, 99, 7, datetime.datetime(2012, 3, 4, 22, 12, 8), 'stable')
> PythonPython 2.7.1: /usr/bin/python
> Traceback
>
> Traceback (most recent call last):
>   File "web2py/gluon/restricted.py", line 205, in restricted
> exec ccode in environment
>   File "web2py/applications/init/controllers/default.py", line 498, in 
> 
>   File "web2py/gluon/globals.py", line 173, in 
> self._caller = lambda f: f()
>   File "web2py/applications/init/controllers/default.py", line 79, in two
> if not URL.verify(hmac_key=KEY): raise HTTP(403)
> TypeError: verifyURL() takes at least 1 argument (1 given)
>
> Error snapshot help
>
> (verifyURL() takes at least 1 argument (1 given))
>
> Frames
>
> File web2py/gluon/restricted.py in restricted at line 205 code arguments 
> variables
>
> File web2py/applications/init/controllers/default.py in  at line 
> 498 code arguments variables
>
> File web2py/gluon/globals.py in  at line 173 code arguments 
> variables
>
> File web2py/applications/init/controllers/default.py in two at line 79 
> code arguments variables
> Function argument list
> ()
> Code listing
>
> def one():
> return dict(link=URL('two', vars=dict(a=123), hmac_key=KEY))
>
> def two():
> if not URL.verify(hmac_key=KEY): raise HTTP(403)
>
> # do something
> return locals()
>
> Variables
> global URL
> hmac_key  undefined
> global HTTP   
> URL.verify
> global KEY'mykey'
>
>

Re: [web2py] Re: customized edit for using .smartgrid

2012-04-18 Thread Jim Steil

Massimo

I updated from trunk today and now I'm getting the following traceback:

Traceback(most recent call last):
  File"C:\dev\web2py\gluon\restricted.py",line205,inrestricted
execccodeinenvironment
  File"C:/dev/web2py/applications/InfoCenter/controllers/applications.py"  
,line1711,in
  File"C:\dev\web2py\gluon\globals.py",line175,in
self._caller=lambdaf:f()
  File"C:\dev\web2py\gluon\tools.py",line2670,inf
returnaction(*a, **b)
  File"C:/dev/web2py/applications/InfoCenter/controllers/applications.py"  
,line1704,inrailUnloading
form=grid.create_form
AttributeError:'DIV'object has no attribute'create_form'


on creates and

Traceback(most recent call last):
  File"C:\dev\web2py\gluon\restricted.py",line205,inrestricted
execccodeinenvironment
  File"C:/dev/web2py/applications/InfoCenter/controllers/applications.py"  
,line1711,in
  File"C:\dev\web2py\gluon\globals.py",line175,in
self._caller=lambdaf:f()
  File"C:\dev\web2py\gluon\tools.py",line2670,inf
returnaction(*a, **b)
  File"C:/dev/web2py/applications/InfoCenter/controllers/applications.py"  
,line1707,inrailUnloading
form=grid.update_form
AttributeError:'DIV'object has no attribute'update_form'


on updates.  This worked with trunk from the 9th.  (although update_form 
was then edit_form).  Seems like there is something else I need to 
change to get this functionality back.  Any ideas?


-Jim

On 4/10/2012 11:39 PM, Massimo Di Pierro wrote:

It actually was renamed update_form in trunk

On Tuesday, 10 April 2012 13:53:47 UTC-5, Jim S wrote:

In the example below you specify grid.update_form for the edit
action.  But, my testing shows that this is actually
grid.edit_form.  Should it be renamed to 'update_form' for
consistency with CRUD?

-Jim

On 4/9/2012 3:58 PM, Massimo Di Pierro wrote:

You should be able to customize the create and edit forms in the
same way:

{{if grid.create_form:}}
   {{=grid.create_form}}
{{elif grid.update_form:}}
   {{=grid.update_form}}
{{elif grid.view_form:}}
   {{=grid.view_form}}
{{else:}}
   {{=grid}}
{{pass}}

You need the current trunk because I just found an issue about this.

On Monday, 9 April 2012 11:55:24 UTC-5, Jim S wrote:

Hi

I want to customize the edit form of a .smartgrid the way
that you can
customize SQLFORM forms as specified in the manual under
section 7.5.

Is this possible?  If so, what do I use in place of
{{=form.custom.begin}}?  How do I reference the form portion
of the
returned grid?

 -Jim



Re: [web2py] Dart - New Google Language

2012-04-18 Thread Bruce Wade
I agree 100% with Khalil. pure JavaScript and HTML5 + Canvas + webgl is
where the future is going to shine.

On Wed, Apr 18, 2012 at 6:59 AM, Khalil KHAMLICHI <
khamlichi.kha...@gmail.com> wrote:

> I would rather invest in pure JavaScript and HTML5, there would be a lot
> of demands for those languages (in thier pure state not thru a translator)
> as the future is bringing them into the desktop and the smartphone as
> NATIVE applications,
>
>
> On Wed, Apr 18, 2012 at 1:43 PM, Michele Comitini <
> michele.comit...@gmail.com> wrote:
>
>> looking at the syntax it seems a step back compared to coffescript or
>> any python to js translator...
>>
>>
>> mic
>>
>> Il 18 aprile 2012 14:56, villas  ha scritto:
>> > I was interested to see this.
>> > http://www.dartlang.org/
>> > I've always dreaded the idea of developing in JS which seems to be the
>> way
>> > that things are heading,  but maybe Dart will evolve into something much
>> > better?
>>
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread Khalil KHAMLICHI
looks like its a DAL issue,

The DAL need to include the [ ] by default around column names, I also
tested using " " around the columns and it works too.

Hopefully Massimo you will look at this, in the meantime I will try to hack
my way in the source files.

here is a code I tested outside w2p :

con = pyodbc.connect('DRIVER={SQL
Server};SERVER=chi-c7269ceba93\\SQLEXPRESS;DATABASE=SambaData2;UID=sa;PWD=sambapos.1234')
cur = con.cursor()

>>> x = cur.execute('select * from MenuItems')

>>> x = cur.execute('select Id, Order from ScreenMenuCategories')
Traceback (most recent call last):
  File "", line 1, in 
x = cur.execute('select Id, Order from ScreenMenuCategories')
ProgrammingError: ('42000', "[42000] [Microsoft][ODBC SQL Server
Driver][SQL Server]Incorrect syntax near the keyword 'Order'. (156)
(SQLExecDirectW)")

>>> x = cur.execute('select "Id", "Order" from ScreenMenuCategories')
>>> for i in x:
print i

(1, 0)
(2, 0)
(3, 0)
(4, 0)
(5, 0)
(6, 0)
(7, 0)

>>> x = cur.execute('select Id, [Order] from ScreenMenuCategories')
>>> for i in x:
print i

(1, 0)
(2, 0)
(3, 0)
(4, 0)
(5, 0)
(6, 0)
(7, 0)


[web2py] Re: AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Anthony
Your links function calls URL with r=request -- is request defined as a 
string somewhere in the module before that function?

On Wednesday, April 18, 2012 5:09:06 AM UTC-4, Johann Spies wrote:
>
> I have the following function in a module.  When I comment out the 'links' 
> it works without a problem, but with the links active I get the error in 
> the subject line:
>
> def artikels(query = None):
> db = current.db
> if not query:
> query = db.akb_articles.id > 0 
>
> links = [lambda row: A(T('show article'), _href = URL(r = request, c = 
> 'default',
>   f = 
> 'show_akb_article',
>   args = row.id
>   ))]
> fields = [db.akb_articles.title, db.akb_articles.primaryauthor,
>   db.akb_articles.authors,
>   db.akb_articles.journal, db.akb_articles.pubyear, db.
> akb_articles.url]
> 
> 
> form = SQLFORM.grid(query,
> fields = fields,
> orderby = db.akb_articles.title,
> maxtextlength = 90,
> editable = False, deletable = False,
> details = False,
> searchable = False,
> links = links,
> ui = 'jquery-ui')
> return form
>
> Why?  
>
> Regards
> Johann
>
>

[web2py] Re: Please help me to understand the use of components and ajax in this case

2012-04-18 Thread Anthony

>
> In the Controller:
>
> wys_artikels = FORM(INPUT(_type='submit',
> _value = T('Click to view articles'),
> _onclick = "ajax('joernaalartikels', [], 
> 'artikels')"))
> 
>
> And in the view: 
>
> {{=wys_artikels}}
> 
> 
>
>
> A click on the submit button just loads to a reload of the whole page even 
> if I change the controller to 
>
> wys_artikels = FORM(INPUT(_type='submit',
> _value = T('Click to view articles'),
> _onclick = "ajax('joernaalartikels.load', [], 
> 'artikels')"))
> 
>
>
Three problems:

   1. As Simon already mentioned, if you want to intercept a form 
   submission or button click, your event handler has to return false, or 
   otherwise the usual behavior (i.e., regular form submission with full page 
   reload) will proceed after your handler fires. Even better, set up a jQuery 
   event handler and use the jQuery preventDefault() method to prevent the 
   usual behavior (that's generally better than simply returning false).
   2. The ajax() function is not the same as loading an Ajax component 
   (which is handled via the web2py_component() function in web2py.js). The 
   ajax() function does a standard Ajax call (including submission of input 
   element values identified in the second argument) and puts the result in 
   the target element. Ajax components provide a lot more functionality, 
   treating the component div more like a full page -- it can flash messages, 
   trap form submissions and link clicks, show form errors, and set up date 
   and numeric field widgets, just like it would if the content loaded in a 
   full page.
   3. The target value for both the ajax() function and the 
   web2py_component() function must be an id, not a class.

Try something like this (not tested -- may contain errors):

wys_artikels = FORM(INPUT(_type='submit', _value = T('Click to view 
articles')),
_id='view-artikels')



jQuery(function() {
  jQuery("form#view-artikels").submit(function(event) {
web2py_component("{{=URL('default', 'joernaalartikels.load')}}", 
"artikels");
event.preventDefault();
  });
});


{{=wys_artikels}}


Anthony



Re: [web2py] Re: Database design

2012-04-18 Thread Chris Rowson
Thanks for confirming this for me, this did seem to be the most sensible
way to approach the problem :-)

Chris

On Wed, Apr 18, 2012 at 1:04 AM, simon  wrote:

> You can do this with a single form. At the top of the controller set
> readable=false,  writable=false for the fields you do not want on the form.
>
> On Tuesday, 17 April 2012 23:44:54 UTC+1, leftcase wrote:
>
>> I'm a new adopter of web2py and I'm trying to learn the framework by
>> building a simple property site.
>>
>> I have two types of properties, new or old.
>>
>> New properties have a few core attributes, let's say name, price,
>> location, bedrooms
>>
>> Old properties have the same core attributes with a few more added on,
>> for instance utilities, land, lease type.
>>
>> I've tried making a table for new properties and a table for old
>> properties but it seems to complicate things if I for instance want to list
>> all types of properties (new and old) and order by price (I've been
>> struggling to figure out how to aggregate the results from both tables then
>> order by price).
>>
>> Would it make more sense to have one table with all of the fields for new
>> and old properties and simply create two different forms with different
>> fields exposed depending on whether or not the user wants to create a new
>> or an old property?
>>
>> Thanks in advance,
>>
>> Chris
>>
>


Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
Currently FS

On Wed, Apr 18, 2012 at 7:22 AM, Bruno Rocha  wrote:

> Are you storing sessions in db or FS?
>
> http://zerp.ly/rochacbruno
> Em 18/04/2012 02:18, "Bruce Wade"  escreveu:
>
> Yeah, I am not sure how well web2py can handle load but I am going to find
>> out pretty fast. I finished setting up a load balancer today, going to have
>> 3 servers under it running nginx + uwsgi + web2py a single dedicated DB
>> server for now, but figure I am going to need some slave read only servers.
>> The speed at which web2py allows you to develop applications
>> will surpass any load issues, well unless it could only handle 50,000
>> users/per second then that would be a big issue :D
>>
>> My one concern is how good the sticky sessions on linode's nodebalancer
>> works.
>>
>> Regarding uwsgi I have ready time out issues when using it with web2py.
>>
>> --
>> Regards,
>> Bruce
>>
>> On Tue, Apr 17, 2012 at 9:55 PM, pbreit  wrote:
>>
>>> I've never read anything but good things about uwsgi. Django and Flask
>>> both promote it.
>>
>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] CPU 210%

2012-04-18 Thread Bruno Rocha
Are you storing sessions in db or FS?

http://zerp.ly/rochacbruno
Em 18/04/2012 02:18, "Bruce Wade"  escreveu:

> Yeah, I am not sure how well web2py can handle load but I am going to find
> out pretty fast. I finished setting up a load balancer today, going to have
> 3 servers under it running nginx + uwsgi + web2py a single dedicated DB
> server for now, but figure I am going to need some slave read only servers.
> The speed at which web2py allows you to develop applications
> will surpass any load issues, well unless it could only handle 50,000
> users/per second then that would be a big issue :D
>
> My one concern is how good the sticky sessions on linode's nodebalancer
> works.
>
> Regarding uwsgi I have ready time out issues when using it with web2py.
>
> --
> Regards,
> Bruce
>
> On Tue, Apr 17, 2012 at 9:55 PM, pbreit  wrote:
>
>> I've never read anything but good things about uwsgi. Django and Flask
>> both promote it.
>
>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


[web2py] Re: Please help me to understand the use of components and ajax in this case

2012-04-18 Thread simon
the onclick needs to be "ajax.; return false;"

On Wednesday, 18 April 2012 11:13:34 UTC+1, Johann Spies wrote:
>
> When the details of the journal is viewed, there is a button inviting the 
> viewer to click in order to show articles published by this journal.
>
> I want then a grid to appear below the journal details.
>
> If I just put a 
> {{=LOAD('default', 'joernaalartikels.load', ajax=True)}}')}}',
>
>
> in the view the grid appears with the relevant data.
>
> I want to shift that action to a 'onclick' linked to the submit button.
>
> This is not working:
>
> In the Controller:
>
> wys_artikels = FORM(INPUT(_type='submit',
> _value = T('Click to view articles'),
> _onclick = "ajax('joernaalartikels', [], 
> 'artikels')"))
> 
>
> And in the view: 
>
> {{=wys_artikels}}
> 
> 
>
>
> A click on the submit button just loads to a reload of the whole page even 
> if I change the controller to 
>
> wys_artikels = FORM(INPUT(_type='submit',
> _value = T('Click to view articles'),
> _onclick = "ajax('joernaalartikels.load', [], 
> 'artikels')"))
> 
>
> How do I get the component to load after a click?
>
> Regards
> Johann
>
>

Re: [web2py] CPU 210%

2012-04-18 Thread Bruce Wade
LOL sorry I didn't mean programming threads, I mean't form threads, meaning
people posting comments in forms about issues. I can see how that was miss
understood. Honestly I am kind of liking the idea behind event based
servers more then thread based.

On Tue, Apr 17, 2012 at 11:54 PM, Roberto De Ioris  wrote:

>
> > Thanks this is very helpful to know. I am building a system with nginx
> and
> > uwsgi to get the system running on that. I have been avoiding using uwsgi
> > for anything serious because I have been seeing a lot of threads
> reporting
> > problems with it.
>
> ...and you will continue to see that :)
>
> Threads are hard to domate (in-fact most of the time you will go
> multiprocess). The current (1.2) uWSGI threading implementation is pretty
> solid (while 0.9.x are completely broken), but being an ultra-complex part
> i am pretty sure more bugs will pop-up in the future. (and i have to
> thanks Graham Dumpleton [author of mod_wsgi] for pointing me to better
> directions)
>
> By the way, it is pretty strange you found 'threading' support a
> uwsgi-blocker as very few (maybe 3-4, uWSGI included) production-grade
> WSGI servers seriously supports them (with mod_wsgi having the better
> implementation for sure).
>
> In addition to this, a little part of web-related popular libraries are
> not thread-safe, that is why multithreading is not a "too much popular"
> paradigm in python-hosting.
>
>
> --
> Roberto De Ioris
> http://unbit.it
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Dart - New Google Language

2012-04-18 Thread Khalil KHAMLICHI
I would rather invest in pure JavaScript and HTML5, there would be a lot of
demands for those languages (in thier pure state not thru a translator) as
the future is bringing them into the desktop and the smartphone as NATIVE
applications,


On Wed, Apr 18, 2012 at 1:43 PM, Michele Comitini <
michele.comit...@gmail.com> wrote:

> looking at the syntax it seems a step back compared to coffescript or
> any python to js translator...
>
>
> mic
>
> Il 18 aprile 2012 14:56, villas  ha scritto:
> > I was interested to see this.
> > http://www.dartlang.org/
> > I've always dreaded the idea of developing in JS which seems to be the
> way
> > that things are heading,  but maybe Dart will evolve into something much
> > better?
>


[web2py] Re: heroku, web2py and gunicorn

2012-04-18 Thread Massimo Di Pierro
I experience the same issue but I have a different diagnoses. It is not 
ignoring -s (although it says it does). In fact it is calling the gunicorn 
method. The problem is that it fails when when creating an instance of the 
gunicorn server and I do not know way. In stead of going into the server 
loop is continue execution and reports a wrong error. That code comes from 
Bottle and I cannot find any documentation on the gunicorn web page on how 
to access it from API. 

On Wednesday, 18 April 2012 03:14:48 UTC-5, Rahul wrote:
>
> I tried with the latest code in trunk - There seems to be some issue. It 
> ignores -s or --server= parameters. it always starts rocket server. Please 
> see the logs below. 
>
> *-bash-3.2$ python anyserver.py -s gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: -s
>
> *-bash-3.2$ python anyserver.py --server=gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: --server
>
>
> *-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
>
> anyserver.py: error: no such option: -s
>
> *It only starts rocket server*=* This works for me but  only 
> on rocket*
> -bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
> starting *rocket on 72.3.247.225:9065*...
>
> *-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 
> 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
> *anyserver.py: error: no such option: --server*
>
> *-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: -s
>
> ===Starts rocket ===
> *-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
> *starting rocket on 72.3.247.225:9065...*
>
> Please suggest - 
>
> Thanks, 
>
> Sincerely, Rahul D. [www.flockbird.com]
> =
> On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Can you try the anyserver in trunk? Looks like they changed some API.
>>
>> On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:
>>>
>>> Hi Massimo,
>>>  I did the typo in the "anyserver.py" file but now I am getting 
>>> this issue. 
>>>
>>> -bash-3.2$ *python anyserver.py -s gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Traceback (most recent call last):
>>>   File "anyserver.py", line 299, in 
>>> main()
>>>   File "anyserver.py", line 295, in main
>>> 
>>> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>>>   File "anyserver.py", line 157, in run
>>> getattr(Servers,servername)(application,(ip,int(port)))
>>>   File "anyserver.py", line 129, in gunicorn
>>> gunicorn.arbiter.Arbiter(address, 4, app).run()
>>> TypeError: __init__() takes exactly 2 arguments (4 given)
>>> ===
>>> Same case for custom ip and port
>>> ===
>>> -bash-3.2$ *python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Traceback (most recent call last):
>>>   File "anyserver.py", line 299, in 
>>> main()
>>>   File "anyserver.py", line 295, in main
>>> 
>>> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>>>   File "anyserver.py", line 157, in run
>>> getattr(Servers,servername)(application,(ip,int(port)))
>>>   File "anyserver.py", line 129, in gunicorn
>>> gunicorn.arbiter.Arbiter(address, 4, app).run()
>>> TypeError: __init__() takes exactly 2 arguments (4 given)
>>>
>>> Please suggest what could be wrong. I am new to gunicorn and anyserver. 
>>> Also direct me to some quality documentation for anyserver.py 
>>>
>>>
>>> Thanks, 
>>> Sincerely,  Rahul D.
>>>
>>>
>>> On Friday, July 22, 2011 8:36:11 PM UTC+5:30, Massimo Di Pierro wrote:

 Hello everybody, 

 heroku will be supporting web2py. They run gunicorn. web2py runs with 
 gunicorn but I have never tried it. 

 Any volunteer to run some stress tests? 

 cd web2py 
 python anyserver -s gunicorn 

 Massimo
>>>
>>>

Re: [web2py] Dart - New Google Language

2012-04-18 Thread Michele Comitini
looking at the syntax it seems a step back compared to coffescript or
any python to js translator...


mic

Il 18 aprile 2012 14:56, villas  ha scritto:
> I was interested to see this.
> http://www.dartlang.org/
> I've always dreaded the idea of developing in JS which seems to be the way
> that things are heading,  but maybe Dart will evolve into something much
> better?


Re: [web2py] Re: routes.py

2012-04-18 Thread Jonathan Lundell
On Apr 17, 2012, at 11:58 PM, IVINH wrote:
> Thank you, but I can use the syntax as: 'domain.com': 'domain.com:8000' to 
> redirect with routes.py?

No. Web2py (and its router) can't do anything until they receive the packet. If 
they listen on port 8000 and the browser sends the request to port 80, it won't 
work.

> 
> 
> Vào 21:03:21 UTC+7 Thứ ba, ngày 17 tháng tư năm 2012, Jonathan Lundell đã 
> viết:
> On Apr 17, 2012, at 1:31 AM, IVINH wrote:
>> Web2py server running at port 8000, how to redirect mydomain.com to this 
>> server without using the link mydomain.com:8000?
> 
> A web browser using that URL will make a request on port 80. You either need 
> to configure web2py to run on port 80 or use a front end (such as Apache) to 
> redirect requests on port 80 to port 8000.




Re: [web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread Khalil KHAMLICHI
Well since the DAL handles all the exchange with database . . . How can I
add squares and where?


[web2py] Dart - New Google Language

2012-04-18 Thread villas
I was interested to see this.  
http://www.dartlang.org/
I've always dreaded the idea of developing in JS which seems to be the way 
that things are heading,  but maybe Dart will evolve into something much 
better?


Re: [web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread OTTIH ARINZE
Sometimes you need words to make identification of your columns easier and 
unfortunately, some of these words may be reserved words. However, you could 
put such words in square brackets and use them as column names 

so you could put such as [Order] instead of just 'Order'

- Original Message -
From: "Khalil KHAMLICHI" 
To: web2py@googlegroups.com
Sent: Wednesday, April 18, 2012 12:12:53 PM
Subject: [web2py] Error with mssql database : Field is a reserved SQL word


Hi, 


I am trying to create an interface to sort of manage the database of a windows 
software (a very common need actually), this database is under Microsoft SQL 
Server 2008 Express Edition, and one of its mean tables has a field called 
'Order' which is a reserved word in SQL language, and using this database is 
just impossible from web2py because of this field name. 


whenever I try to use this table I ge this error : 





127.0.0.1.2012-04-18.11-58-36.d24a6ea4-8275-4626-8d72-f464db6b9e24 
 ('42000', "[42000] [Microsoft][ODBC SQL 
Server Driver][SQL Server]Incorrect syntax near the keyword 'Order'. (156) 
(SQLExecDirectW)") 


I think this question shoud go to pyodbc mailing list ... but I thought maybe 
someone over here has any suggestions. 


Thanks in advance. 


[web2py] Re: IS_TIME(format='%H:%M') unexpected keyword argument format

2012-04-18 Thread villas
Hi Annet,   
Yes,  take a look at the code in gluon/validators.py

Best Regards,  D


On Wednesday, 18 April 2012 07:04:46 UTC+1, Annet wrote:
>
> Hi Villas,
>
> Thanks for your reply.
>
> IS_TIME() does not format but understands the following formats
>>
>>
> I thought maybe in line with IS_DATE(format='') and IS_DATETIME(format='') 
> IS_TIME would have a format property as well.
>  
>
>> Otherwise I think you'll have to make your own validator which I don't 
>> think would be too difficult.
>>
>
> I'll create my own validator.
>
>
> Kind regards,
>
> Annet 
>


[web2py] Error with mssql database : Field is a reserved SQL word

2012-04-18 Thread Khalil KHAMLICHI
Hi,

I am trying to create an interface to sort of manage the database of a
windows software (a very common need actually), this database is under
Microsoft SQL Server 2008 Express Edition, and one of its mean tables has a
field called 'Order' which is a reserved word in SQL language, and using
this database is just impossible from web2py because of this field name.

whenever I try to use this table I ge this error :


127.0.0.1.2012-04-18.11-58-36.d24a6ea4-8275-4626-8d72-f464db6b9e24
 ('42000', "[42000] [Microsoft][ODBC SQL
Server Driver][SQL Server]Incorrect syntax near the keyword 'Order'. (156)
(SQLExecDirectW)")

I think this question shoud go to pyodbc mailing list ... but I thought
maybe someone over here has any suggestions.

Thanks in advance.


[web2py] Re: display a list of the database entries

2012-04-18 Thread BlueShadow
Oh well it was actually pretty easy. Thanks guys


Re: [web2py] official book vs web2py cookbook

2012-04-18 Thread Johann Spies
On 18 April 2012 12:25, Gour  wrote:

> How does web2py development cookbook compare with the official 'book'?
>
> Is official one supposed to be the 1st one read when learning web2py
> followed by development book or they can be read in parallel?
>
>
You can read them in parallel.  The Cookbook add some information (and of
cause recipies) from which one can learn.

They are different.  The Cookbook is not a reference while the official
book is to a certain extend.

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


[web2py] official book vs web2py cookbook

2012-04-18 Thread Gour
How does web2py development cookbook compare with the official 'book'?

Is official one supposed to be the 1st one read when learning web2py
followed by development book or they can be read in parallel?


Sincerely,
Gour

-- 
What is night for all beings is the time of awakening 
for the self-controlled; and the time of awakening for 
all beings is night for the introspective sage.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: memory 210%

2012-04-18 Thread Gour
On Wed, 18 Apr 2012 13:01:31 +0300
Vasile Ermicioi  wrote:

> from my experience, uwsgi uses less memory than gunicorn,

Thank you.

> I managed to use uwsgi on webfaction when they provided only 80Mb RAM
> (now they provide 256Mb)

I was using webfaction before migrating to djangohosting.ch which is,
imho, more flexible.

btw, do you use just uwsgi or it is behind some webserver?


Sincerely,
Gour

-- 
Perform your prescribed duty, for doing so is better than not 
working. One cannot even maintain one's physical body without work.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Please help me to understand the use of components and ajax in this case

2012-04-18 Thread Johann Spies
When the details of the journal is viewed, there is a button inviting the 
viewer to click in order to show articles published by this journal.

I want then a grid to appear below the journal details.

If I just put a 
{{=LOAD('default', 'joernaalartikels.load', ajax=True)}}')}}',


in the view the grid appears with the relevant data.

I want to shift that action to a 'onclick' linked to the submit button.

This is not working:

In the Controller:

wys_artikels = FORM(INPUT(_type='submit',
_value = T('Click to view articles'),
_onclick = "ajax('joernaalartikels', [], 
'artikels')"))


And in the view: 

{{=wys_artikels}}




A click on the submit button just loads to a reload of the whole page even 
if I change the controller to 

wys_artikels = FORM(INPUT(_type='submit',
_value = T('Click to view articles'),
_onclick = "ajax('joernaalartikels.load', [], 
'artikels')"))


How do I get the component to load after a click?

Regards
Johann



Re: [web2py] Re: memory 210% (was Re: CPU 210%)

2012-04-18 Thread Vasile Ermicioi
from my experience, uwsgi uses less memory than gunicorn,
I managed to use uwsgi on webfaction when they provided only 80Mb RAM (now
they provide 256Mb)


[web2py] Re: memory 210% (was Re: CPU 210%)

2012-04-18 Thread Gour
On Wed, 18 Apr 2012 11:29:09 +0200
Roberto De Ioris  wrote:

> I am the one you are already talking about it on irc :)

Ohh, you're the uwsgi author?

I thought you're using 'unbit' nick. :-)

> By the way uWSGI is for sure the one consuming less memory (in
> relation to features you get) in the group of preforking/multithreaded
> servers.

That's great to hear.

> You can even rebuild it removing all of the unneeded features.

Even cooler.

> It is built expecially for shared hosting with limited
> processes/threads and memory so you will find options to limit its
> memory or to trigger reload on specific conditions (or exceptions).

Wonderful.

So, you mean using just uwsgi?

> Obviously it has a very high learning curve, so be prepared for some
> headache (but it will payback for sure).

OK, np.

> Another popular solution (in pure python this time) is gunicorn, it
> is in the spirit "do only one thing, do it well", so from a
> programmer point of view it is a lot more appealing than uWSGI (that
> is sysadmins-oriented). It has no threads support, so you have to
> rely on processes and some external tool if you want to
> monitor/manage your app.

I'll take a look. Thanks for the pointer, although uwsgi sounds more
appropriate.


Sincerely,
Gour

-- 
One who restrains his senses, keeping them under full control, 
and fixes his consciousness upon Me, is known as a man of 
steady intelligence.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] memory 210% (was Re: CPU 210%)

2012-04-18 Thread Roberto De Ioris

Il giorno 18/apr/2012, alle ore 11:11, Gour ha scritto:

> On Wed, 18 Apr 2012 08:54:29 +0200
> "Roberto De Ioris"  wrote:
> 
>> By the way, it is pretty strange you found 'threading' support a
>> uwsgi-blocker as very few (maybe 3-4, uWSGI included) production-grade
>> WSGI servers seriously supports them (with mod_wsgi having the better
>> implementation for sure).
> 
> What method/server would you recommend for running few smaller
> low-traffic  web2py-powered sites on a host which allows me to use 
> 100MB & 50 processes, iow. memory is the bottleneck?
> 
> I'm looking into uwsgi, but wonder if there is something better
> memory-wise?
> 

I am the one you are already talking about it on irc :)

By the way uWSGI is for sure the one consuming less memory (in relation to 
features you get) in the group of preforking/multithreaded servers.

You can even rebuild it removing all of the unneeded features.

It is built expecially for shared hosting with limited processes/threads and 
memory so you will find options to limit its memory or to trigger
reload on specific conditions (or exceptions).

Obviously it has a very high learning curve, so be prepared for some headache 
(but it will payback for sure).

Another popular solution (in pure python this time) is gunicorn, it is in the 
spirit "do only one thing, do it well", so from a programmer point of view
it is a lot more appealing than uWSGI (that is sysadmins-oriented). It has no 
threads support, so you have to rely on processes and some external tool if you 
want to monitor/manage your app.

--
Roberto De Ioris
http://unbit.it
JID: robe...@jabber.unbit.it



[web2py] Re: heroku, web2py and gunicorn

2012-04-18 Thread Rahul
Thanks! David. So I'll continue testing on CentOs then..  Lets see what 
Massimo has to say for the issue /error reported earlier.

Thanks, Rahul D

On Wednesday, April 18, 2012 2:29:08 PM UTC+5:30, David Marko wrote:
>
> * fcntl* is related to UNIX. As I know gunicorn is not intended to work 
> on Windows because of internal design.
>
> David
>
> Dne středa, 18. dubna 2012 10:34:53 UTC+2 Rahul napsal(a):
>>
>> Also tried this on Win7 with web2py from trunk,  it gives me below issue 
>> - Simply trying to start web2py using anyserver and gunicorn on default 
>> port (no command line options called). So we have 2 issues one reported 
>> earlier on centos and other on win7(this issue). Let me know if i am 
>> missing some thing.
>>
>> *web2py>anyserver -s gunicorn*
>> starting *gunicorn *on 127.0.0.1:8000...
>> Traceback (most recent call last):
>>   File "C:\web2py\anyserver.py", line 306, in 
>> main()
>>   File "C:\web2py\anyserver.py", line 303, in main
>> 
>> run(options.server,options.ip,options.port,logging=options.logging,profiler=
>> options.profiler)
>>   File "C:\web2py\anyserver.py", line 165, in run
>> getattr(Servers,servername)(application,(ip,int(port)))
>>   File "C:\web2py\anyserver.py", line 128, in gunicorn
>> from gunicorn.app.base import Application
>>   File "C:\web2py\gluon\custom_import.py", line 293, in _
>> _call__
>> fromlist, level)
>>   File "C:\web2py\gluon\custom_import.py", line 78, in __
>> call__
>> level)
>>   File 
>> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\app\bas
>> e.py", line 12, in 
>> from gunicorn.glogging import Logger
>>   File "C:\web2py\gluon\custom_import.py", line 293, in _
>> _call__
>> fromlist, level)
>>   File "C:\web2py\gluon\custom_import.py", line 78, in __
>> call__
>> level)
>>   File 
>> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\gloggin
>> g.py", line 19, in 
>> from gunicorn import util
>>   File "C:\web2py\gluon\custom_import.py", line 293, in _
>> _call__
>> fromlist, level)
>>   File "C:\web2py\gluon\custom_import.py", line 78, in __
>> call__
>> level)
>>   File 
>> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\util.py
>> ", line 17, in 
>> import fcntl
>>   File "C:\web2py\gluon\custom_import.py", line 293, in _
>> _call__
>> fromlist, level)
>>   File "C:\web2py\gluon\custom_import.py", line 78, in __
>> call__
>> level)
>> *ImportError: No module named fcntl*
>>
>>
>> *Sincerely, Rahul D.*
>>
>> On Wednesday, April 18, 2012 1:44:48 PM UTC+5:30, Rahul wrote:
>>>
>>> I tried with the latest code in trunk - There seems to be some issue. It 
>>> ignores -s or --server= parameters. it always starts rocket server. Please 
>>> see the logs below. 
>>>
>>> *-bash-3.2$ python anyserver.py -s gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> *-bash-3.2$ python anyserver.py --server=gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: --server
>>>
>>>
>>> *-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> *It only starts rocket server*=* This works for me but  
>>> only on rocket*
>>> -bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
>>> starting *rocket on 72.3.247.225:9065*...
>>>
>>> *-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 
>>> 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>> *anyserver.py: error: no such option: --server*
>>>
>>> *-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Usage: anyserver.py [options]
>>>
>>> anyserver.py: error: no such option: -s
>>>
>>> ===Starts rocket ===
>>> *-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
>>> *starting rocket on 72.3.247.225:9065...*
>>>
>>> Please suggest - 
>>>
>>> Thanks, 
>>>
>>> Sincerely, Rahul D. [www.flockbird.com]
>>> =
>>> On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:

 Can you try the anyserver in trunk? Looks like they changed some API.

 On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:
>
> Hi Massimo,
>  I did the typo in the "anyserver.py" file but now I am 
> getting this issue. 
>
> -bash-3.2$ *python anyserver.py -s gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Traceback (most recent call last):
>   File "anyserver.py", line 299, in 
> main()
>   File "anyserver.py", line 295, in main
> 
> run(options.server,options.ip,options.port,logging=optio

[web2py] memory 210% (was Re: CPU 210%)

2012-04-18 Thread Gour
On Wed, 18 Apr 2012 08:54:29 +0200
"Roberto De Ioris"  wrote:

> By the way, it is pretty strange you found 'threading' support a
> uwsgi-blocker as very few (maybe 3-4, uWSGI included) production-grade
> WSGI servers seriously supports them (with mod_wsgi having the better
> implementation for sure).

What method/server would you recommend for running few smaller
low-traffic  web2py-powered sites on a host which allows me to use 
100MB & 50 processes, iow. memory is the bottleneck?

I'm looking into uwsgi, but wonder if there is something better
memory-wise?

Sincererly,
Gour


signature.asc
Description: PGP signature


[web2py] AttributeError: 'str' object has no attribute 'application'

2012-04-18 Thread Johann Spies
I have the following function in a module.  When I comment out the 'links' 
it works without a problem, but with the links active I get the error in 
the subject line:

def artikels(query = None):
db = current.db
if not query:
query = db.akb_articles.id > 0 
   
links = [lambda row: A(T('show article'), _href = URL(r = request, c = 
'default',
  f = 'show_akb_article'
,
  args = row.id
  ))]
fields = [db.akb_articles.title, db.akb_articles.primaryauthor,
  db.akb_articles.authors,
  db.akb_articles.journal, db.akb_articles.pubyear, db.
akb_articles.url]


form = SQLFORM.grid(query,
fields = fields,
orderby = db.akb_articles.title,
maxtextlength = 90,
editable = False, deletable = False,
details = False,
searchable = False,
links = links,
ui = 'jquery-ui')
return form

Why?  

Regards
Johann



[web2py] Re: heroku, web2py and gunicorn

2012-04-18 Thread David Marko
* fcntl* is related to UNIX. As I know gunicorn is not intended to work on 
Windows because of internal design.

David

Dne středa, 18. dubna 2012 10:34:53 UTC+2 Rahul napsal(a):
>
> Also tried this on Win7 with web2py from trunk,  it gives me below issue - 
> Simply trying to start web2py using anyserver and gunicorn on default port 
> (no command line options called). So we have 2 issues one reported earlier 
> on centos and other on win7(this issue). Let me know if i am missing some 
> thing.
>
> *web2py>anyserver -s gunicorn*
> starting *gunicorn *on 127.0.0.1:8000...
> Traceback (most recent call last):
>   File "C:\web2py\anyserver.py", line 306, in 
> main()
>   File "C:\web2py\anyserver.py", line 303, in main
> 
> run(options.server,options.ip,options.port,logging=options.logging,profiler=
> options.profiler)
>   File "C:\web2py\anyserver.py", line 165, in run
> getattr(Servers,servername)(application,(ip,int(port)))
>   File "C:\web2py\anyserver.py", line 128, in gunicorn
> from gunicorn.app.base import Application
>   File "C:\web2py\gluon\custom_import.py", line 293, in _
> _call__
> fromlist, level)
>   File "C:\web2py\gluon\custom_import.py", line 78, in __
> call__
> level)
>   File 
> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\app\bas
> e.py", line 12, in 
> from gunicorn.glogging import Logger
>   File "C:\web2py\gluon\custom_import.py", line 293, in _
> _call__
> fromlist, level)
>   File "C:\web2py\gluon\custom_import.py", line 78, in __
> call__
> level)
>   File 
> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\gloggin
> g.py", line 19, in 
> from gunicorn import util
>   File "C:\web2py\gluon\custom_import.py", line 293, in _
> _call__
> fromlist, level)
>   File "C:\web2py\gluon\custom_import.py", line 78, in __
> call__
> level)
>   File 
> "C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\util.py
> ", line 17, in 
> import fcntl
>   File "C:\web2py\gluon\custom_import.py", line 293, in _
> _call__
> fromlist, level)
>   File "C:\web2py\gluon\custom_import.py", line 78, in __
> call__
> level)
> *ImportError: No module named fcntl*
>
>
> *Sincerely, Rahul D.*
>
> On Wednesday, April 18, 2012 1:44:48 PM UTC+5:30, Rahul wrote:
>>
>> I tried with the latest code in trunk - There seems to be some issue. It 
>> ignores -s or --server= parameters. it always starts rocket server. Please 
>> see the logs below. 
>>
>> *-bash-3.2$ python anyserver.py -s gunicorn*
>> starting gunicorn on 127.0.0.1:8000...
>> Usage: anyserver.py [options]
>>
>> anyserver.py: error: no such option: -s
>>
>> *-bash-3.2$ python anyserver.py --server=gunicorn*
>> starting gunicorn on 127.0.0.1:8000...
>> Usage: anyserver.py [options]
>>
>> anyserver.py: error: no such option: --server
>>
>>
>> *-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>> starting gunicorn on 72.3.247.225:9065...
>> Usage: anyserver.py [options]
>>
>>
>> anyserver.py: error: no such option: -s
>>
>> *It only starts rocket server*=* This works for me but  only 
>> on rocket*
>> -bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
>> starting *rocket on 72.3.247.225:9065*...
>>
>> *-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 
>> 9065*
>> starting gunicorn on 72.3.247.225:9065...
>> Usage: anyserver.py [options]
>>
>> *anyserver.py: error: no such option: --server*
>>
>> *-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
>> starting gunicorn on 72.3.247.225:9065...
>> Usage: anyserver.py [options]
>>
>> anyserver.py: error: no such option: -s
>>
>> ===Starts rocket ===
>> *-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
>> *starting rocket on 72.3.247.225:9065...*
>>
>> Please suggest - 
>>
>> Thanks, 
>>
>> Sincerely, Rahul D. [www.flockbird.com]
>> =
>> On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:
>>>
>>> Can you try the anyserver in trunk? Looks like they changed some API.
>>>
>>> On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:

 Hi Massimo,
  I did the typo in the "anyserver.py" file but now I am getting 
 this issue. 

 -bash-3.2$ *python anyserver.py -s gunicorn*
 starting gunicorn on 127.0.0.1:8000...
 Traceback (most recent call last):
   File "anyserver.py", line 299, in 
 main()
   File "anyserver.py", line 295, in main
 
 run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
   File "anyserver.py", line 157, in run
 getattr(Servers,servername)(application,(ip,int(port)))
   File "anyserver.py", line 129, in gunicorn
 gunicorn.arbiter.Arbiter(address, 4, app).run()
 TypeError: __init__() takes exactly 2 arguments (4 given)
 ===
 Same case for c

[web2py] Re: heroku, web2py and gunicorn

2012-04-18 Thread Rahul
Also tried this on Win7 with web2py from trunk,  it gives me below issue - 
Simply trying to start web2py using anyserver and gunicorn on default port 
(no command line options called). So we have 2 issues one reported earlier 
on centos and other on win7(this issue). Let me know if i am missing some 
thing.

*web2py>anyserver -s gunicorn*
starting *gunicorn *on 127.0.0.1:8000...
Traceback (most recent call last):
  File "C:\web2py\anyserver.py", line 306, in 
main()
  File "C:\web2py\anyserver.py", line 303, in main

run(options.server,options.ip,options.port,logging=options.logging,profiler=
options.profiler)
  File "C:\web2py\anyserver.py", line 165, in run
getattr(Servers,servername)(application,(ip,int(port)))
  File "C:\web2py\anyserver.py", line 128, in gunicorn
from gunicorn.app.base import Application
  File "C:\web2py\gluon\custom_import.py", line 293, in _
_call__
fromlist, level)
  File "C:\web2py\gluon\custom_import.py", line 78, in __
call__
level)
  File 
"C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\app\bas
e.py", line 12, in 
from gunicorn.glogging import Logger
  File "C:\web2py\gluon\custom_import.py", line 293, in _
_call__
fromlist, level)
  File "C:\web2py\gluon\custom_import.py", line 78, in __
call__
level)
  File 
"C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\gloggin
g.py", line 19, in 
from gunicorn import util
  File "C:\web2py\gluon\custom_import.py", line 293, in _
_call__
fromlist, level)
  File "C:\web2py\gluon\custom_import.py", line 78, in __
call__
level)
  File 
"C:\Python27\lib\site-packages\gunicorn-0.14.2-py2.7.egg\gunicorn\util.py
", line 17, in 
import fcntl
  File "C:\web2py\gluon\custom_import.py", line 293, in _
_call__
fromlist, level)
  File "C:\web2py\gluon\custom_import.py", line 78, in __
call__
level)
*ImportError: No module named fcntl*


*Sincerely, Rahul D.*

On Wednesday, April 18, 2012 1:44:48 PM UTC+5:30, Rahul wrote:
>
> I tried with the latest code in trunk - There seems to be some issue. It 
> ignores -s or --server= parameters. it always starts rocket server. Please 
> see the logs below. 
>
> *-bash-3.2$ python anyserver.py -s gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: -s
>
> *-bash-3.2$ python anyserver.py --server=gunicorn*
> starting gunicorn on 127.0.0.1:8000...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: --server
>
>
> *-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
>
> anyserver.py: error: no such option: -s
>
> *It only starts rocket server*=* This works for me but  only 
> on rocket*
> -bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
> starting *rocket on 72.3.247.225:9065*...
>
> *-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 
> 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
> *anyserver.py: error: no such option: --server*
>
> *-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
> starting gunicorn on 72.3.247.225:9065...
> Usage: anyserver.py [options]
>
> anyserver.py: error: no such option: -s
>
> ===Starts rocket ===
> *-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
> *starting rocket on 72.3.247.225:9065...*
>
> Please suggest - 
>
> Thanks, 
>
> Sincerely, Rahul D. [www.flockbird.com]
> =
> On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:
>>
>> Can you try the anyserver in trunk? Looks like they changed some API.
>>
>> On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:
>>>
>>> Hi Massimo,
>>>  I did the typo in the "anyserver.py" file but now I am getting 
>>> this issue. 
>>>
>>> -bash-3.2$ *python anyserver.py -s gunicorn*
>>> starting gunicorn on 127.0.0.1:8000...
>>> Traceback (most recent call last):
>>>   File "anyserver.py", line 299, in 
>>> main()
>>>   File "anyserver.py", line 295, in main
>>> 
>>> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>>>   File "anyserver.py", line 157, in run
>>> getattr(Servers,servername)(application,(ip,int(port)))
>>>   File "anyserver.py", line 129, in gunicorn
>>> gunicorn.arbiter.Arbiter(address, 4, app).run()
>>> TypeError: __init__() takes exactly 2 arguments (4 given)
>>> ===
>>> Same case for custom ip and port
>>> ===
>>> -bash-3.2$ *python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>>> starting gunicorn on 72.3.247.225:9065...
>>> Traceback (most recent call last):
>>>   File "anyserver.py", line 299, in 
>>> main()
>>>   File "anyserver.py", line 295, in main
>>> 
>>> run(options.server,options.ip,options.port,logging=options.logg

[web2py] Re: heroku, web2py and gunicorn

2012-04-18 Thread Rahul
I tried with the latest code in trunk - There seems to be some issue. It 
ignores -s or --server= parameters. it always starts rocket server. Please 
see the logs below. 

*-bash-3.2$ python anyserver.py -s gunicorn*
starting gunicorn on 127.0.0.1:8000...
Usage: anyserver.py [options]

anyserver.py: error: no such option: -s

*-bash-3.2$ python anyserver.py --server=gunicorn*
starting gunicorn on 127.0.0.1:8000...
Usage: anyserver.py [options]

anyserver.py: error: no such option: --server


*-bash-3.2$ python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
starting gunicorn on 72.3.247.225:9065...
Usage: anyserver.py [options]


anyserver.py: error: no such option: -s

*It only starts rocket server*=* This works for me but  only on 
rocket*
-bash-3.2$ *python anyserver.py  gunicorn -i 72.3.247.225 -p 9065*
starting *rocket on 72.3.247.225:9065*...

*-bash-3.2$ python anyserver.py --server="gunicorn" -i 72.3.247.225 -p 9065*
starting gunicorn on 72.3.247.225:9065...
Usage: anyserver.py [options]

*anyserver.py: error: no such option: --server*

*-bash-3.2$ python anyserver.py -s "gunicorn" -i 72.3.247.225 -p 9065*
starting gunicorn on 72.3.247.225:9065...
Usage: anyserver.py [options]

anyserver.py: error: no such option: -s

===Starts rocket ===
*-bash-3.2$ python anyserver.py  "gunicorn" -i 72.3.247.225 -p 9065*
*starting rocket on 72.3.247.225:9065...*

Please suggest - 

Thanks, 

Sincerely, Rahul D. [www.flockbird.com]
=
On Tuesday, April 17, 2012 8:54:58 PM UTC+5:30, Massimo Di Pierro wrote:
>
> Can you try the anyserver in trunk? Looks like they changed some API.
>
> On Tuesday, 17 April 2012 05:43:51 UTC-5, Rahul wrote:
>>
>> Hi Massimo,
>>  I did the typo in the "anyserver.py" file but now I am getting 
>> this issue. 
>>
>> -bash-3.2$ *python anyserver.py -s gunicorn*
>> starting gunicorn on 127.0.0.1:8000...
>> Traceback (most recent call last):
>>   File "anyserver.py", line 299, in 
>> main()
>>   File "anyserver.py", line 295, in main
>> 
>> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>>   File "anyserver.py", line 157, in run
>> getattr(Servers,servername)(application,(ip,int(port)))
>>   File "anyserver.py", line 129, in gunicorn
>> gunicorn.arbiter.Arbiter(address, 4, app).run()
>> TypeError: __init__() takes exactly 2 arguments (4 given)
>> ===
>> Same case for custom ip and port
>> ===
>> -bash-3.2$ *python anyserver.py -s gunicorn -i 72.3.247.225 -p 9065*
>> starting gunicorn on 72.3.247.225:9065...
>> Traceback (most recent call last):
>>   File "anyserver.py", line 299, in 
>> main()
>>   File "anyserver.py", line 295, in main
>> 
>> run(options.server,options.ip,options.port,logging=options.logging,profiler=options.profiler)
>>   File "anyserver.py", line 157, in run
>> getattr(Servers,servername)(application,(ip,int(port)))
>>   File "anyserver.py", line 129, in gunicorn
>> gunicorn.arbiter.Arbiter(address, 4, app).run()
>> TypeError: __init__() takes exactly 2 arguments (4 given)
>>
>> Please suggest what could be wrong. I am new to gunicorn and anyserver. 
>> Also direct me to some quality documentation for anyserver.py 
>>
>>
>> Thanks, 
>> Sincerely,  Rahul D.
>>
>>
>> On Friday, July 22, 2011 8:36:11 PM UTC+5:30, Massimo Di Pierro wrote:
>>>
>>> Hello everybody, 
>>>
>>> heroku will be supporting web2py. They run gunicorn. web2py runs with 
>>> gunicorn but I have never tried it. 
>>>
>>> Any volunteer to run some stress tests? 
>>>
>>> cd web2py 
>>> python anyserver -s gunicorn 
>>>
>>> Massimo
>>
>>

[web2py] Re: display a list of the database entries

2012-04-18 Thread BlueShadow
Thanks guys. I want to display them in the left sidebar (which is in my 
layout). That would mean I have to give each function the list of the 
articles?
or is there a diffrent way?


[web2py] E-Form

2012-04-18 Thread IVINH

Hi all,

I want to develop e-form applications by web2py.
You have any experience please share me.
I found this link, it says on the features I need:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0904db2electronicforms/

Thank you very much.


Re: [web2py] Custom attributes in

2012-04-18 Thread Jon Molesa
Thank you very much Bruno.

*On Sun, Apr 15, 2012 at 12:10:02AM -0300 Bruno Rocha  
wrote:

> Date: Sun, 15 Apr 2012 00:10:02 -0300
> From: Bruno Rocha 
> Subject: Re: [web2py] Custom attributes in 
> To: web2py@googlegroups.com
> 
>DIV(, **{"_data-role": "something"})
> 
>[1]http://zerp.ly/rochacbruno
> 
>Em 14/04/2012 22:24, "Jon Molesa" <[2]rjmol...@gmail.com> escreveu:
> 
>  Does the div class support hyphenated attribute names
>  data-role="listview"? I can't seem to get it to work. I can get
>  _dat_role and _datarole to work, but any attempt to use _data-role
>  causes an error.
> 
>  --
>  Jon Molesa
>  [3]rjmol...@gmail.com
> 
> References
> 
>Visible links
>1. http://zerp.ly/rochacbruno
>2. mailto:rjmol...@gmail.com
>3. mailto:rjmol...@gmail.com
---end quoted text---

-- 
Jon Molesa
rjmol...@gmail.com