[web2py] Re: How to create RSS feed from internal table?

2016-11-25 Thread Alex Glaros
not sure how to even test it... I typed URL into Feedline Reader with this result: "Feed not found at that URL" -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues

[web2py] Re: How to create RSS feed from internal table?

2016-11-25 Thread Alex Glaros
not sure if I'm getting correct response. I might be but don't know how output is supposed to appear. Please let me know if it already correct but I don't realize it. here is complete controller: def feed(): response.view = 'generic.rss' return dict(title="my feed", link="http://feed.ex

[web2py] returning values from custom form

2016-11-25 Thread Jim Russell
Hi. I have created a form which takes a list of hostnames and shows the hostnames with checkboxes next to it. The idea is to be able to uncheck any hostnames and pass the still checked hostnames to another function which will then act on that list of hostnames. The problem is that it just retu

[web2py] Re: import *.csv with before insert callback not work correctly

2016-11-25 Thread 黄祥
it lies on the before insert function, must explicit it convert it's data type *models/db.py* def __before_insert_bonus(f): chosen_employee = db(db.employee.id == f['employee'] ).iterselect().first() if f['is_packing'] == True or f['is_packing'] == 'True': f['packing'] = 1 * int(chosen_employee.p

[web2py] Re: How to create RSS feed from internal table?

