[web2py] Re: Pulling hair out on REST Example

2016-06-16 Thread pbreit
How about trying some code more like in the book: @request.restful() def api(): response.view = 'generic.json' def GET(): return dict(account = db.account(1359)) return locals() Then just hit http://localhost:8000/myapp/default/api in your browser -- Resources: - http://web2

[web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
Hey Anthony thank you very much for responding. I am attaching the code I use for the create form which is working great and the code for the update form which is giving me the grief. Please let me know if there is more information you might need and I so appreciate all your hep. On Wednesday

[web2py] db.commit() in module

2016-06-16 Thread Pierre
Hi, w2p book says to issue *db.commit()* commands when DAL insert/update/delete operations are located in a module(as opposed to being located in a controller) but it seems to work fine even without these. what is it really ? necessary , not necessary... -- Resources: - http://web2py.com

[web2py] Odd behaviour with uploaded gzip file

2016-06-16 Thread James Burke
Hi, I was trying to parse the contents of a single gzipped file, but kept getting an empty file. @auth.allows_jwt() @request.restful() def log(): def POST(*args,**vars): with gzip.GzipFile(fileobj=request.vars.file.file, mode='rb') as f: test = f.readlines()

[web2py] Re: db.commit() in module

2016-06-16 Thread Mirek Zvolský
I think if you use the thread instance of db, i.e. current.db or db tnasferred through parameter i.e. db which was created in model, then you don't need commit because such db will be commited with success of the model-controller-view code. But if db is instantiated in the module, outside from We

[web2py] Are my permissions okay?

2016-06-16 Thread Marty Jones
I have ownership of my web2py folder set to www-data group and for permissions I've used "sudo chmod 777 - R "~/path/to/web2py". Is this correct? Seems to be the only way to write to databases, etc. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/w

[web2py] Re: show map on grid view

2016-06-16 Thread Mirek Zvolský
I cannot see/download screen shots, is it just my problem? Dne neděle 5. června 2016 0:06:15 UTC+2 黄祥 napsal(a): > > what i want to achieve is showing a map in each row of SQLFORM.smartgrid > links (looks like in the attached file) > thanks massimo, tried your suggestion, but got the same resul

[web2py] A bunch of strange database errors

2016-06-16 Thread Marty Jones
I uploaded a local application to my DigitalOcean droplet and have been having a nightmare of a time with the databases. I get this variety of errors on various pages: *Error 1:* Traceback (most recent call last): File "/home/murtyjones/app/gluon/restricted.py", line 227, in restricted ex

Re: [web2py] Are my permissions okay?

2016-06-16 Thread Richard Vézina
you shouldn't have to change permission only owner... sudo chown www-data.www-data -R ~/path/to/web2py Richard On Thu, Jun 16, 2016 at 9:13 AM, Marty Jones wrote: > I have ownership of my web2py folder set to www-data group and for > permissions I've used "sudo chmod 777 - R "~/path/to/web2py"

Re: [web2py] A bunch of strange database errors

2016-06-16 Thread Richard Vézina
How did you upgrade ? Which version of web2py (2.14.6)? Richard On Thu, Jun 16, 2016 at 9:36 AM, Marty Jones wrote: > I uploaded a local application to my DigitalOcean droplet and have been > having a nightmare of a time with the databases. I get this variety of > errors on various pages: > > *

Re: [web2py] A bunch of strange database errors

2016-06-16 Thread Marty Jones
See version info below: 2.14.5-stable+timestamp.2016.04.13.22.22.13 (Running on Unknown, Python 2.7.6) On Thursday, June 16, 2016 at 9:59:58 AM UTC-4, Richard wrote: > > How did you upgrade ? Which version of web2py (2.14.6)? > > Richard > > On Thu, Jun 16, 2016 at 9:36 AM, Marty Jones > wrote

Re: [web2py] A bunch of strange database errors

2016-06-16 Thread Richard Vézina
This seems uncompleted field model definition, no type, no reference auth.settings.extra_fields['auth_user']= [ Field('company'), ] I would define company referenced table before the auth_user extra field definition... For the other 2 errors, I think controller defaut about ~200+ lines would

[web2py] Re: A bunch of strange database errors

2016-06-16 Thread Anthony
> > *Error 1:* > > Traceback (most recent call last): > File "/home/murtyjones/app/gluon/restricted.py", line 227, in restricted > exec ccode in environment > File "/home/murtyjones/app/applications/nolabills/controllers/default.py" >

[web2py] Loader/waiting indeterminate progressbar

2016-06-16 Thread Jitun John
>From the main page, once a form is submitted, there is heavy python code doing lots of steps which takes from seconds to minutes to finish. It then moves to the next page. Between the 2 pages, I am trying to see if there can be a indication on the HTML page indicating working in background. Som

[web2py] Re: db.commit() in module

2016-06-16 Thread Anthony
What's written in the book is not worded well. Whenever database modifications happen within a web2py HTTP request/response cycle, there is no need to call db.commit(), no matter where the code is (it all gets executed by the web2y framework, with web2py calling db.commit() itself just before r

Re: [web2py] A bunch of strange database errors

2016-06-16 Thread Marty Jones
I added "type='string'" but otherwise don't understand the issue with the extra field. it's not intended to be a reference to another table. will post the controller logic in a separate comment On Thursday, June 16, 2016 at 11:47:01 AM UTC-4, Richard wrote: > > This seems uncompleted field model

[web2py] Re: A bunch of strange database errors

2016-06-16 Thread Marty Jones
The user is logged in when the error occurs, yes. And yes to the second question as well. I'm logged in as a regular user and am attempting to logout. On Thursday, June 16, 2016 at 11:51:09 AM UTC-4, Anthony wrote: > > *Error 1:* >> >> Traceback (most recent call last): >> File "/home/murtyjon

[web2py] Re: A bunch of strange database errors

2016-06-16 Thread Marty Jones
Controller logic is below. Error 1 is occuring under the "dashboard" function. Errors 2/3 under the user function. # -*- coding: utf-8 -*- # this file is released under public domain and you can use without limitations

[web2py] Re: db.commit() in module

2016-06-16 Thread Pierre
well, why would someone want to instantiate a web2py db connection outside of web2py (in a module) ? I thought *current.db* is the standard way to access db from a module ? So if the book doesn't refers to *current.db* speaking of insert/update/delete ops in modules, I don't know what it refers t

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
Can you comment out the part of the scheduler, the db lock file may come from there... On Thu, Jun 16, 2016 at 12:05 PM, Marty Jones wrote: > Controller logic is below. Error 1 is occuring under the "dashboard" > function. Errors 2/3 under the user function. > > # -*- coding: utf-8 -*- > # this

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Marty Jones
Done - no change. Is it possible that the issue is SQLite specific and I need to migrate to MySQL or some other db? On Thursday, June 16, 2016 at 12:14:51 PM UTC-4, Richard wrote: > > Can you comment out the part of the scheduler, the db lock file may come > from there... > > On Thu, Jun 16, 20

[web2py] Re: Update Pure HTML form

2016-06-16 Thread Anthony
For update forms, web2py includes the record ID as a hidden field and verifies that it matches the original record ID on the server to ensure the user doesn't try to update a different record. You have not included the record ID in your form, so this verification fails. As noted earlier, please

Re: [web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
Anthony thank you so very much. I will make these changes. Thank you, Jeff Riley > On Jun 16, 2016, at 11:17 AM, Anthony wrote: > > For update forms, web2py includes the record ID as a hidden field and > verifies that it matches the original record ID on the server to ensure the > user doesn'

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
There shouldn't be issue specific to SQLite (I mean it should work properly), though there is maybe a specific unnoticed issue with it as there has been a big refactoring of pyDAL, I don't recall it the refactored pyDAL was present in 2.14.5 On Thu, Jun 16, 2016 at 12:22 PM, Marty Jones wrote:

[web2py] Re: db.commit() in module

2016-06-16 Thread Anthony
On Thursday, June 16, 2016 at 12:13:45 PM UTC-4, Pierre wrote: > > well, why would someone want to instantiate a web2py db connection outside > of web2py (in a module) ? > There's no reason use of the DAL for database access should be limited to HTTP requests. Not all database work involves web

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Marty Jones
The reason I suspect a non-application-specific issue is that creating a new simple app from the web2py admin console results in a similar database issue. Visiting the default/index of the new app spits back: Traceback (most recent call last): File "/home/murtyjones/app/gluon/restricted.py", l

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
Do they share the same Database, if not it make no sens that auth_user already exists... Did you modify the welcome app.ini db config? I ask because web2py use welcome as template for new app... On Thu, Jun 16, 2016 at 12:36 PM, Marty Jones wrote: > The reason I suspect a non-application-specifi

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
I would download and start fresh... How did you get 2.14.5? git clone? If so did you clone --recursive? On Thu, Jun 16, 2016 at 12:41 PM, Richard Vézina < ml.richard.vez...@gmail.com> wrote: > Do they share the same Database, if not it make no sens that auth_user > already exists... Did you modif

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Marty Jones
believe i did clone, but can't remember if i did recursive. should i? i will get a new start and report back On Thursday, June 16, 2016 at 12:42:43 PM UTC-4, Richard wrote: > > I would download and start fresh... How did you get 2.14.5? git clone? If > so did you clone --recursive? > > On Thu, J

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
Yes you have to when cloning with git, if you don't pyDAL module don't get clone/fresh... You can confirm that, which version of pyDAL you run on, by looking in gluon/packages/dal/pydal/init.py You should have 16.03 Richard On Thu, Jun 16, 2016 at 12:46 PM, Marty Jones wrote: > believe i did c

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
By curiousity which version were you having before upgrade? Depending of the version you have to update web2py specific app files... On Thu, Jun 16, 2016 at 12:53 PM, Richard Vézina < ml.richard.vez...@gmail.com> wrote: > Yes you have to when cloning with git, if you don't pyDAL module don't get

[web2py] Re: db.commit() in module

2016-06-16 Thread Pierre
ok i think i get it : suppose I have a *scheduled task* that performs 3 successive *insert/update* ops depending on each other like op2 might refer to op1 and op3 to op2 then I must do: op1 = db.tablea.insert_or_update(..) db.commit() some code here raises an exception op2 = db.tableb.i

Re: [web2py] Re: A bunch of strange database errors

2016-06-16 Thread Richard Vézina
I am wrong, I thought you were reporting issue following upgrade... I may had make this deduction because you were talking about permissions issues in another thread... On Thu, Jun 16, 2016 at 1:02 PM, Marty Jones wrote: > Don't think I've upgraded it at any point. At least not knowingly > > On

[web2py] Re: db.commit() in module

2016-06-16 Thread Niphlod
not really. think a db.commit() as saving a file. if you need to have something that does the 3 operations atomically (i.e. either all three or none of them) you just commit() after the third one. if you instead need to consolidate what op1 does in fear that what op2 might fail (and you don't w

[web2py] Re: db.commit() in module

2016-06-16 Thread Niphlod
in addition (or just using different words of what Anthony said) ONLY when you are in the web2py env in an HTTP request, web2py automatically commits at the end of a successul request and rolls back if some exceptions are raised, to ensure that EVERY operation you did for a request gets treated

[web2py] Re: Loader/waiting indeterminate progressbar

2016-06-16 Thread Dave S
On Thursday, June 16, 2016 at 8:52:34 AM UTC-7, Jitun John wrote: > > From the main page, once a form is submitted, there is heavy python code > doing lots of steps which takes from seconds to minutes to finish. > It then moves to the next page. > This sounds like something that should be done

[web2py] Extract Models from MS SQL Server

2016-06-16 Thread Kyle Flanagan
I needed the ability to extract a DAL model from SQL Server. I based the script below on extract_pgsql_models by Mariano Reingart, based in turn on a script to "generate schemas from dbs" (mysql) by Alexandre Andrade. I'm posting it here in hopes that it will be useful for others. Tested on Win

[web2py] Rocket server and Windows POST

2016-06-16 Thread Dave S
I'm a bad boy and still using the Rocket server that comes with web2py. Today I ran into an interesting case. My client code sends a dump file to the server using a POST command. On linux systems, this completes in a reasonable amount of time, gets the result (json string), and both sides ar

[web2py] grid exportclasses not work in recent version

2016-06-16 Thread 黄祥
just want to report grid exportclasses is not work in recent version : e.g. def index(): table = db.test exportclasses = dict(csv_with_hidden_cols=False, xml=False, json=False, tsv_with_hidden_cols=False, tsv=False) grid = SQLFORM.smartgrid(table, exportclasses = exportclasses) return locals() no

[web2py] Re: Update Pure HTML form

2016-06-16 Thread Jeff Riley
So I need to know who to get the record ID from the database to pass to the update view. Using the form start and end calls is not working. On Wednesday, June 15, 2016 at 8:52:22 AM UTC-5, Jeff Riley wrote: > > All. I was going to link this to my "Pure HTML Form" question just not > sure how t

[web2py] Re: Update Pure HTML form

2016-06-16 Thread Anthony
You are passing a record to SQLFORM for editing - that is the record whose id is needed. Hard to say what's wrong with the new code without seeing it. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google

[web2py] grid exportclasses not work in recent version

2016-06-16 Thread Anthony
Yes, an issue has already been filed. For now, you must use a dictionary with a key for each table. -- 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 r

[web2py] How do I redirect to a different application from one application?

2016-06-16 Thread Steve Joe
exact syntax? -- 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 received this message because you are subscribed to the Google Groups "web2py-users" gr

Re: [web2py] Re: show map on grid view

2016-06-16 Thread Manuele Pesenti
Il 05/06/16 00:06, 黄祥 ha scritto: > what i want to achieve is showing a map in each row of > SQLFORM.smartgrid links (looks like in the attached file) > thanks massimo, tried your suggestion, but got the same result. any > idea or suggestion to achieve it in web2py? > Hi Stifan, what about introduc

[web2py] Why is this simple join not rendering?

2016-06-16 Thread Greenpoise
so I have this simple join: query = (db.customer.id > 0) & (db.customer_type.id==db.customer.customer_type) all_customers = db(query).select() return dict(all_customers = all_customers) and my view: {{for customer in all_customers:}} {{=customer.firs

Re: [web2py] How do I redirect to a different application from one application?

2016-06-16 Thread Manuele Pesenti
Il 17/06/16 08:20, Steve Joe ha scritto: > exact syntax? Have you looked for it in the doc? http://www.web2py.com/books/default/chapter/29/04/the-core?#HTTP-and-redirect http://www.web2py.com/books/default/chapter/29/04/the-core#URL Cheers M. -- Resources: - http://web2py.com - http://w