def process_response(self, result):
     if type(result) == type((1, )): # error
         st, msg = result
         if st == -1:
             self.show_parent()
             wcall.err_general(self.action, msg)
     self.ret = result
     return 0
 def process_response(self, result):
     if type(result) == type((1, )):  # error
         st, msg = result
         if st == -1:
             self.show_parent()
             wcall.err_general(self.action, msg)
     self.ret = result
     return 0
Exemple #3
0
    def process_response(self, result):

        if isinstance(result, str):  # overwrite file?
            if self.overwrite_none:
                return 0
            n = 0
            if len(self.lst) > 1: n = 1

            src = os.path.join(self.args[0], self.filename)
            if not os.path.isfile(self.args[1]):
                dest = os.path.join(self.args[1], result)
            else:
                dest = self.args[1]

            size_src, mtime_src, size_dest, mtime_dest = '', '', '', ''
            try:
                finfo_src = files.get_fileinfo(src)

                size_src = finfo_src[files.FT_SIZE]
                mtime_src = time.strftime('%a %b %d %Y %H:%M', \
                                        time.localtime(finfo_src[files.FT_MTIME]))

                finfo_dest = files.get_fileinfo(dest)
                size_dest = finfo_dest[files.FT_SIZE]
                mtime_dest = time.strftime('%a %b %d %Y %H:%M', \
                                        time.localtime(finfo_dest[files.FT_MTIME]))
            except:
                pass

            ans = wcall.cfm_overwrite(self.action, dest, mtime_src, size_src,\
                                            mtime_dest, size_dest, n)

            if ans == -1:
                return -1
            elif ans == -2:
                self.overwrite_none = True
                return -1
            elif ans == 0:
                return 0
            elif ans == 1:
                pass
            elif ans == 2:
                self.overwrite_all = True

            self.ret = []  # need to reset child return value
            args = (self.filename, ) + self.args + (False,
                                                    )  #False is overwrite flag
            self.p2c.send(('exec', args))
            #return 1
            return self.wait_for_answer()

        elif isinstance(result, tuple):  # error from child
            wcall.err_general('%s \'%s\'' % (self.action, self.filename),
                              '%s (%s)' % result)
            return 0
        return 0  #continue copying/moving
    def process_response(self, result):

        if isinstance(result, str): # overwrite file?
            if self.overwrite_none:
                return 0
            n = 0
            if len(self.lst) >1: n = 1

            src = os.path.join(self.args[0], self.filename)
            if not os.path.isfile (self.args[1]):
                dest = os.path.join( self.args[1], result)
            else:
                dest = self.args[1]

            size_src, mtime_src, size_dest, mtime_dest = '','','',''
            try:
                finfo_src = files.get_fileinfo(src)

                size_src = finfo_src[files.FT_SIZE]
                mtime_src = time.strftime('%a %b %d %Y %H:%M', \
                                        time.localtime(finfo_src[files.FT_MTIME]))

                finfo_dest = files.get_fileinfo(dest)
                size_dest = finfo_dest[files.FT_SIZE]
                mtime_dest = time.strftime('%a %b %d %Y %H:%M', \
                                        time.localtime(finfo_dest[files.FT_MTIME]))
            except:
                pass

            ans = wcall.cfm_overwrite(self.action, dest, mtime_src, size_src,\
                                            mtime_dest, size_dest, n)

            if ans == -1:
                return -1
            elif ans == -2:
                self.overwrite_none = True
                return -1
            elif ans == 0:
                return 0
            elif ans == 1:
                pass
            elif ans == 2:
                self.overwrite_all = True

            self.ret=[] # need to reset child return value
            args = (self.filename, ) + self.args + (False, ) #False is overwrite flag
            self.p2c.send(('exec', args))
            #return 1
            return self.wait_for_answer()

        elif isinstance(result, tuple): # error from child
            wcall.err_general('%s \'%s\'' % (self.action, self.filename),
                           '%s (%s)' % result)
            return 0
        return 0    #continue copying/moving
 def process_response(self, result):
     if type(result) == type((1,)):               # error from child
         wcall.err_general('%s \'%s\'' % (self.action, self.filename),
                        '%s (%s)' % result)
     return 0
Exemple #6
0
 def process_response(self, result):
     if type(result) == type((1, )):  # error from child
         wcall.err_general('%s \'%s\'' % (self.action, self.filename),
                           '%s (%s)' % result)
     return 0