Example #1
0
 def url(self, request):
     """
         return the url to fetch the given file
     """
     root_directory = get_root_directory(request)
     relpath = self.path.replace(root_directory, "", 1)
     return request.route_path("treasury_files",
             id=request.context.id,
             _query=dict(name=encode_path(relpath)))
Example #2
0
    def url(self, request, company_id=None):
        """
        return the url to fetch the given file

        :param obj request: The current request object
        :param int company_id: The id of the company owning the document
            (default: the current request context)
        """
        if company_id is None:
            company_id = request.context.id

        root_directory = get_root_directory(request)
        relpath = self.path.replace(root_directory, "", 1)

        return request.route_path("treasury_files",
                                  id=company_id,
                                  _query=dict(name=encode_path(relpath)))
Example #3
0
    def url(self, request, company_id=None):
        """
        return the url to fetch the given file

        :param obj request: The current request object
        :param int company_id: The id of the company owning the document
            (default: the current request context)
        """
        if company_id is None:
            company_id = request.context.id

        root_directory = get_root_directory(request)
        relpath = self.path.replace(root_directory, "", 1)

        return request.route_path(
            "treasury_files",
            id=company_id,
            _query=dict(name=encode_path(relpath))
        )
Example #4
0
def test_encode_decode():
    st = u"$deù % ù$ùdeù % - /// //  \ \dekodok %spkoij  idje  ' kopk \""
    encoded = encode_path(st)
    assert decode_path(encoded) == st
Example #5
0
 def test_encode_decode(self):
     st = u"$deù % ù$ùdeù % - /// //  \ \dekodok %spkoij  idje  ' kopk \""
     encoded = encode_path(st)
     self.assertEqual(decode_path(encoded), st)
Example #6
0
def test_encode_decode():
    st = u"$deù % ù$ùdeù % - /// //  \ \dekodok %spkoij  idje  ' kopk \""
    encoded = encode_path(st)
    assert decode_path(encoded) == st