Created
November 11, 2009 17:44
-
-
Save inklesspen/232134 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import logging | |
| from pylons import request, response, session, tmpl_context as c | |
| from pylons.controllers.util import abort, redirect_to | |
| from bar.lib.base import BaseController, render | |
| import bar.model as model | |
| log = logging.getLogger(__name__) | |
| class BazController(BaseController): | |
| def index(self): | |
| c.f = model.RandomModel() | |
| print "rendering now" | |
| retval = render('/blah.mako') | |
| print "done rendering" | |
| return retval |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import random, string | |
| population = string.ascii_letters + string.digits | |
| class RandomModel(object): | |
| def __init__(self): | |
| self.n = 0 | |
| def __iter__(self): | |
| return self | |
| def next(self): | |
| if self.n >= 400000: | |
| raise StopIteration | |
| self.n += 1 | |
| return ''.join(random.sample(population, random.choice([18, 18, 19]))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" | |
| "http://www.w3.org/TR/html4/strict.dtd"> | |
| <html lang="en"> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | |
| <title>untitled</title> | |
| <meta name="generator" content="TextMate http://macromates.com/"> | |
| <meta name="author" content="Jon Rosebaugh"> | |
| <!-- Date: 2009-11-11 --> | |
| </head> | |
| <body> | |
| <table border="0"> | |
| <tr><th>Stuff</th></tr> | |
| % for foo in c.f: | |
| <tr><td>${foo}</td></tr> | |
| % endfor | |
| </table> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment