Beispiel #1
0
    def configure(self, url, pwd, name, response):
        '''
        Configure cozy-files
            url  {string}: cozy url
            pwd  {string}: cozy password
            name {string}: device name
            response  {object}: response of responseuest to add device in cozy
        '''

        self.max_prog = 0.1
        self._display_error("")
        init_database()

        self.max_prog = 0.15
        data = json.loads(response.content)
        replicate_to_local_one_shot_without_deleted(
            url, name, data['password'], data['id'])

        self.max_prog = 0.40
        err = init_device(url, data['password'], data['id'])
        if err:
            self._display_error(err)
            return
        replicate_from_local_one_shot(url, name, data['password'], data['id'])

        self.max_prog = 0.70
        self.max_prog = 0.72
        pass
 def configure(self, url, pwd, name, req):
     '''
     Configure cozy-files
         url  {string}: cozy url
         pwd  {string}: cozy password
         name {string}: device name
         req  {object}: response of request to add device in cozy
     '''
     self.max_prog = 0.1
     self._display_error("")
     init_database() 
     self.max_prog = 0.15
     data = json.loads(req.content)
     repli = replicate_to_local_one_shot_without_deleted(url, name, data['password'], data['id'])   
     self.max_prog = 0.30  
     replicate_to_local_start_seq(url, name, data['password'], data['id'], repli['source_last_seq'])   
     self.max_prog = 0.98
     err = init_device(url, data['password'], data['id'])
     if err:
         self._display_error(err)
         return             
     replicate_from_local(url, name, data['password'], data['id'])
     pass