Пример #1
0
 def __getattr__(self, name):
     if name == "__methods__" or name == "__members__": return
     if (not (name=="")) and not (name==None):
         branch = "master" #default branch is branch "master"
         if name.count(":") > 0:
             full_name = copy(name)
             name = full_name.split(":",1)[0]
             branch = full_name.split(":",1)[1]
         if skdb.check_unix_name(name): return self.load_package(name, branch=branch)
     raise AttributeError("%r object has no attribute %r" % (self.__class__.__name__, name))
Пример #2
0
    def load_package(cls, name, branch="master"):
        #keep track of which branch we want
        cherrypy.request.params["branch"] = branch

        if not (name in cls._packages):
            if skdb.check_unix_name(name):
                new_package = skdb.Package(name=name, create=False)
                new_package_page = Package(new_package)
                cls._packages.append(new_package_page)
                return new_package_page
        else: #already in there
            return cls._packages[cls._packages.index(name)] #return the corresponding entry