Actually, I found an way to change the variable just using state variables
(I.e., class parameters)
class Room(object):
def __init__(self, number=None, tries=None):
self.num = number
self.guess = tries
and then i refracted the code I displayed in my original post, so it worked:
if form.action != session.room.num and form.action not in self.commands: #
session.room is room object
session.room.guess -= 1
session.room.output = "BZZZTT!! Access Denied. You have %d tries left" %
session.room.guess
if session.room.guess == 0:
session.room = session.room.go('*') #go function built-in to Room
class and '*' is the key in dict that maps out the room 'path'
elif form.action == session.room.num:
session.room = session.room.go('x') #'x' the name of key in same dict
that maps out the room 'path'
On Monday, 2 July 2012 12:06:27 UTC-4, Tomas Schertel wrote:
>
> In my case I was trying to populate a dropbox with values stored on a
> database.
> I solved it using a JQuery plugin called JCombo.
> But Primoz had a good start to help you.
> You could call a js function to verify values when a event occur. Like a
> change in a combobox, or time based.
> BUT, all this ideas requires javascript knowledge. I say go for JQuery.
>
> On Sunday, 1 July 2012 19:10:25 UTC-3, NSC wrote:
>>
>> Tomas and I had a similar conversation just a few weeks ago on this
>> thread. I'm traveling and can't pull it up on my phone but maybe you can
>> dig back on the google group and find it.
>>
>> I put code examples in that thread.
>>
>> Hope it helps!
>>
>> A
>>
>>
>>
>> On Jul 1, 2012, at 12:26 PM, Ash Courchene <[email protected]>
>> wrote:
>>
>> Damn it...
>> Ok then, so the question now becomes does anyone know where I can learn
>> how to use ajax with web.py in respects to what I want accomplished?
>> (If the user does not guess the specified number within a certain amount
>> of tries, then its game over?)
>>
>>
>>
>> On Saturday, 30 June 2012 17:02:04 UTC-4, Tomas Schertel wrote:
>>>
>>> As far as I know, the only way to change anything in html is using ajax.
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "web.py" group.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msg/webpy/-/VJDtAAeXfNcJ.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/webpy?hl=en.
>>
>>
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/mWWc8qhrAEoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.