2016-11-25 Thread Massimo Di Pierro
add to your controller response.view = 'generic.rss' On Thursday, 24 November 2016 01:18:02 UTC-6, Alex Glaros wrote: > > more questions indicating that I need basic concepts explained: > > Am I supposed to open the view page with a news reader? When pointing to > my desktop (http://127.0.0.1:8

Re: [web2py] Re: Check to establish whether or not a record exists

2016-11-25 Thread Massimo Di Pierro
db.mytable(name=s) is shortcut for db(db.mytable.name==s).select(limitby=(0,1)).first() On Monday, 21 November 2016 09:58:01 UTC-6, Ramos wrote: > > I used this compact way and i noticed it only returns one record. > > for example > > table db.badass > id name value > 1trump 10 > 2

[web2py] Re: Error code: 504-loadbalancer

2016-11-25 Thread Massimo Di Pierro
You probably have controller that is returning an invalid iterable On Monday, 21 November 2016 09:42:54 UTC-6, Alberto Gedaly wrote: > > I am trying to load my website which is hosted on PythonAnywhere but it is > showing me the 504-loadbalancer error. This started happening after I > installed

[web2py] Re: keyerror in update SQLFORM

2016-11-25 Thread Massimo Di Pierro
You cannot do db.page.id.readable = False You have to do SQLFORM(, showid=False) On Monday, 21 November 2016 09:42:54 UTC-6, Gaurav Vichare wrote: > > Posting it again because my last post(7 days old) was not approved. > > I am facing issue while updating record using SQLFORM when readable and

Re: [web2py] Re: web2py_osx on Sierra (OSX 10.12)

2016-11-25 Thread Massimo Di Pierro
Thanks for reporting this. Do you mind opening a ticket? On Monday, 21 November 2016 09:42:54 UTC-6, Jared McFarland wrote: > > I've also run into this. I'm on macOS 10.12.1 > > I downloaded the web2py app from > http://www.web2py.com/examples/static/web2py_osx.zip > > When I try to run it, I get

[web2py] Re: SQLFORM.FACTORY editing a document. Save reports no upload files

2016-11-25 Thread Massimo Di Pierro
You are you doing this: if edit_mode: id = int(request.args[0]) q = db.upload_file.id == id rows = db(q).select() for row in rows: for field in row: if field in db.upload_file.fields: db.upload_file[field].default = row[field] ... fo

[web2py] Re: 502 Bad Gateway - no tmp/web2py.socket file

2016-11-25 Thread Jim Russell
> > $ ps aux | grep "uwsgi" > richard 1044 0.0 0.1 4276 1824 pts/0S+ 10:54 0:00 grep > --color=auto uwsgi > That is the grep process, not uwsgi. So uwsgi is not running. Check in /var/log/nginx/ for any messages about uwsgi -- Resources: - http://web2py.com - http://web2py.

[web2py] Action commit and scheduled task commit racing?

2016-11-25 Thread Albert Rothman
My code has roughly the following form, and I am wondering if this can generate a race condition or if the first insert happens right away: def receive_webhook(): def POST(*args, **vars): db.webhook_table.insert(webhook_data=data, status=0) scheduler.queue_task(process_update) #..

Re: [web2py] Subscription table

2016-11-25 Thread Áureo Dias Neto
Good morning bro, U can use this: Where 'd2' is 'request.now' to get today date and 'd1' is your 'creation_date' variable from datetime import datetime def days_between(d1, d2): d1 = datetime.strptime(d1, "%Y-%m-%d") d2 = datetime.strptime(d2, "%Y-%m-%d") return abs((d2 - d1).days)

[web2py] Re: web2py and self-signed SSL certificates

2016-11-25 Thread andreas
I got a similar error after accessing my local Apache/Web2py site with https but on port 80 (port forwarding on VirtualBox machine). After changing the port to 443 (and the use of the apache VirtualHost directive for 443 including the ssl directives), everything works. I used the commands from

[web2py] Do conditionals short circuit for DAL?

2016-11-25 Thread Albert Rothman
Do conditionals short circuit in DAL queries? Is there a way to force them to. For example I have the following query: count = db((db.webhook_table.status==3) & (db.webhook_table.webhook_data. contains(premsys.form_id))).count() None of the entries have a status of 3, so I expect the query to retu

Re: [web2py] Re: How to add an input field in SQLFORM.grid??

2016-11-25 Thread Paul Ellis
Hi, I am trying to do the same thing as the OP. Add a quantity input field to a grid and then use Callback to work with the product_id and quantity. I just don't seem to be able to pass the quantity to the callback function. Using this method I don't get a value from quantity.

[web2py] how to make Query, without redundance

2016-11-25 Thread Áureo Dias Neto
Hello guys, I'm making a search form, and i need to verify, if, a table is referenced in another table, that's two have a relationship one-to-many. My asking is, i'm make it with a for loop, and it's return a maximum recursion of python objet.. How to dow, a search, in all the table, to check

[web2py] web2py with IIS and Postgresql

2016-11-25 Thread Alvaro Diaz Valenzuela
Hi, I have successfully installed web2py behind IIS on an Azure VM with Windows Server 2012R (following Remco Boerma's great tutorial on youtube). However, I am not able to establish a connection with a postgresql database hosted on AWS. I am pretty sure my connection string is Ok and I have gr

[web2py] Re: Subscription table

2016-11-25 Thread Dave S
On Friday, November 25, 2016 at 5:49:08 AM UTC-8, dirman wrote: > > > I have this newspaper subscription table; > > db.define_table('business_and_financial_times', > Field('subscription', 'boolean', default=False), > Field('creation_date', 'date', default=now), > > Field('subscriptio

[web2py] Re: Scheduler and Serial Port Problems

2016-11-25 Thread Dave S
On Friday, November 25, 2016 at 4:50:34 AM UTC-8, Richard Brown wrote: > > An update to this - I have done some more investigation and discovered > that in the 'Not Working' scenario the RTS output is mostly high but goes > low whilst the port is open, and in the 'Working' scenario the RTS outp

[web2py] Re: weird results when slicing substring field

2016-11-25 Thread Anthony
db.table.long_field[20:100] is an Expression -- the key used to store it is the actual SQL it generates. The best way to access it is to store the expression: substring = db.table.long_field[20:100] ss = db(db.table.id==1).select(db.table.id, substring).first() ss[substring] Regarding accessing

[web2py] weird results when slicing substring field

2016-11-25 Thread lucas
hey one and all, ss = db(db.table.id==1).select(db.table.id, db.table.long_field[20:100]).first() returns weird results. ss = db(db.table.id==1).select(db.table.id, db.table.long_field).first() if you do it without the slicing of the field, you can access it as normal like ss.id or ss.long_fi

[web2py] import *.csv with before insert callback not work correctly

2016-11-25 Thread 黄祥
trying to import *.csv with before insert callback not work correctly (no error occured but the result is not expected) *e.g. * *csv_files_0.csv* TABLE bonus bonus.bonus_date,bonus.employee,bonus.is_packing 2016-11-10,4,1 END *csv_files_1.csv* TABLE bonus bonus.bonus_date,bonus.employee,bonus.is_

Re: [web2py] Re: auth_hasmembership(["admin","supervisor","auditor"]) ?

2016-11-25 Thread António Ramos
can i change auth.has_membership(role) to another user? i need to iterate over all users and find if they belong to some group. I have a list [4,5,1] with the id of the group i need to check. Regards António 2016-11-12 0:08 GMT+00:00 Anthony : > On Friday, November 11, 2016 at 4:15:50 PM UTC-5,

[web2py] Re: how to make Query, which is always "True" (1=1 or so) ?

2016-11-25 Thread Anthony
You can also simply specify a query as raw SQL: db(('1 = 1')).select(db.mytable.ALL) Anthony On Friday, November 25, 2016 at 10:46:44 AM UTC-5, Anthony wrote: > > db.mytable.id > 0 > > Anthony > > On Thursday, November 24, 2016 at 1:03:10 AM UTC-5, Jurgis Pralgauskis > wrote: >> >> Hi, >> >>

[web2py] Re: how to make Query, which is always "True" (1=1 or so) ?

2016-11-25 Thread Anthony
db.mytable.id > 0 Anthony On Thursday, November 24, 2016 at 1:03:10 AM UTC-5, Jurgis Pralgauskis wrote: > > Hi, > >I dynamically generate queries from my search form fields/filters. >and then map reduce the query list... >But if no filter is selected, I get empty list... > > So I

Re: [web2py] Re: how to make Query, which is always "True" (1=1 or so) ?

2016-11-25 Thread Martin Weissenboeck
Could this solve the problem? db.define_table("mytable", Field("myvalue")) mytable contains: 3 selected mytable.id mytable.myvalue 1

[web2py] Subscription table

2016-11-25 Thread dirman
I have this newspaper subscription table; db.define_table('business_and_financial_times', Field('subscription', 'boolean', default=False), Field('creation_date', 'date', default=now), Field('subscription_option',requires=IS_IN_SET((['none','monthly','yearly']))), Field('days','in

[web2py] Re: Scheduler and Serial Port Problems

2016-11-25 Thread Richard Brown
An update to this - I have done some more investigation and discovered that in the 'Not Working' scenario the RTS output is mostly high but goes low whilst the port is open, and in the 'Working' scenario the RTS output has somehow been forced low and so stays low when the port is opened. The Do

[web2py] Re: how to make Query, which is always "True" (1=1 or so) ?

2016-11-25 Thread Jurgis Pralgauskis
> How are you making your query map reduce? > > query = reduce(lambda a, b: (a & b), queries) -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You recei