Ejemplo n.º 1
0
 def application_url(self, name=None):
     """Return the URL of the nearest enclosing `grok.Application`."""
     obj = self.context.context
     while obj is not None:
         if isinstance(obj, grok.Application):
             return url(self.request, obj, name)
         obj = obj.__parent__
     raise ValueError("No application found.")
Ejemplo n.º 2
0
    def url(self, obj=None, name=None, data=None):
        """Return string for the URL based on the obj and name. The data
        argument is used to form a CGI query string.
        """
        if isinstance(obj, basestring):
            if name is not None:
                raise TypeError(
                    'url() takes either obj argument, obj, string arguments, '
                    'or string argument')
            name = obj
            obj = None

        if obj is None:
            obj = self.context
        if data is None:
            data = {}
        else:
            if not isinstance(data, dict):
                raise TypeError('url() data argument must be a dict.')

        return util.url(self.request, obj, name, data=data)
Ejemplo n.º 3
0
def application_url(request, obj, name=None, data={}):
    """Return the URL of the nearest enclosing `grok.Application`.

    Raises ValueError if no Application can be found.
    """
    return url(request, getApplication(), name, data)
Ejemplo n.º 4
0
def application_url(request, obj, name=None, skin=ASIS, data={}):
    """Return the URL of the nearest enclosing :class:`grok.Application`.

    Raises :exc:`ValueError` if no application can be found.
    """
    return url(request, getApplication(), name=name, skin=skin, data=data)
Ejemplo n.º 5
0
Archivo: util.py Proyecto: sshyran/grok
def application_url(request, obj, name=None, skin=ASIS, data={}):
    """Return the URL of the nearest enclosing :class:`grok.Application`.

    Raises :exc:`ValueError` if no application can be found.
    """
    return url(request, getApplication(), name=name, skin=skin, data=data)
Ejemplo n.º 6
0
 def application_url(self, name=None, data={}):
     """Return the URL of the nearest enclosing `grok.Application`.
     """
     return url(self.request, getApplication(), name=name, data=data)