Ejemplo n.º 1
0
<body>
    Форма логина и регистрации. При вводе несуществующего имени зарегистрируется новый пользователь.
    <form action="/cgi-bin/wall.py">
        Логин: <input type="text" name="login">
        Пароль: <input type="password" name="password">
        <input type="hidden" name="action" value="login">
        <input type="submit">
    </form>

    {posts}

    {publish}
</body>
</html>
'''

if user is not None:
    pub = '''
    <form action="/cgi-bin/wall.py">
        <textarea name="text"></textarea>
        <input type="hidden" name="action" value="publish">
        <input type="submit">
    </form>
    '''
else:
    pub = ''

print('Content-type: text/html\n')

print(pattern.format(posts=wall.html_list(), publish=pub))
Ejemplo n.º 2
0
<body>
    Форма логина и регистрации. При вводе несуществующего имени зарегистрируется новый пользователь.
    <form action="/cgi-bin/wall.py">
        Логин: <input type="text" name="login">
        Пароль: <input type="password" name="password">
        <input type="hidden" name="action" value="login">
        <input type="submit">
    </form>

    {posts}

    {publish}
</body>
</html>
'''

if user is not None:
    pub = '''
    <form action="/cgi-bin/wall.py">
        <textarea name="text"></textarea>
        <input type="hidden" name="action" value="publish">
        <input type="submit">
    </form>
    '''
else:
    pub = ''

print('Content-type: text/html\n')

print(pattern.format(posts=wall.html_list(), publish=pub))
Ejemplo n.º 3
0
</body>
</html>
"""

auth = """
<p>Введите логин и пароль для входа или регистрации</p>
<form action="/cgi-bin/wall.py">
    Логин: <input type="text" name="login">
    Пароль: <input type="password" name="password">
    <input type="hidden" name="action" value="login">
    <input type="submit">
</form>
"""

if user is not None:
    name = user + "<br>"
    pub = """
    <p>Отправьте сообщение</p>
    <form action="/cgi-bin/wall.py">
        <textarea name="text"></textarea>
        <input type="hidden" name="action" value="publish">
        <input type="submit">
    </form>
    """
else:
    name = ""
    pub = ""

print("Content-type: text/html;charset=utf-8\n")
print(pattern.format(auth=auth, login=name, posts=wall.html_list(), publish=pub))