[web2py] Re: tornado 403 with websocket messaging

2015-05-30 Thread Serbitar
Ok. On Thursday, May 28, 2015 at 7:33:41 AM UTC+2, Massimo Di Pierro wrote: > > Can you submit a pull request? > > On Monday, 25 May 2015 11:54:35 UTC-5, Serbitar wrote: >> >> >> >> to fix this: >> >> >> http://stackoverflow.com/questions/2

[web2py] tornado 403 with websocket messaging

2015-05-25 Thread Serbitar
to fix this: http://stackoverflow.com/questions/24851207/tornado-403-get-warning-when-opening-websocket with current web2py and tornado 4+ you have to modify: gluon/contrib/websocket_messaging.py to class DistributeHandler(tornado.websocket.WebSocketHandler): def check_origin(self, or

[web2py] Re: How to set the Pythonpath for the Scheduler

2014-08-21 Thread Serbitar
env PYTHONPATH=/srv/example/src/example/ > > > > > On Thursday, August 21, 2014 9:44:51 AM UTC+2, Serbitar wrote: >> >> I want to use modules not in the standard PYTHONPATH to be used by tasks >> in the web2py sheduler. >> How do I change the PYTHONPATH

[web2py] How to set the Pythonpath for the Scheduler

2014-08-21 Thread Serbitar
I want to use modules not in the standard PYTHONPATH to be used by tasks in the web2py sheduler. How do I change the PYTHONPATH for a scheduler configured using the web2py-scheduler.conf in init. I tried exporting the PYTHONPATH there, but it didnt work, -- Resources: - http://web2py.com - htt

[web2py] Problem with callback, eval and flash

2014-01-02 Thread Serbitar
I have a controller like this: def test(): return 'jQuery(".flash").html("test2").slideDown();' and a view like this: {{=A("Testbutton", callback=URL('test'),target=':eval', _class='btn')}} When I push the button, nothing is happening. However this works in the view: jQuery(".flash").ht

[web2py] Re: flash after callback

2013-03-26 Thread Serbitar
Solved it myself. The target should be ':eval' like this: in the view: {{=A('func', callback('func'), target=':eval')}} in the controller: def func(): return 'jQuery(".flash").html("test").slideDown().delay(1000).slideUp();&

[web2py] flash after callback

2013-03-26 Thread Serbitar
Hi folks, I am trying to do a session.flash after a function is called via A('func', callback('func')). A simple session.flash in the callback function like: def func(): session.flash('test') return dict() is not working. I found an old thread that suggests: def func(): return 'jQue

[web2py] Re: custom.widget manipulation with checkboxes

