[web2py] support for list comprehensions and enumerate in template language
I just ran my head agains jinja2... Does web2py template language support list comprehensions? Sincerely --
Re: [web2py] Re: support for list comprehensions and enumerate in template language
Thanks for confirming this. Sincerely Andreas On Mon, Aug 6, 2012 at 4:34 PM, Anthony abasta...@gmail.com wrote: web2py doesn't really have a separate template language -- it's just pure Python. So yes, you can use list comprehensions. See http://web2py.com/books/default/chapter/29/5#The-views for details. Anthony On Monday, August 6, 2012 10:28:46 AM UTC-4, achristoffersen wrote: I just ran my head agains jinja2... Does web2py template language support list comprehensions? Sincerely -- --
[web2py] default layout.html error (or just me)
Hi group, I am trying to build the simple image blog from the web2py book chapter 3. As far as I can see I have reentered the example code to the letter - but still I get an error (which I think stems from layout.html?) (using latest web2py on mac) Traceback (most recent call last): File gluon/restricted.py, line 203, in restricted File gluon/restricted.py, line 189, in compile2 File /Users/andreas/web2py/web2py.app/Contents/Resources/applications/images/views/default/index.html, line 79 response.write('\n ', escape=False) ^ SyntaxError: invalid syntax TiA. Andreas
Re: [web2py] default layout.html error (or just me)
I was missing a paranthesis... sorry for the confusion - and thanks for the help... Sometimes taking a walk and comming back to the editor is the best way to handle errors. I had: {{=LI(A(image.title, _href=URL(show, args=image.id))}}$ but should have had: {{=LI(A(image.title, _href=URL(show, args=image.id)))}}$ Sorry again. On Tue, Feb 7, 2012 at 8:36 PM, Bruno Rocha rochacbr...@gmail.com wrote: you are missing {{ or }} somewhere in view On Tue, Feb 7, 2012 at 5:26 PM, Andreas Christoffersen achristoffer...@gmail.com wrote: Hi group, I am trying to build the simple image blog from the web2py book chapter 3. As far as I can see I have reentered the example code to the letter - but still I get an error (which I think stems from layout.html?) (using latest web2py on mac) Traceback (most recent call last): File gluon/restricted.py, line 203, in restricted File gluon/restricted.py, line 189, in compile2 File /Users/andreas/web2py/web2py.app/Contents/Resources/applications/images/views/default/index.html, line 79 response.write('\n ', escape=False) ^ SyntaxError: invalid syntax TiA. Andreas -- Bruno Rocha [http://rochacbruno.com.br]
Re: [web2py] Re: How to port this simple game to a web2py app?
Thanks. But the thing is that I don't know for sure how many chapters I'll recieve - but It will be more then I'd like to create manually. Also - I might want to keep adding features to this. E.g. a breadcrumb trail, or a counter showing how many different paths the user has taken, and how many more paths left to take. This means I'd like to add a user registration and login. etc etc etc. So in short - this is not only about a right/wrong tool. This is mostly about learning, and making it easy to add features to the game. On Sun, Oct 23, 2011 at 8:38 AM, pbreit pbreitenb...@gmail.com wrote: I'm not a big fan of using the wrong tool for the job. In this case it seems like you could simply write the whole thing in HTML and use hyperlinks. If you wanted it all on one page, there are probably some simple JavaScripts to achieve that.
[web2py] How to port this simple game to a web2py app?
Hi Group, I've been looking for an excuse to get started with web and python. Finally I thought up this little game for a friend, but how to port it to web2py? The game is like one of those old adventure books. There is a story, but at some point the player must decide on an action. For each option the story then forks. this happens again and again, until the story finishes, one way or the other. (actually in this particular case we are writing a poem... But the principle is the same). This game is being built for my friends birthday party. The plan is to have each of the attending friends each write three chapters of the story. The script assumes that the friends will upload / mail me the chapters as a yaml file. The yaml template looks like this. ChapterTitel: Whatever # The title is not really used in this version. txt: | # Write chapter text below. The text must be indented This is the chapter text. Notice the first line is indented? And so forth. You can make paragraphs, and what ever you like. Just keep the text indented. Option: a: option_txt: Write option one next: option_file_name.yaml #the name of the next chapter (file name) b: option_txt: Option two next: fantastic_option_yes.yaml c: option_txt: You get the idea... next: You_got_right.yaml #dont use spaces or weird punctuation in file names This is the script. I am sure it can and should be improved in countless ways. Please tell me which :-) from sys import exit import yaml class Spil(object): def __init__(self,start=start.yaml): self.start = start def play(self): next = self.start while True: print \n next = self.show_poem(next) def show_poem(self,next): with open(next) as digt: digt = yaml.load(digt) print(digt[txt]) print(-\n) print(A +digt[option][a][option_txt]) print(B +digt[option][b][option_txt]) print(C +digt[option][c][option_txt]) user = raw_input(What do you choose (A, B or C)? ).lower() if user in [a,b,c]: next = digt[option][user][next] if next == end.yaml: print(Finished :-) Thanks for playing :-)) exit(1) else: return next I hope that makes sense. Now to my question. What would be the best strategy to move move forward here? In the terminal it works fine, but I guess each new part of the story must be presented as a new html page? Prefereable I'd like to show each new chapter as an extension of the first, so that the player can see the story as one whole. And preferable with out a new page loading... How ever - simplicity is priority number one. So how to display the next chapter, and how to collect user input? Would it be better to use a database than yaml files? Should I make a webform to collect stories instead of asking people to mail me the yaml files? This is completely new for me. But I guess the task it simple. So for starters I hope to get some advice about good practice and maybe specific pointers to relevant sections/chapters in the web2py book. E.g if I need to make a new web page for each html, I need to create that dynamically? Sincerely and thanks in advance, Andreas
Re: [web2py] R: Upload Install packed application on FluxFlex - Error500
Hi guys, This is funny - I don't even get an error message - I just get a browser crash (chromium on debian, chrome-dev on mac, safari on mac). Has anybody heard from fluxflex about this? Sincerely Andreas (first post here - w) On Fri, Sep 2, 2011 at 9:02 AM, Yota Ichino www.i...@gmail.com wrote: Foresto, The issue is caused by server's setting. The server limits POST size. Don't worry, POST limit issue is under consideration by fluxflex. 2011/9/1 Valter Foresto valter.fore...@gmail.com: I just try again to Upload a packed web2py application on FluxFlex but I get the same Error500 of a week ago.