view contrib/googleimport/ @ 4737:ebe54f59e87c

system/help page packages: build all pagesets, use LanguageSetup as front page (unifies old SystemPagesSetup with the setup specific part of HelpOnLanguages)
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 01 Jun 2009 17:55:26 +0200
parents 70c8457d68ab
children 043baa5879b3
line wrap: on
line source
#!/usr/bin/env python

# needs

import sys
from textwrap import wrap

from twill.commands import go, fv, submit, follow, notfind

def login(username, password):
    fv('1', 'Email', username)
    fv('1', 'Passwd', password)

def push_item(projectname, summary, comment, status, label):
    go('' % (projectname, ))
    follow('New Issue')
    fv('3', 'summary', summary)
    fv('3', 'comment', wraptext(comment))
    fv('3', 'status', status)
    fv("3", "labelenter0", label)
    fv("3", "labelenter1", "")

    notfind("Letters did not match")

def wraptext(text):
    lines = text.splitlines()
    cur_p = []
    output = []
    for line in lines + [""]:
        if not line and cur_p:
            output.extend(wrap("\n".join(cur_p)) + [""])
            cur_p = []
    return "\n".join(output)