Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(8)  |  Call(4)  |  Derive(0)  |  Import(4)
Return the name of a given resource, stripping 'Resource' off the end.

        def resource_name(resource_cls):
    """Return the name of a given resource, stripping 'Resource' off the end."""

    from dagny import Resource

    if isinstance(resource_cls, Resource):
        resource_cls = resource_cls.__class__

    name = resource_cls.__name__
    if name.endswith('Resource'):
        return name[:-8]
    return name
        


src/d/a/dagny-0.3.0/src/dagny/renderers.py   dagny(Download)
"""Generic, built-in renderers."""
 
from dagny.action import Action
from dagny.utils import camel_to_underscore, resource_name
 
    from django.shortcuts import render
 
    resource_label = camel_to_underscore(resource_name(resource))
    template_path_prefix = getattr(resource, 'template_path_prefix', "")
    template_name = "%s%s/%s.html" % (template_path_prefix, resource_label,

src/d/a/dagny-HEAD/src/dagny/renderers.py   dagny(Download)
"""Generic, built-in renderers."""
 
from dagny.action import Action
from dagny.utils import camel_to_underscore, resource_name
 
    from django.shortcuts import render
 
    resource_label = camel_to_underscore(resource_name(resource))
    template_path_prefix = getattr(resource, 'template_path_prefix', "")
    template_name = "%s%s/%s.html" % (template_path_prefix, resource_label,

src/d/a/dagny-0.3.0/src/dagny/action.py   dagny(Download)
from dagny.renderer import Renderer
from dagny.resource import Resource
from dagny.utils import resource_name
 
 
    def __init__(self, action, resource, resource_cls):
        self.action = action
        self.resource = resource
        self.resource_cls = resource_cls
        self.resource_name = resource_name(resource_cls)

src/d/a/dagny-HEAD/src/dagny/action.py   dagny(Download)
from dagny.renderer import Renderer
from dagny.resource import Resource
from dagny.utils import resource_name
 
 
    def __init__(self, action, resource, resource_cls):
        self.action = action
        self.resource = resource
        self.resource_cls = resource_cls
        self.resource_name = resource_name(resource_cls)