Example #1
0
    def calculatePath(cls, plugin, filepath):

        if plugin:
            module = CollaborationTools.getModule(plugin)
            if module:
                local_path = pkg_resources.resource_filename(module.__name__, "")
            else:
                return None
        else:
            local_path = pkg_resources.resource_filename(Collaboration.__name__, "")

        return super(RHCollaborationHtdocs, cls).calculatePath(
            filepath,
            local_path=os.path.join(local_path, 'htdocs'))
Example #2
0
    def calculatePath(cls, filepath, local_path=None, plugin=None):
        if plugin:
            module = CollaborationTools.getModule(plugin)
            if module:
                local_path = module.__path__[0]
            elif os.path.exists(os.path.join(Collaboration.__path__[0], 'htdocs', plugin)):
                return super(RHCollaborationHtdocs, cls).calculatePath(filepath, local_path=os.path.join(
                    Collaboration.__path__[0], 'htdocs', plugin))
            else:
                raise NotFound
        else:
            local_path = Collaboration.__path__[0]

        return super(RHCollaborationHtdocs, cls).calculatePath(filepath, os.path.join(local_path, 'htdocs'))
Example #3
0
    def calculatePath(cls, filepath, local_path=None, plugin=None):
        if plugin:
            module = CollaborationTools.getModule(plugin)
            if module:
                local_path = module.__path__[0]
            elif os.path.exists(
                    os.path.join(Collaboration.__path__[0], 'htdocs', plugin)):
                return super(RHCollaborationHtdocs,
                             cls).calculatePath(filepath,
                                                local_path=os.path.join(
                                                    Collaboration.__path__[0],
                                                    'htdocs', plugin))
            else:
                raise NotFound
        else:
            local_path = Collaboration.__path__[0]

        return super(RHCollaborationHtdocs,
                     cls).calculatePath(filepath,
                                        os.path.join(local_path, 'htdocs'))