예제 #1
0
def get_marker(options=dict()):
    """Compute a unique marker for a set of options.

    The returned marker is a string suitable for use in
    filessystems. Different sets of options will result in different
    markers where order of options does not matter.

    In :mod:`ulif.openoffice` we use the marker to feed the cache
    manager and to mark different results for the same input file as
    different option sets will result in different output for same
    input.
    """
    result = sorted(options.items())
    result = '%s' % result
    return base64url_encode(result).replace('=', '')
예제 #2
0
def get_marker(options=dict()):
    """Compute a unique marker for a set of options.

    The returned marker is a string suitable for use in
    filessystems. Different sets of options will result in different
    markers where order of options does not matter.

    In :mod:`ulif.openoffice` we use the marker to feed the cache
    manager and to mark different results for the same input file as
    different option sets will result in different output for same
    input.
    """
    result = sorted(options.items())
    result = '%s' % result
    return base64url_encode(result).replace('=', '')
예제 #3
0
 def test_base64url_encode(self):
     assert base64url_encode(chr(251) + chr(239)) == '--8='
     assert base64url_encode(chr(255) * 2) == '__8='
예제 #4
0
 def test_base64url_encode(self):
     assert base64url_encode(chr(251) + chr(239)) == '--8='
     assert base64url_encode(chr(255) * 2) == '__8='
     assert base64url_encode("foo") == "Zm9v"
     assert base64url_encode(b"foo") == "Zm9v"
     assert base64url_encode(u"foo") == "Zm9v"