Example #1
0
def mini(response, input={}):
    """ display start html so that bot output can follow. """
    inputdict = LazyDict({'version': getversion()})
    if input: inputdict.update(input)
    temp = os.path.join(os.getcwd(), 'templates/mini.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Example #2
0
def mini(response, input={}):
    """ display start html so that bot output can follow. """
    inputdict = LazyDict({'version': getversion()})
    if input: inputdict.update(input)
    temp = os.path.join(os.getcwd(), 'templates/mini.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Example #3
0
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try: host = socket.gethostname()
    except AttributeError:
         if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
         else: host = os.environ['SERVER_NAME']
    template = LazyDict({'version': getversion(), 'host': host, 'color': Config().color or "#C54848"})
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Example #4
0
File: web.py Project: code2u/jsb
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try: host = socket.gethostname()
    except AttributeError:
         if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
         else: host = os.environ['SERVER_NAME']
    if 'localhost' in host:  url = 'http://%s/dispatch' % host
    else: url = 'https://%s/dispatch' % host
    template = LazyDict({'url': url, 'version': getversion(), 'host': host, 'color': getmainconfig().color or "#4b7cc6"})
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Example #5
0
def login(response, input={}):
    """ display start html so that bot output can follow. """
    try:
        host = socket.gethostname()
    except AttributeError:
        if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
        else: host = os.environ['SERVER_NAME']
    template = LazyDict({
        'version': getversion(),
        'host': host,
        'color': Config().color or "#C54848"
    })
    if input: template.update(input)
    temp = os.path.join(os.getcwd(), 'templates/login.html')
    outstr = template.render(temp)
    response.out.write(outstr)
Example #6
0
 def get(self):
     try:
         cont = self.request.get('continue')
         logging.info('openid - login form %s' % cont)
         urlstring = self.create_openid_url(cont)
         template_values = LazyDict({
             'cont': cont,
             'urlstring': urlstring,
             'appname': getversion()
         })
         try: host = socket.gethostname()
         except AttributeError:
             if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
             else: host = os.environ['SERVER_NAME']
         inputdict = {'version': getversion(), 'host': host, 'loginurl': urlstring}
         template_values.update(inputdict)
         temp = os.path.join(os.getcwd(), 'templates/login.html')
         outstr = template_values.render(temp)  
         self.response.out.write(outstr)
     except Exception, ex:
         handle_exception()
Example #7
0
 def get(self):
     try:
         cont = self.request.get('continue')
         logging.info('openid - login form %s' % cont)
         urlstring = self.create_openid_url(cont)
         template_values = LazyDict({
             'continue': cont,
             'urlstring': urlstring,
             'appname': getversion()
         })
         try:
             host = socket.gethostname()
         except AttributeError:
             if os.environ.get('HTTP_HOST'): host = os.environ['HTTP_HOST']
             else: host = os.environ['SERVER_NAME']
         inputdict = {'version': getversion(), 'host': host}
         template_values.update(inputdict)
         temp = os.path.join(os.getcwd(), 'templates/login.html')
         outstr = template_values.render(temp)
         self.response.out.write(outstr)
     except Exception, ex:
         handle_exception()