示例#1
0
文件: mainpage.py 项目: giorgil2/eXe
 def exportIpod(self, client, filename):
     """
     Export 'client' to an iPod Notes folder tree
     'webDir' is just read from config.webDir
     """
     try:
         # filename is a directory where we will export the notes to
         # We assume that the user knows what they are doing
         # and don't check if the directory is already full or not
         # and we just overwrite what's already there
         filename = Path(filename)
         # Append the package name to the folder path if necessary
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(_(u'Filename %s is a file, cannot replace it') % 
                          filename)
             log.error("Couldn't export web page: "+
                       "Filename %s is a file, cannot replace it" % filename)
             return
         else:
             client.alert(_(u'Folder name %s already exists. '
                             'Please choose another one or delete existing one then try again.') % filename)           
             return 
         # Now do the export
         ipodExport = IpodExport(self.config, filename)
         ipodExport.export(self.package)
     except Exception, e:
         client.alert(_('EXPORT FAILED!\n%s') % str(e))
         raise
 def exportIpod(self, client, filename):
     """
     Export 'client' to an iPod Notes folder tree
     'webDir' is just read from config.webDir
     """
     try:
         # filename is a directory where we will export the notes to
         # We assume that the user knows what they are doing
         # and don't check if the directory is already full or not
         # and we just overwrite what's already there
         filename = Path(filename)
         # Append the package name to the folder path if necessary
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(
                 _(u'Filename %s is a file, cannot replace it') % filename)
             log.error("Couldn't export web page: " +
                       "Filename %s is a file, cannot replace it" %
                       filename)
             return
         else:
             client.alert(
                 _(u'Folder name %s already exists. '
                   'Please choose another one or delete existing one then try again.'
                   ) % filename)
             return
         # Now do the export
         ipodExport = IpodExport(self.config, filename)
         ipodExport.export(self.package)
     except Exception, e:
         client.alert(_('EXPORT FAILED!\n%s') % str(e))
         raise
示例#3
0
 def exportIpod(self, client, filename):
     """
     Export 'client' to an iPod Notes folder tree
     'webDir' is just read from config.webDir
     """
     try:
         filename = Path(filename)
         if filename.basename() != self.package.name:
             filename /= self.package.name
         if not filename.exists():
             filename.makedirs()
         elif not filename.isdir():
             client.alert(_(u'Filename %s is a file, cannot replace it') % 
                          filename)
             log.error("Couldn't export web page: "+
                       "Filename %s is a file, cannot replace it" % filename)
             return
         else:
             client.alert(_(u'Folder name %s already exists. '
                             'Please choose another one or delete existing one then try again.') % filename)           
             return 
         ipodExport = IpodExport(self.config, filename)
         ipodExport.export(self.package)
     except Exception, e:
         client.alert(_('EXPORT FAILED!\n%s') % str(e))
         raise