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
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
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
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
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
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();&
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
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
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
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
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?
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
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).
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:
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
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
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?
is there any way to update multiple records with crud.update, or even
records with a given query?
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
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
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):
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
Next question is:
How do I attach a label to a virtual field?
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
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
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
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
I can create Datbase fields from a list like this:
list = [a,b,c,d]
fields = []
for entry in list:
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
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
Seems like there is no jqeury function to do it. Any other ways to
approach the problem?
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.
The following code:
test = SELECT("1","2", value = "2")
test.attributes["value"] = "1"
still renders as:
1
2
I have no idea why . . .
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
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
35 matches
Mail list logo