예제 #1
0
 def test_paths(self):
     self.assertEqual(osextra.to_valid_name("$name of %path /and"), "name of path and")
     
예제 #2
0
파일: project.py 프로젝트: D3f0/prymatex
 def dataFilePath(self, basePath, baseName = None):
     directory = osextra.path.ensure_not_exists(os.path.join(basePath, self.FOLDER, "%s"), osextra.to_valid_name(baseName or self.name))
     return os.path.join(directory, self.FILE)
예제 #3
0
파일: base.py 프로젝트: prymatex/prymatex
 def createSourcePath(self, baseDirectory):
     return osextra.path.ensure_not_exists(
         os.path.join(baseDirectory, self.FOLDER, "%%s.%s" % self.EXTENSION), 
         osextra.to_valid_name(self.name))
예제 #4
0
파일: bundle.py 프로젝트: prymatex/prymatex
 def createSourcePath(self, baseDirectory):
     return osextra.path.ensure_not_exists(os.path.join(baseDirectory, "%s.tmbundle"), osextra.to_valid_name(self.name))
예제 #5
0
    def updateStaticFile(self, staticFile, ns_name=config.USR_NS_NAME, **attrs):
        namespace = self.namespace(ns_name)
        assert namespace is not None, "No namespace for %s" % ns_name

        parentItem = staticFile.parentItem
        if self.isProtectedNamespace(ns_name) and not self.isSafe(parentItem):
            self.updateBundleItem(parentItem, namespace)
        if "name" in attrs:
            path = osextra.path.ensure_not_exists(os.path.join(parentItem.path(namespace), "%s"), osextra.to_valid_name(attrs["name"]))
            staticFile.relocate(path)
        staticFile.update(attrs)
        self.onBundleItemModified(staticFile)
        return staticFile
예제 #6
0
    def createStaticFile(self, parentItem, ns_name=config.USR_NS_NAME):
        namespace = self.namespace(ns_name)
        assert namespace is not None, "No namespace for %s" % ns_name
        
        if self.isProtectedNamespace(ns_name) and not self.isSafe(parentItem):
            self.updateBundleItem(parentItem, namespace)

        path = osextra.path.ensure_not_exists(os.path.join(parentItem.path(namespace), "%s"), osextra.to_valid_name(name))
        staticFile = StaticFile(path, parentItem)
        #No es la mejor forma pero es la forma de guardar el archivo
        parentItem.addStaticFile(staticFile)
        self.onStaticFileAdded(staticFile)
        staticFile.save()
        return staticFile
예제 #7
0
파일: manager.py 프로젝트: D3f0/prymatex
 def updateStaticFile(self, staticFile, namespaceName, **attrs):
     namespace = self.safeNamespace(namespaceName)
     parentItem = staticFile.parentItem
     if self.isProtected(parentItem) and not self.isSafe(parentItem):
         self.updateBundleItem(parentItem, namespace)
     if "name" in attrs:
         path = osextra.path.ensure_not_exists(os.path.join(parentItem.path(namespace), "%s"), osextra.to_valid_name(attrs["name"]))
         staticFile.relocate(path)
     staticFile.update(attrs)
     self.modifyBundleItem(staticFile)
     return staticFile
예제 #8
0
파일: manager.py 프로젝트: D3f0/prymatex
    def createStaticFile(self, parentItem, namespaceName=None):
        namespace = self.safeNamespace(namespaceName)
        
        if self.isProtected(parentItem) and not self.isSafe(parentItem):
            self.updateBundleItem(parentItem, namespace)

        path = osextra.path.ensure_not_exists(os.path.join(parentItem.path(namespace), "%s"), osextra.to_valid_name(name))
        staticFile = StaticFile(path, parentItem)
        #No es la mejor forma pero es la forma de guardar el archivo
        staticFile = self.addStaticFile(staticFile)
        parentItem.addStaticFile(staticFile)
        staticFile.save()
        return staticFile