def set_argv(): s = JS('window.location.search.substring(1)') s = s.py_split('&') argv = [] argv.append(JS('window.location.pathname')) for item in s: if item: argv.append(JS('unescape(item)')) import sys sys.argv = argv
def search(pattern, string): r = JS('new RegExp(pattern)') return True if r.test(string) else None
def match(pattern, string): pattern = '^' + pattern r = JS('new RegExp(pattern)') return True if r.test(string) else None
def today(): if __debug__: if _test_now: return _test_now.date() d = JS('new Date()') return date(d.getFullYear(), d.getMonth() + 1, d.getDate())