My python example code:
def test_print():
code.....
print('Message posted')
test_print()
How do I import: test_print() to a HTML view in web2py?Do I have to alter the python code? my aim is to print the message on HTML
My python example code:
def test_print():
code.....
print('Message posted')
test_print()
How do I import: test_print() to a HTML view in web2py?Do I have to alter the python code? my aim is to print the message on HTML
I think you should not do like that way you wrote. See the following section from web2py's book: http://www.web2py.com/books/default/chapter/29/04/the-core#Accessing-the-API-from-Python-modules. Import your module "test_print.py" into your controller and passes the function's results to your view. Something like this:
In your controller:
In your view "message.html":
Got it?