[web2py] Re: Inject html markup with python code at run time

2019-03-24 Thread yng
Awesome Massimo, this is exactly what I need. On Monday, 25 March 2019 13:02:42 UTC+11, Massimo Di Pierro wrote: > Hello yng, > > You can but you have to render it before you inject it in the template: > > from gluon.template import render > > def test(): >template = '{{for x in range(2):}}{

RE: [web2py] Simple didactic integration of web2py with Vue.js

2019-03-24 Thread John Underhill
Luciano, I think this is a great idea! I really like Vue.js, and we use Web2py extensively. I have been looking for a way to use a good JavaScript framework front end with Web2py. We also like to incorporate Bootstrap if we can, and there are nice Bootstrap components for Vue.js. I think Ma

RE: [web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-24 Thread John Underhill
@João, you are programming yourself into a corner. No matter what you do, you’ll keep running into more problems. The reason for this is because you’re trying to do atomic operations at the application level. You simply can’t do that. If you check whether or not something is locked at the ap

[web2py] Simple didactic integration of web2py with Vue.js

2019-03-24 Thread luciano . ondir
Dear all, I am considering to create a didactic tool to teach poor children the basics of web development. I strongly believe in web2py potential as didactic tool and I believe that Vue.js also would be nice in the front end. I created a simple example to get people feedback: https://github.com/

[web2py] Re: Inject html markup with python code at run time

2019-03-24 Thread Massimo Di Pierro
Hello yng, You can but you have to render it before you inject it in the template: from gluon.template import render def test(): template = '{{for x in range(2):}}{{=x}}hello{{pass}}' dynamicHtml = render(template, context=locals()) return dict(dynamicHtml = dynamicHtml) and in view

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-24 Thread Massimo Di Pierro
I honestly do not know. I do not think this is a web2py specific issue. Definitively pydal is already imported but the name is not defined in the controller's scope. Do not know how the interpreter handles the type annotation or where it looks them up. On Sunday, 24 March 2019 12:17:41 UTC-7,

[web2py] Re: web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-24 Thread Massimo Di Pierro
Yes. Try delete it. On Sunday, 24 March 2019 11:39:31 UTC-7, João Matos wrote: > > I don't have or use Python 2, only Python 3. > You want me to delete the __pycache__ dir from my web2py (where I compile > the app) or from the client end (where I install the compiled app)? > > > domingo, 24 de Ma

[web2py] Where should session.secure() be applied? I tried in default.py but it blocked all logins

2019-03-24 Thread João Matos
Hello, The online web2py Complete Reference manual states that In your applications, if they require authentication, you should make the > session cookies secure with: > > session.secure() > > in http://web2py.com/books/default/chapter/29/13/deployment-recipes?search=session.secure#Securing-ses

[web2py] After configuring HTTPS, rocket.py crashes when I try to access using HTTP

2019-03-24 Thread João Matos
Hello, I created the .crt and .key files using this command on a linux machine openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout certificate.key -out certificate.crt from Niphlod in https://groups.google.com/forum/#!msg/web2py/uesX9TgA2Xk/V0qmPvfbQPUJ Copied both files to c:\web2py.

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-24 Thread Anthony
On Sunday, March 24, 2019 at 2:29:41 PM UTC-4, junderh...@qisproject.com wrote: > > João, > > No, SQLite transactions are not only ACID, the Isolation is Serializable, > which means even if the execute concurrently, > the result should be same as if they executed in series (on after the > other

[web2py] Re: Inject html markup with python code at run time

2019-03-24 Thread yng
Thank's for the reply Scott, My requirement is to store the html code in the database for ease of customization on my view. My option is to create the view (physical html file) on request, but i don't think it's ideal. Any suggestions before I close this topic? -- Resources: - http://web2

[web2py] Re: Access SQLFORM column/values from controller action on filter

2019-03-24 Thread João Matos
There are at least 3 scenarios I know. 1. You want that after the user makes a change in the SQLFORM it presses the submit button and the page and graph updates. or 2. You want that after the user makes a change in the SQLFORM he doesn't have to press the submit button (in this case it would be b

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-24 Thread João Matos
@John I think you didn't understand the problem. I have to assign a wo_counter and a sn_counter to each new record of the wo table. To do that, I must disable any attempt to change them during the process of saving the wo record to the database. That process consists of: 1. If the user didn't sel

[web2py] Re: Inject html markup with python code at run time

2019-03-24 Thread Scott Hunter
By putting your code in a string passed as an argument to XML, you are saying you want that string to be displayed as opposed to executed; the fact that it happens to be code is irrelevant. If you want the code to run on the server, creating the page to be displayed, you can just put it in your

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-24 Thread João Matos
import pydal is required so that the function on_delete definition with the pydal.objects.Table typing doesn't return an error. This normal Python behavior. But because I was assuming that web2py would import pydal automatically, I detected that the import pydal isn't needed for the pydal.objects.R

[web2py] Re: Redis and Python3?

2019-03-24 Thread Massimo Di Pierro
Hello Joe, based on this https://github.com/andymccurdy/redis-py/issues/1071#issuecomment-439199774 looks like Redis had a backward incompatible changes and keys in dictionaries cannot be bool (values can). I reviewed the web2py code and I can confirm no change on our side. Random thoughts: It w

[web2py] Re: web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-24 Thread João Matos
I don't have or use Python 2, only Python 3. You want me to delete the __pycache__ dir from my web2py (where I compile the app) or from the client end (where I install the compiled app)? domingo, 24 de Março de 2019 às 18:35:19 UTC, Massimo Di Pierro escreveu: > > I recommend deleting __pycache_

[web2py] Re: web2py returns an ImportError that can't find the module, but the .pyc file is in the _pycache__ dir

2019-03-24 Thread Massimo Di Pierro
I recommend deleting __pycache__. It may be due switching between python 2 and python 3. On Monday, 18 March 2019 13:42:53 UTC-7, João Matos wrote: > > After installing a compiled app, web2py returns an ImportError that can't > find the module, but the .pyc file is in the modules\__pycache__ dir

[web2py] Re: "NameError: name 'pydal' is not defined" when function has typing type in def

2019-03-24 Thread Massimo Di Pierro
Can you please post a minimalist project that produces the error you are seeing? On Friday, 15 March 2019 03:55:24 UTC-7, João Matos wrote: > > Apparently when importing the module, pydal is not loaded, but when > running the function it is. > Is this the correct behavior of web2py? > > sexta-fe

[web2py] Access SQLFORM column/values from controller action on filter

2019-03-24 Thread Suman Roychoudhury
the page has 2 sections, 1. a SQL FORM 2. a graph which shows some kind of visualization using data off of the SQL FORM I need to dynamically update the graph when the user applies filter on the data in SQL FORM. need help on how to access the SQL FORM data from another controller action like ,

[web2py] Re: Does web2py/DAL allow for creating atomic operations (begin transaction/end transaction)?

2019-03-24 Thread junderhill
João, No, SQLite transactions are not only ACID, the Isolation is Serializable, which means even if the execute concurrently, the result should be same as if they executed in series (on after the other). What @Anthony describes should not be necessary, since you already in a transaction. http

[web2py] Inject html markup with python code at run time

2019-03-24 Thread yng
Hi Guru's. I'm new to web2py and web development in general. Hope somebody can help me. I want to inject a html markup with python code at run time. controller: def test(): dynamicHtml = XML('{{for x in range(2):}}{{=x}}hello{{pass}}') return locals() view: test.html {{=dynamicHtml}} The