2012-02-09 Thread Serbitar
Got the solution myself. The right code is: form.custom.widget['myfield']['_checked'] = db((db.mytable.id==id).select(db.mytable.myfield).first() #updated form.custom.widget['myfield']._postprocessing() On 6 Feb., 17:55, Serbitar wrote: > I can do somethi

[web2py] custom.widget manipulation with checkboxes

2012-02-06 Thread Serbitar
I can do something like this: fields = [Field('myfield', type = integer, default = db((db.mytable.id==id).select(db.mytable.myfield).first()] form=SQLFORM.factory( *fields) if form.accepts(request.vars, session): db(db.mytable.id==id).update(myfield=form.vars[entry]) form.custom.widget['my

[web2py] Re: update with variable field (stored in variable)

2012-02-06 Thread Serbitar
works like a charm. Thanks a ton. On Feb 5, 9:15 pm, Anthony wrote: > On Sunday, February 5, 2012 2:04:13 PM UTC-5, Serbitar wrote: > > > I need to do something like this: > > > variable_field = 'val1' > > x = 2 > > id = 1 > > > db.def

[web2py] update with variable field (stored in variable)

2012-02-05 Thread Serbitar
I need to do something like this: variable_field = 'val1' x = 2 id = 1 db.define_table('a', Field('name', type = 'integer'), Field('val1', type = 'integer'), Field('val2', type = 'integer') ) db(db.a.id==id).update(variable_field=x) this obviously doesnt work. Any way to do that?

[web2py] Re: sqltable and virtual fields

2011-09-16 Thread Serbitar
Thanks a lot. This should really somehow be integrated into web2py. On Sep 16, 5:48 pm, Lazarof wrote: > Hello, try this. > >  http://snipt.net/rochacbruno > Lazarof > > On 16 сен, 17:25, Serbitar wrote: > > > > > > > > > Is there any way to display

[web2py] Re: sqltable and virtual fields

2011-09-16 Thread Serbitar
sent message to early. second part: result = [row.field1, row.field2, row.virtualfield] Are there any other ways? selecting db.table.ALL and then filtering using field = ["field1", "virtualfield"] like massimo susgested in another post does not work (SQLTABLE has no "fields" argument).

[web2py] sqltable and virtual fields

2011-09-16 Thread Serbitar
Is there any way to display virtual fields using SQLTABLE ? THe only way Ive found to display virtual fields is by explicitly calling them from the rows object like: result = [] for row in rows:

[web2py] Re: Crud.update Multiple

2011-09-12 Thread Serbitar
ars.items(): >         db(mytable.id==key[5:]).update(myfield = value) > > form.process().accepted is the same as form.accepted(request,session) > but shorter. > > On Sep 10, 2:55 pm, Serbitar wrote: > > > > > is there any way to update multiple records with crud.updat

[web2py] Re: Crud.update Multiple

2011-09-11 Thread Serbitar
irst rows you want to insert > > for field1, field2, field3 in list1 >     db.person.insert(field1=field1, field2=field2, field3=field3) >     db.commit # or you wait and the end of the loop better only one commit > > Richard > > > > > > > > On Sat, Sep

[web2py] Re: Crud.update Multiple

2011-09-10 Thread Serbitar
To be more specific: Multiple records (found via a query), all with different values of course and one text field for each record. Just one submit button. On Sep 10, 9:55 pm, Serbitar wrote: > is there any way toupdatemultiplerecordswith crud.update, or evenrecordswith > a given query?

[web2py] Crud.update Multiple

2011-09-10 Thread Serbitar
is there any way to update multiple records with crud.update, or even records with a given query?

[web2py] Re: recursive sum in virtual fields

2011-04-18 Thread Serbitar
Thanks, that worked. Unfortunetely, the problem is a little more complicated now. In my example I want to sum over virtual fields (which is the problem now after eleminating the endless recursion). Now the simplest example would be like this: db.define_table('item', Field('unit_price','double

[web2py] recursive sum in virtual fields

2011-04-18 Thread Serbitar
Consider: db.define_table('item', Field('unit_price','double')) db.define_table('order_item', Field('item',db.item), Field('quantity','integer')) I want to create a virtual field item_count, in item, that is the sum of the entries in order_item with order_item.item = item.id I trie

[web2py] Re: Dynamic virtual fields

2011-04-10 Thread Serbitar
OK got it. Lambda functions dont save their scope. Here is the right code: list = ["a","b","c","d"] fields = [] for entry in list: fields += [Field(entry, type="string")] db.define_table('test', *fields) class MyVirtualFields(object): pass def get_func(value): def func(self):

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
Strange. My example from earlier does not work. It returns always the last call from func. list = ["a","b","c","d"] fields = [] for entry in list: fields += [Field(entry, type="string")] db.define_table('test', *fields) class MyVirtualFields(object): pass for entry in list: def func

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
Next question is: How do I attach a label to a virtual field?

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
Right. My problem was not the function itself, but how to generally create a dynamic virtual field with dynamic fields as computation variables (in this case from a given list). On Apr 10, 12:02 am, Anthony wrote: > To create virtual fields, you first have to define a class, such as: > > class My

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
Have the solution: Dynamic Fields: list = ["a","b","c","d"] fields = [] for entry in list: fields += [Field(entry, type="string")] db.define_table('test', *fields) Dynamic virtual Fields: class MyVirtualFields(object): pass for entry in list: def func(self): return getattr

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
out there do not like the use of eval, and will > criticize it right away. I use it when it is necessary. > NEVER USE EVAL WHEN THERE IS CHANCE OF USER INPUT IN UNPROCESSED FORM > BEING PART OF WHAT YOU EVAL, because you open a way to get hacked. > NEVER FORGET THIS! > > This is

[web2py] Re: Dynamic virtual fields

2011-04-09 Thread Serbitar
Sorry, misstyped and sent the message early. So once again: I can create database fields from a list like this: list = ["a","b","c","d"] fields = [] for entry in list: fields += [Field(entry, type="string")] db.define_table('test', *fields) Now I want to have a virtual field for each field i

[web2py] Dynamic virtual fields

2011-04-09 Thread Serbitar
I can create Datbase fields from a list like this: list = [a,b,c,d] fields = [] for entry in list:

[web2py] Re: Function is evaluated twice?

2011-04-03 Thread Serbitar
ing called > twice. A broken link in the page like make cause > that. > > Mind that a function that inserts without a form posting is vulnerable > to URL redirection attacks. > > On Apr 2, 4:55 pm, Serbitar wrote: > > > > > > > > > I have the co

[web2py] Function is evaluated twice?

2011-04-02 Thread Serbitar
I have the controller: @auth.requires_login() def roll(): if request.args(0): step = int(request.args(0)) else: return dict(message = "Roll it!") if request.args(1): visible = False else: visible = True result = util.roll_step(step) db.live.i

[web2py] Re: Change select options depending on other form variable

2010-07-24 Thread Serbitar
Seems like there is no jqeury function to do it. Any other ways to approach the problem?

[web2py] Change select options depending on other form variable

2010-07-22 Thread Serbitar
Thanks to the manual I know how I can hide a form widget depending on other form variables with jquery. However I have no Idea how to change other form properties, for example the options that can be selected in a drop down menu, depending on, for example, the selection in a second drop down menu.

[web2py] Changing default value in SELECT

2010-07-09 Thread Serbitar
The following code: test = SELECT("1","2", value = "2") test.attributes["value"] = "1" still renders as: 1 2 I have no idea why . . .

[web2py:36767] Re: loop over tables in db

2009-12-08 Thread Serbitar
Should have looked a little deeper. The solution is: --- tables = [table1, table2, table3] for table in tables: db[table].insert(field="something") --- On 8 Dez., 12:15, Serbitar wrote: > how would I loop over a list of table names to insert something into > each o

[web2py:36762] loop over tables in db

2009-12-08 Thread Serbitar
how would I loop over a list of table names to insert something into each of them? like: --- tables = [table1, table2, table3] for table in tables: db.table.insert(field="something") --- this oviously fails because there is no table named "table". Any hints? -- You received this message be