예제 #1
0
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
예제 #2
0
def search(pattern, string):
    r = JS('new RegExp(pattern)')
    return True if r.test(string) else None
예제 #3
0
def match(pattern, string):
    pattern = '^' + pattern
    r = JS('new RegExp(pattern)')
    return True if r.test(string) else None
예제 #4
0
 def today():
     if __debug__:
         if _test_now:
             return _test_now.date()
     d = JS('new Date()')
     return date(d.getFullYear(), d.getMonth() + 1, d.getDate())