def asciiForm(self, text=None):
        # get template
        tmpl = env.get_template('form.html')
        # set up messages
        messages = {
            'welcome': 'welcome to ascii form',
        }
        # set up form
        # variable text
        form = """
        <form method="get" action="">
            <label for="text">Say....</label>
            <input type="text" name="text" />
            <input type="submit" value="Send" class="button button-primary">
        </form>
        """
        # set up extra content
        extra_content = {
            'title': 'asciiForm',
            'form': form,
            'anchors': self.get_nav()
        }

        # if text is None, set output to welcome
        if text is None:
            extra_content['output'] = messages.get('welcome')
        # if not None, start process
        else:
            # use module asciisymol's asciiImage function
            # one arg, input type string
            extra_content['output'] = asciiImage(text)
        # render
        return tmpl.render(**extra_content)
示例#2
0
文件: a40323198.py 项目: mdeta/2014cp
    def asciiForm(self, text=None):
        # get template
        tmpl = env.get_template('form.html')
        # set up messages
        messages = {
            'welcome': 'welcome to ascii form',
        }
        # set up form
        # variable text
        form = """
        <form method="get" action="">
            <label for="text">Say....</label>
            <input type="text" name="text" />
            <input type="submit" value="Send" class="button button-primary">
        </form>
        """
        # set up extra content
        extra_content = {
            'title': 'asciiForm', 'form': form,
            'anchors': self.get_nav()
        }

        # if text is None, set output to welcome
        if text is None:
            extra_content['output'] = messages.get('welcome')
        # if not None, start process
        else:
            # use module asciisymol's asciiImage function
            # one arg, input type string
            extra_content['output'] = asciiImage(text)
        # render
        return tmpl.render(**extra_content)
示例#3
0
 def asciiForm(self, text=None):
     # form, action to asciiOutput
     # set up messages
     messages = {
         'welcome': 'welcome to ascii form',
     }
     content = """
     <form method="get" action="">
         <label for="text">Say....</label>
         <input type="text" name="text" />
         <input type="submit" value="Send" class="button button-primary">
     </form>
     """
     output = ''
     # if text is None, set output to welcome
     if text is None:
         output = messages.get('welcome')
     # if not None, start process
     else:
         # use module asciisymol's asciiImage function
         # one arg, input type string
         output = asciiImage(text)
     return self.generate_form_page(content, output)