Example #1
0
def commentto(number, params={}):
    template = """# comment below here\n"""
    val = util.inputwitheditor(template)
    data = {'body': util.rmcomment(val)}
    cfg = config.parseconfig()
    _request('post',
             ISSUE_COMMENTS.format(issueid=number, **cfg),
             data=json.dumps(data),
             params=params)
Example #2
0
def commentto(number, params={}):
    template = """# comment below here\n"""
    val = util.inputwitheditor(template)
    data = {'notes': util.rmcomment(val)}
    cfg = config.parseconfig()
    _request('put',
             ISSUE.format(issueid=number, **cfg),
             data=json.dumps(data),
             params=params,
             headers={'content-type': 'application/json'})
Example #3
0
def templatetodic(s, mapping={}):
    s = util.rmcomment(s)
    lines = s.split(u'\n')
    d = {}
    name = None
    for line in lines:
        content = util.regex_extract(ur'^:(.+?):(.*)', line)
        if content:
            name = content[0].replace(u' ', u'_').lower()
            name = mapping.get(name, name)
            d[name] = content[1].strip(u' ')
        elif name is not None:  # 継続行とみなす
            d[name] += u'\n' + line.rstrip(u' ')
    for k, v in d.items():
        d[k] = v.strip('\n')
        if len(d[k]) == 0:  # stringであることを暗に
            del d[k]
    return d
Example #4
0
def templatetodic(s, mapping={}):
    s = util.rmcomment(s)
    lines = s.split(u'\n')
    d = {}
    name = None
    for line in lines:
        content = util.regex_extract(ur'^:(.+?):(.*)', line)
        if content:
            name = content[0].replace(u' ', u'_').lower()
            name = mapping.get(name, name)
            d[name] = content[1].strip(u' ')
        elif name is not None: # 継続行とみなす
            d[name] += u'\n' + line.rstrip(u' ')
    for k, v in d.items():
        d[k] = v.strip('\n')
        if len(d[k]) == 0: # stringであることを暗に
            del d[k]
    return d
Example #5
0
def commentto(number, params={}):
    template = """# comment below here\n"""
    val = util.inputwitheditor(template)
    data = {'content': util.rmcomment(val)}
    cfg = config.parseconfig()
    _request('post', ISSUE_COMMENTS.format(issueid=number, **cfg), data=data)
Example #6
0
def commentto(number, params={}):
    template = """# comment below here\n"""
    val = util.inputwitheditor(template)
    data = {'notes': util.rmcomment(val)}
    cfg = config.parseconfig()
    _request('put', ISSUE.format(issueid=number, **cfg), data=json.dumps(data), params=params, headers={'content-type': 'application/json'})