Madness. Madness.

This commit is contained in:
Paul R. Tagliamonte 2013-03-09 22:45:08 -05:00
parent 4f856c35d4
commit aecf29809f
4 changed files with 46 additions and 0 deletions

1
requirements-site.txt Normal file
View File

@ -0,0 +1 @@
flask

10
site/app.hy Normal file
View File

@ -0,0 +1,10 @@
;
(import-from flask
Flask render-template request)
(def app (Flask "__main__")) ; long story, needed hack
(route "/" [] (render-template "index.html"))

35
site/shim.py Normal file
View File

@ -0,0 +1,35 @@
#
import hy
from hy.models.expression import HyExpression
from hy.models.symbol import HySymbol
from hy.macros import macro
# (route "/" []
# (render-template "index.html"))
# (decorate-with (.route app "/")
# (defn index []
# (render-template "index.html")))
@macro("route")
def route_macro(tree):
tree.pop(0)
path = tree.pop(0)
tree.insert(0, HySymbol("fn"))
return HyExpression([HySymbol("decorate_with"),
HyExpression([HySymbol(".route"),
HySymbol("app"),
path]),
tree])
from app import app
if __name__ == '__main__':
app.run(debug=True)

View File