Hey everybody!
I'm a neophyte programmer, trying to work my way out of noob-land so
please PLEASE have patience with me. I just picked up turbogears last
week, and have done a little bit of messing with it, but it seems like
I'm being fought every step of the way. Essentially, I'm hoping
somebody can tell me exactly what I've done wrong here. I'm using
Feisty Ubuntu 7.04, and turbogears version 1.0.3.2
To begin, I'll describe what I'm hoping to accomplish. I'm trying to
populate a 2-dimensional grid for a small browser-based web game (I
know, it's been done umpteen-billion times, but it seemed like a good
place to start and it got me excited to start scripting right away).
I have added into my model.py file:
class BuildingLot(SQLObject):
name = UnicodeCol(length=255)
xcoord = UnicodeCol(length=255)
ycoord = UnicodeCol(length=255)
To populate this class, I created a small function in controllers.py:
def worldbuilder(xspan, yspan):
for ycoord in range(yspan):
print ycoord
for xcoord in range(xspan):
print xcoord
BuildingLot=(xcoord, ycoord)
and I'm calling it by using the tg-admin toolbox, in the WebConsole by
typing:
>>> from controllers import *
>>> worldbuilder(xspan=2, yspan=8)
0
1
(also includes what it spits out)
Now, what really throws me off is that the ycoord never prints. For
some reason, no matter which order (as you can see here, ycoord should
be printing before xcoord and I'm baffled as to why it won't) I put
them in, such as the "xcoord for loop" nested in the "ycoord for loop"
or vice versa, it only prints the x value.
I'm also looking for a good way to validate the data, and I've seen a
few queries but I'm not sure which way to go about this. I've been
trudging through a goodly amount of documentation, I've downloaded and
started reading the official docs, and I'm finally coming here because
honestly I'm at my wit's end and I know this is just something silly
that should be readily apparant. Please help, and ANY insight that
anybody can offer is much appreciated. Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---