def update_consumer(self, consumer_id, consumer): session = sql.get_session() with session.begin(): consumer_ref = self._get_consumer(session, consumer_id) old_consumer_dict = consumer_ref.to_dict() old_consumer_dict.update(consumer) new_consumer = Consumer.from_dict(old_consumer_dict) for attr in Consumer.attributes: if attr != 'id': setattr(consumer_ref, attr, getattr(new_consumer, attr)) consumer_ref.extra = new_consumer.extra return oauth2.filter_consumer(consumer_ref.to_dict())
def get_consumer(self, consumer_id): return oauth2.filter_consumer( self.get_consumer_with_secret(consumer_id))
def list_consumers(self): session = sql.get_session() cons = session.query(Consumer) return [ oauth2.filter_consumer(consumer.to_dict()) for consumer in cons ]
def list_consumers(self): session = sql.get_session() cons = session.query(Consumer) return [oauth2.filter_consumer(consumer.to_dict()) for consumer in cons]