Back to index

moin  1.9.0~rc2
Public Member Functions
fckcommands.CreateFolderCommandMixin Class Reference
Inheritance diagram for fckcommands.CreateFolderCommandMixin:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def createFolder
def createServerFolder

Detailed Description

Definition at line 87 of file fckcommands.py.


Member Function Documentation

def fckcommands.CreateFolderCommandMixin.createFolder (   self,
  resourceType,
  currentFolder 
)
Purpose: command to create a new folder

Reimplemented in zope.FCKeditorConnectorZope.

Definition at line 88 of file fckcommands.py.

00088 
00089        def createFolder(self, resourceType, currentFolder):
00090               """
00091               Purpose: command to create a new folder
00092               """
00093               errorNo = 0; errorMsg ='';
00094               if self.request.has_key("NewFolderName"):
00095                      newFolder = self.request.get("NewFolderName", None)
00096                      newFolder = sanitizeFolderName (newFolder)
00097                      try:
00098                             newFolderPath = mapServerFolder(self.userFilesFolder, combinePaths(currentFolder, newFolder))
00099                             self.createServerFolder(newFolderPath)
00100                      except Exception, e:
00101                             errorMsg = str(e).decode('iso-8859-1').encode('utf-8') # warning with encodigns!!!
00102                             if hasattr(e,'errno'):
00103                                    if e.errno==17: #file already exists
00104                                           errorNo=0
00105                                    elif e.errno==13: # permission denied
00106                                           errorNo = 103
00107                                    elif e.errno==36 or e.errno==2 or e.errno==22: # filename too long / no such file / invalid name
00108                                           errorNo = 102
00109                             else:
00110                                    errorNo = 110
00111               else:
00112                      errorNo = 102
00113               return self.sendErrorNode ( errorNo, errorMsg )

Here is the call graph for this function:

Definition at line 114 of file fckcommands.py.

00114 
00115        def createServerFolder(self, folderPath):
00116               "Purpose: physically creates a folder on the server"
00117               # No need to check if the parent exists, just create all hierachy
00118 
00119               try:
00120                      permissions = Config.ChmodOnFolderCreate
00121                      if not permissions:
00122                             os.makedirs(folderPath)
00123               except AttributeError: #ChmodOnFolderCreate undefined
00124                      permissions = 0755
00125 
00126               if permissions:
00127                      oldumask = os.umask(0)
00128                      os.makedirs(folderPath,mode=0755)
00129                      os.umask( oldumask )

Here is the caller graph for this function:


The documentation for this class was generated from the following file: