It's like the function return locals is acting as print locals and 
overiding the html view, if I add another string as a variable that will 
show on the html view too..

On Friday, 4 October 2019 10:34:15 UTC+1, Andy W wrote:
>
> The basics.py file is in web2py/applications/pluralsight/controllers/
>
> And random_number.html is in web2py/applications/pluralsight/views/
>
> The web URL is http://127.0.0.1:8000/pluralsight/basics/random_number
>
> What I don't understand is other views seem to represent fine just this 
> one?
>
> I really like how quickly I could role out a web app with web2py but this 
> is hampering me..
>
>
> On Friday, 4 October 2019 05:43:27 UTC+1, Massimo Di Pierro wrote:
>>
>> is the file in controllers/basic/random_number.html ?
>>
>> On Thursday, 3 October 2019 20:32:05 UTC-7, Andy W wrote:
>>>
>>> I've been following a tutorial which is relatively simple, but for some 
>>> reason the view doesn't seem to reflect my html file, it's probbaly 
>>> something simeple but being new to web2py I can't see what I'm doing wrong 
>>> - any help appreciated
>>>
>>> Andy
>>>
>>>
>>> *This is my controller basics.py*
>>> # -*- coding: utf-8 -*-
>>>
>>> import random
>>> def isPrime(num):
>>>     counter = 2
>>>     while counter < num-1:
>>>         if num%counter==0:
>>>             return False
>>>         counter = counter + 1
>>>     return True
>>>
>>> def random_number():
>>>     x = random.randint(3,20)
>>>     result = isPrime(x)
>>>     return locals()
>>>
>>>
>>> *This is my view random_number.html *
>>> {{extend 'layout.html'}}
>>> <h1>Random Number</h1>
>>> <h3>
>>>     Is the random numnber, {{=x}}, prime?
>>> </h3>
>>> <h3>
>>>     The answer is: {{=result}}
>>> </h3>
>>>
>>> *This is my result:*
>>>
>>>
>>> *This is what I am expecting:*
>>>
>>>
>>>

-- 
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" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/bdfeed56-0283-4db7-8d87-a7cf20ebafa9%40googlegroups.com.

Reply via email to