Beispiel #1
0
    def token_add(self, provider, app, name):
        '''
        
        :param provider:
        :param app:
        :param name:
        '''
        token = Token(data=locals(), parent=self.config)
        if token.is_valid():
            app = token.cleaned_data['app']
            app.tokens.append(token)

        self.config.save_to_file()
        print "The token is saved as '%s'." % (token.name)
Beispiel #2
0
 def token_update(self, provider, app, name):
     '''
     
     :param provider:
     :param app:
     :param name:
     '''
     token = Token(data=locals(), parent=self.config)
     token.rewrite_name = True
     if token.is_valid():
         app = token.cleaned_data['app']
         for i, t in enumerate(app.tokens):
             if t.name == token.name:
                 app.tokens[i] = token
                 self.config.save_to_file()
                 print "The token '%s' is updated." % (token.name)
                 break