示例#1
0
 def test_UnhandleableMinimalPath(self):
     from Products.CMFCore.utils import minimalpath, normalize
     from tempfile import mktemp
     weirdpath = mktemp()
     # we need to normalize 'cos minimalpath does, btu we're not testing
     # normalize in this unit test.
     self.assertEqual(normalize(weirdpath), minimalpath(weirdpath))
示例#2
0
 def test_UnhandleableMinimalPath( self ):
     from Products.CMFCore.utils import minimalpath, normalize
     from tempfile import mktemp
     weirdpath = mktemp()
     # we need to normalize 'cos minimalpath does, btu we're not testing
     # normalize in this unit test.
     self.assertEqual( normalize(weirdpath), minimalpath(weirdpath) )
示例#3
0
    def listFSDirectoryViews( self ):

        """ Return a sequence of mappings for each FSDV.

        o Keys include:

          'id' -- FSDV ID

          'directory' -- filesystem path of the FSDV.
        """
        result = []
        fsdvs = self._skins_tool.objectItems( DirectoryView.meta_type )
        fsdvs.sort()

        for id, fsdv in fsdvs:

            dirpath = fsdv._dirpath

            if dirpath.startswith( '/' ):
                dirpath = minimalpath( fsdv._dirpath )

            result.append( { 'id' : id
                           , 'directory' : dirpath
                           } )

        return result
示例#4
0
文件: util.py 项目: dtgit/dtedu
def register_layer(self, relpath, name, out, add=True):
    """Register a file system directory as skin layer
    """
    print >>out, "register skin layers"
    skinstool = getToolByName(self, 'portal_skins')
    if name not in skinstool.objectIds():
        kupu_plone_skin_dir = minimalpath(os.path.join(kupu_package_dir, relpath))
        createDirectoryView(skinstool, kupu_plone_skin_dir, name)
        print >>out, "The layer '%s' was added to the skins tool" % name

    if not add:
        return

    # put this layer into all known skins
    for skinName in skinstool.getSkinSelections():
        path = skinstool.getSkinPath(skinName) 
        path = [i.strip() for i in path.split(',')]
        try:
            if name not in path:
                path.insert(path.index('custom')+1, name)
        except ValueError:
            if name not in path:
                path.append(name)

        path = ','.join(path)
        skinstool.addSkinSelection(skinName, path)
示例#5
0
def register_layer(self, relpath, name, out, add=True):
    """Register a file system directory as skin layer
    """
    print >> out, "register skin layers"
    skinstool = getToolByName(self, 'portal_skins')
    if name not in skinstool.objectIds():
        kupu_plone_skin_dir = minimalpath(
            os.path.join(kupu_package_dir, relpath))
        createDirectoryView(skinstool, kupu_plone_skin_dir, name)
        print >> out, "The layer '%s' was added to the skins tool" % name

    if not add:
        return

    # put this layer into all known skins
    for skinName in skinstool.getSkinSelections():
        path = skinstool.getSkinPath(skinName)
        path = [i.strip() for i in path.split(',')]
        try:
            if name not in path:
                path.insert(path.index('custom') + 1, name)
        except ValueError:
            if name not in path:
                path.append(name)

        path = ','.join(path)
        skinstool.addSkinSelection(skinName, path)
def install_skins(self, out, globals=GLOBALS, product_skins_dir=SKINS_DIR):

    logger.info('Installing Skin Product')

    out.write('PloneSlideShow Installation on %s\n' % self.id)
    out.write('======================\n\n')

    # Setup the skins
    skinstool=getToolByName(self, 'portal_skins')

    fullProductSkinsPath = join(package_home(globals), product_skins_dir)
    productSkinsPath = minimalpath(fullProductSkinsPath)
    registered_directories = manage_listAvailableDirectories()
    if productSkinsPath+'/SlideShow' not in registered_directories:
        registerDirectory(product_skins_dir+'/SlideShow', globals)
    try:
        addDirectoryViews(skinstool, product_skins_dir, globals)
        out.write("Added %s directory view to portal_skins\n" % skinname)
    except BadRequestException, e: 
       pass  # directory view has already been added
       out.write("%s directory view already existed in portal_skins\n" % skinname)
示例#7
0
    def __init__( self, id ):

        self.id = id
        self._dirpath = minimalpath( os.path.join(_TESTS_PATH, id) )
示例#8
0
    def __init__(self, id):

        self.id = id
        self._dirpath = minimalpath(os.path.join(_TESTS_PATH, id))