[web2py] Re: passing value to xml

2011-03-20 Thread b0j3
Thanks, guys.
That helped.
I also found out (not reading the manual - manly I am), that putting
@service.xml before the definition in controller means the xml return
is somewhat mandatory, but you have to use xml in your URL e.g.:
http://example.com/example/default/call/xml/controller/pass_value

Boštjan

On 20 mar., 20:14, Kevin Ivarsen  wrote:
> To expand on DenesL's reply, from your controller you would access these
> values in the following ways:
>
> Forhttp://example.com/app/controller/service.xml/somevalueyou would use:
>   request.args(0) # returns "somevalue", or None if nothing is provided
>
> Forhttp://example.com/app/controller/service.xml?key=somevalueyou would
> use:
>   request.vars.get('key')  # returns "somevalue", or None if a key is not
> specified
>
> Hope that helps,
> Kevin


[web2py] passing value to xml

2011-03-20 Thread b0j3
Hi!

I'm using service.xml to return value and the call is:

http://server.com/service.xml

I'd like to pass a key value, so I can distinguish users. Is there a
way to pass a key value?
Any suggestions?

I thought to just add a html view and pass the key through that and
then use session to see if it's the same user, but I'd like to stay in
XML even if I have to pass the key  with every call.

Thanks for help,

Boštjan


[web2py] Re: cron doesn't work

2011-02-17 Thread b0j3
According to my understanding of web2py book you should use hard coded
cron, which means the system one.


On 17 feb., 12:03, LightOfMooN  wrote:
> Have somebody know any solution for this problem?
>
> On 17 фев, 13:08, b0j3  wrote:
>
> > I tried the same on my cron (just working on it) and it looks like it
> > doesn't run when web2py is run in wsgi under Apache2.
> > When I start it with python web2py works w/o a problem.
> > Strange.
>
> > B.
>
> > On 17 feb., 08:24, LightOfMooN  wrote:
>
> > > How to check, is the cron working?
> > > If i start web2py with command line:
> > > python web2py.py, Cron runs my function once, and after minute prints
> > > error: cannot allocate memory
>
> > > On 16 фев, 20:19, LightOfMooN  wrote:
>
> > > > Hello
> > > > I have web2py installed with setup-web2py-ubuntu.sh
> > > > It runs with Apache mod_wsgi.
>
> > > > Crontab of myapp is:
> > > > */1  *  *  *  *  root  *cron/test
>
> > > > And function:
> > > > def test():
> > > >     shop = db(db.shops.id==8).select().first()
> > > >     new = shop.daystodelete + 1
> > > >     shop.update_record(daystodelete=new)
> > > >     db.commit()
> > > >     return 'done'
> > > > test()
>
> > > > manually function works fine. But not with cron. Seems it's not
> > > > working.
> > > > Any ideas? Thx
>
>


[web2py] Re: cron doesn't work

2011-02-17 Thread b0j3
I tried the same on my cron (just working on it) and it looks like it
doesn't run when web2py is run in wsgi under Apache2.
When I start it with python web2py works w/o a problem.
Strange.

B.

On 17 feb., 08:24, LightOfMooN  wrote:
> How to check, is the cron working?
> If i start web2py with command line:
> python web2py.py, Cron runs my function once, and after minute prints
> error: cannot allocate memory
>
> On 16 фев, 20:19, LightOfMooN  wrote:
>
> > Hello
> > I have web2py installed with setup-web2py-ubuntu.sh
> > It runs with Apache mod_wsgi.
>
> > Crontab of myapp is:
> > */1  *  *  *  *  root  *cron/test
>
> > And function:
> > def test():
> >     shop = db(db.shops.id==8).select().first()
> >     new = shop.daystodelete + 1
> >     shop.update_record(daystodelete=new)
> >     db.commit()
> >     return 'done'
> > test()
>
> > manually function works fine. But not with cron. Seems it's not
> > working.
> > Any ideas? Thx
>
>


[web2py] facebook insights

2011-02-07 Thread b0j3
Hi!

I'd like to use Facebook's insights in web2py, but after adding the
meta tag for the domain to the layout.html,
the only thing I get is "No admin data found.".

Did anybody successfully added Insights to web2py?

Boštjan


[web2py] Re: passing varibales

2011-01-22 Thread b0j3
On 22 jan., 11:47, Rick  wrote:
> Hi,
> My problem is that I want to make a {{=A...}} tag that also changes
> the value of the variable session.variable, and I don't know how to do
> this. I tried with:
> {{=A(("[ < ]"), session.variable=-1,  _href=URL('function'))}}
> ...but it didn't work.

Hi.

I'm not sure if that is a good way to program. Some would say, that
you shouldn't change variable in the view so I don't think (I might be
wrong, though), that it could work like that.


What would you like to achieve?

B.


[web2py] passing json from javascript to controller

2010-11-26 Thread b0j3
Hi!

I'm trying to call controller from javascript using the jquery load:

$.post("todb",{"name": in_name,"desc": in_desc, "location": in_loc});

The problem is that I don't know how to get the json valu passed to
todb controller.
I've tried
@service.json decorator,
adding variable to the function definition and also
gluon.contrib.simplejson.loads(response.body.read())
but I always get an error message.

Do you guys have a recomendation or idea what to do?


[web2py] Re: page redirect

2010-10-19 Thread b0j3
Haha, Seems I forgot to add http://.
It works. Thanks.

Boštjan

On Oct 14, 4:17 pm, mdipierro  wrote:
> you an redirect anywhere with
>
> redirect('http://www.there.com')
>
> or internal URLs with
>
> redirect(URL('controller','function',args=[],vars=dict()))
>
> On Oct 14, 7:23 am,b0j3 wrote:
>
> > Hi!
>
> > I need to open an URL from the controller, but the URL is not part of
> > the domain where web2py runs.
> > So what I would like is Redirect to work on the other URL e.g. my
> > domain iswww.home.com, but I'd like redirect to go towww.there.com.
> > Can that be done?
>
> > Thanks,
>
> > B.
>
>


[web2py] page redirect

2010-10-14 Thread b0j3
Hi!

I need to open an URL from the controller, but the URL is not part of
the domain where web2py runs.
So what I would like is Redirect to work on the other URL e.g. my
domain is www.home.com, but I'd like redirect to go to www.there.com.
Can that be done?

Thanks,

B.


[web2py] Re: adding fields to SQLFORM.factory

2010-09-27 Thread b0j3
Yes. That's it. Thanks
I've missed the asterisk.
B.

On Sep 27, 2:42 pm, mdipierro  wrote:
> fields=[]
> fields.append(Field(...))
> form=SQLFORM.factory(*fields)
>
> On Sep 27, 3:37 am, b0j3  wrote:
>
> > Hi!
>
> > I'd like to add new fields to SQLFORM.factory, but I don't know in
> > advance how many fields are there and their names.
> > So I'd like to create something as tuple with field names and then use
> > for command to cycle through the tuple and create Fields to add to
> > SQLFORM.factory.
>
> > Can something like that be done and how?
> > All examples I see are with already created fields.
>
> > Thanks,
>
> > Boštjan
>
>


[web2py] adding fields to SQLFORM.factory

2010-09-27 Thread b0j3
Hi!

I'd like to add new fields to SQLFORM.factory, but I don't know in
advance how many fields are there and their names.
So I'd like to create something as tuple with field names and then use
for command to cycle through the tuple and create Fields to add to
SQLFORM.factory.

Can something like that be done and how?
All examples I see are with already created fields.

Thanks,

Boštjan