Exemplo n.º 1
0
def _put_tiddler(title, bag, tags, body):
    uri = 'http://example.org:8001/bags/%s/tiddlers/%s' % (bag, title)
    tags = tags_list_to_string(tags)
    rep = 'tags: %s\n\n%s' % (tags, body)

    http = httplib2.Http()
    response, content = http.request(uri, method='PUT',
            headers={ 'Content-Type': 'text/plain' }, body=rep)
    if not response.status == 204:
        raise RuntimeError(content)
Exemplo n.º 2
0
def test_tags_list_to_string():
    """
    Confirm that tags format as TiddlyWiki likes them.
    """
    tags = ['alpha', 'beta', 'Gamma Fire', 'troll']

    output = tags_list_to_string(tags)

    assert output == 'alpha beta [[Gamma Fire]] troll'

    assert sorted(string_to_tags_list(output)) == sorted(tags)
Exemplo n.º 3
0
def test_tags_list_to_string():
    """
    Confirm that tags format as TiddlyWiki likes them.
    """
    tags = ['alpha', 'beta', 'Gamma Fire', 'troll']

    output = tags_list_to_string(tags)

    assert output == 'alpha beta [[Gamma Fire]] troll'

    assert sorted(string_to_tags_list(output)) == sorted(tags)
Exemplo n.º 4
0
 def tags_as(self, tags):
     """
     Not called directly, but made public for future
     use. Turn a list of tags into a serialized list.
     """
     return tags_list_to_string(tags)
Exemplo n.º 5
0
 def tags_as(self, tags):
     """
     Not called directly, but made public for future
     use. Turn a list of tags into a serialized list.
     """
     return tags_list_to_string(tags)