예제 #1
0
    def get(self):

        self.session = Session()
        formatter = StringFormatter()
        client = OAuthClient('twitter', self, 'noName')
    
        token_info = client.getAccessToken(self.request.query_string.split('=')[1])
        error = ''
        company = ''
        
        if 'user' not in self.session:
            error = 'Unauthorized User Error'
        else:
            user = self.session['user']
            company = formatter.getCompanyProfileName(user)
        values = formatter.getValues(token_info)
        
        #Must use dbInterface
        query = db.Query(UserToken)
        query = query.filter('dbTwitterName=', values[3])
        results = query.fetch(limit = 1)
        
        if len(results) > 0:
            for r in results:
                db.delete(r)
                
        if error == '':
            token = UserToken(dbProfileName = company, dbTwitterName = values[3], dbToken = values[0], dbTokenSecret = values[1])
            token.put();
        self.redirect('settings.html')       		
예제 #2
0
 def get(self):
     formatter = StringFormatter()
     datastore = DataStoreInterface()
     
     queries = []
     queries = formatter.getValues(self.request.query_string)
     
     if len(queries) == 1:
         if (datastore.companyProfileExists(queries[0]) == 1):                
             posts = datastore.getPosts(queries[0], 5)
             
             for p in posts:
                 self.response.out.write(p.dbTitle + ' - ' + p.dbBody + '<br>')
         else:
             self.response.out.write('Company Not Found')
 
     else:
         self.response.out.write("unknown query")