Skip to content

Instantly share code, notes, and snippets.

@makimoto
Created June 11, 2010 03:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makimoto/434017 to your computer and use it in GitHub Desktop.
Save makimoto/434017 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python
# vim:fileencoding=utf8
from json import dumps
from mod_python import apache
import datetime
import qreki
def index(req,**args):
req.content_type = 'text/javascript'
if 'date' in args:
y = int(args['date'][:4])
m = int(args['date'][4:6])
d = int(args['date'][6:])
else:
t = datetime.date.today()
y = t.year
m = t.month
d = t.day
rokuyou = qreki.rokuyou_from_ymd(y,m,d)
res = {u'date':u'%04d%02d%02d' % (y,m,d), u'rokuyou':rokuyou}
if 'callback' in args:
return '%s(%s);' % (args['callback'],dumps(res))
else:
return dumps(res)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment