Example #1
0
    def paste_uri(self, uri, scheme=None, host=None, directory=None,
                  filename=None, locale=None, session=None, pathinfo=None,
                  args=None):
        """Paste into an URI.

        The arguments specify values to paste into `uri' in case it does
        not contain that component.
        """
        if callable(uri):
            extension = self.m_api.options['extension']
            uri = dracouri.uri_from_method(uri, extension)
        if isinstance(pathinfo, list):
            pathinfo = '/'.join(pathinfo)
        if isinstance(args, dict):
            args = urimod.create_query(args)
        docroot = self.m_request.docroot()
        return dracouri.paste_draco_uri(uri, docroot, scheme, host, directory,
                                        filename, locale, session, pathinfo,
                                        args)
Example #2
0
    def patch_uri(self, uri, scheme=None, host=None, directory=None,
                  filename=None, locale=None, session=None, pathinfo=None,
                  args=None):
        """Patch an URI.

        The arguments specify with components of the URI to patch.
        Components that are not specified are left untouched.
        """
        if callable(uri):
            extension = self.m_api.options['extension']
            uri = dracouri.uri_from_method(uri, extension)
        if isinstance(pathinfo, list):
            pathinfo = '/'.join(pathinfo)
        if isinstance(args, dict):
            args = urimod.create_query(args)
        docroot = self.m_request.docroot()
        return dracouri.patch_draco_uri(uri, docroot, scheme, host, directory,
                                        filename, locale, session, pathinfo,
                                        args)