[web2py] db.commit() fails?

2011-01-03 Thread Lucas R. Martins
Hi folks,

i'm try to run the following code:

form=FORM('Nova senha:',
INPUT(_name='new_pass',_type='password',
requires=IS_NOT_EMPTY()),
BR(),'Confirmação:',
INPUT(_name='confirmation',_type='password', requires=
IS_EQUAL_TO(request.vars.new_pass, error_message=T('As senhas não
coincidem'))),BR(),BR(),
INPUT(_type='submit'))

if form.accepts(request.vars, session):
user = db(db.users.name==request.args[0]).select().first()
user.update(pass = request.vars.new_pass)
db.commit()
session.flash = 'Password changed'
redirect(URL('default','index'))



This code runs with no errors, but my database is not being updated. I
put the line "db.commit()", but the problem keep happing.


Anyone can help me?



Lucas R. Martins


[web2py] Re: db.commit() fails?

2011-01-04 Thread Lucas R. Martins

Just worked for me! Thanks.

PS.: This documentation page confused me:
http://web2py.com/book/default/chapter/06#count,-delete,-update


On 3 jan, 15:16, mdipierro  wrote:
> It is not
>
> user.update(pass = request.vars.new_pass)
>
> it is
>
> user.update_record(pass = request.vars.new_pass)
>
> because
>
> user.update(pass = request.vars.new_pass) just updates the user row in
> ram, not the db.
>
> On Jan 3, 11:04 am, "Lucas R. Martins"  wrote:
>
> > Hi folks,
>
> > i'm try to run the following code:
>
> > form=FORM('Nova senha:',
> >             INPUT(_name='new_pass',_type='password',
> > requires=IS_NOT_EMPTY()),
> >             BR(),'Confirmação:',
> >             INPUT(_name='confirmation',_type='password', requires=
> > IS_EQUAL_TO(request.vars.new_pass, error_message=T('As senhas não
> > coincidem'))),BR(),BR(),
> >             INPUT(_type='submit'))
>
> >     if form.accepts(request.vars, session):
> >             user = db(db.users.name==request.args[0]).select().first()
> >             user.update(pass = request.vars.new_pass)
> >             db.commit()
> >             session.flash = 'Password changed'
> >             redirect(URL('default','index'))
>
> > This code runs with no errors, but my database is not being updated. I
> > put the line "db.commit()", but the problem keep happing.
>
> > Anyone can help me?
>
> > Lucas R. Martins
>
>


Re: [web2py] Accessing non-returned items in Views

2012-07-17 Thread Lucas R. Martins

Just curious:

There is a special reason to not simply return the needed dicts?

Em Ter 17 Jul 2012 18:40:00 BRT, adohertyd escreveu:

In my function page2(): I return a dictionary to be accessed by the
page2 HTML view. In the page2 function I have some other dictionaries.
What I want to do to be able to use the non-returned dictionaries in
the HTML code to show some items. This is a sample of what I want:
Hope it's clear

||
defpage2():


Dict1={key1:{keyA:value,keyB:value,keyC:value}
Dict2={key2:{keyD:value,keyE:value,keyF:value}

OtherDict={key:value,key:value...}

returndict(ReturnedDict=OtherDict)


||
page2.html:



{{forx inReturnedDict:}}
{{ifx inDict1:}}
{{=Dict1[x]['keyA']}}{{=Dict1[x]['keyB']
{{elifx inDict2:}}
{{=Dict2[x]['keyD']}}{{=Dict2[x]['keyE']
{{pass}}



--






--





Re: [web2py] BR()

2012-07-25 Thread Lucas R. Martins

You also can use {{=BR()*5}}  or {{=ANYTHING()*5}}

Em Qua 25 Jul 2012 13:51:38 BRT, Toby Shepard escreveu:

In my own html generating libraries, I normally allow
an integer argument to the  maker, which is a count
of how many tags to put out. So:

{{=BR(5)}}

could output 

This works out since the BR tag can't have any components
anyway.

Just a thought. I find it useful at times.

Tobiah




--





Re: [web2py] Re: Generating web2py views for use in PhoneGap?

2012-07-31 Thread Lucas R. Martins

You can generate and use your views and serve it as a common webapp.
Just include phonegap.js

If you are planning an offline only app, you can download and pack your 
content with wget.


--





[web2py] Web2py RAM usage

2012-06-17 Thread Lucas R. Martins
Hi guys,

I'm running a website with ~ 900 urls and no many daily access in a small
vps. I have observed that, when a start the server, this use only 10mb, in
my case.

However, with the time and natural access (specially googlebot), the server
memory usage grow and grows indefinitely until use all server memory.

There is anything to do to limit web2py memory usage and force it to free
unused memory? There is any kind of internal ram cache which can be
disabled?



Thanks.


Re: [web2py] Re: Web2py RAM usage

2012-06-18 Thread Lucas R. Martins
i'm not using web2py-level caching, but i would like to use, if i can limit
memory usage and expire it when i need.
i have compiled app and i'm using sqlite. sqlite is a problem?


2012/6/18 Massimo Di Pierro 

> Are you using caching? Are you using sqlite? We should nail down the cause
> of this problem.
> Did you try to bytecode compile the app?
>
> Massimo
>
>
> On Sunday, 17 June 2012 21:17:01 UTC-5, Lucas R. Martins wrote:
>>
>> Hi guys,
>>
>> I'm running a website with ~ 900 urls and no many daily access in a small
>> vps. I have observed that, when a start the server, this use only 10mb, in
>> my case.
>>
>> However, with the time and natural access (specially googlebot), the
>> server memory usage grow and grows indefinitely until use all server
>> memory.
>>
>> There is anything to do to limit web2py memory usage and force it to free
>> unused memory? There is any kind of internal ram cache which can be
>> disabled?
>>
>>
>>
>> Thanks.
>>
>


Re: [web2py] Re: Web2py RAM usage

2012-06-18 Thread Lucas R. Martins
In my case, i just started web2py server and set up apache2 + proxypass.
I need to change to uwsgi?


2012/6/18 Jon Molesa 

> I can't say for certain now, but I'm pretty sure I switched from
> apache + mod_wsgi to uwsgi. In any case uwsgi is what I've set up on
> my Rackspace server. So far so good. I'm happy with the results. While
> I understand webfaction's need to control resource usage I really
> didn't appreciate that they kept killing my only process, my web
> process. I'm encouraged by your results. Thanks for sharing.
>
> On Mon, Jun 18, 2012 at 7:04 PM, Vasile Ermicioi 
> wrote:
> >
> >> However, webfactiion continually killed my process for going over it's
> >> memory limits. When I asked what was causing this and what I could do to
> >> keep it under my account limit their reply was that this is a common
> >> occurrence with web2py apps. I really didn't have the necessary skills
> to
> >> get to the bottom of it, or the time to invest in acquiring them. I
> decided
> >> to self-host the app on RackSpace Cloud Servers. It was discouraging
> that a
> >> simple running app with no users or traffic would exhaust the allowed
> >> memory. I had their most basic plan which IIRC offers 256 Mb of ram.
> >>
> >
> > I had the same problem with webfaction when I used apache + mod_wsgi,
> > with uwsgi I managed to run under 80Mb ram,
> > 300-500 unique visitors per day, 1000-2000 page views, 600 registered
> users
> > and now they offer 256Mb of RAM
> >
> > uwsgi is great, ask Roberto how he managed to do that :)
> >
> >
>
>
>
> --
> Jon Molesa
> rjmol...@gmail.com
>