def send_commons_to_contact(self, client, contact, now, date): ''' Send pictures from last month to given contact. ''' commons = CommonManager.get_owner_last_commons( startKey=date_util.get_db_date_from_date(now), endKey=date_util.get_db_date_from_date(date)) for common in commons: if tags_match(common, contact): body = common.toJson(localized=False) client.post(contact, COMMON_PATH, body, self.onContactResponse)
def post(self): ''' When a post request is sent, the newebe downloads full size version of common specified in the request from the contact also specified in the request. ''' data = self.get_body_as_dict() contact = ContactManager.getTrustedContact(data["contact"]["key"]) if contact: date = data["common"]["date"] common = CommonManager.get_owner_last_commons(date).first() if common: self.on_common_found(common, id) else: logger.info("Common no more available.") self.return_failure("Common not found.", 404) else: logger.info("Contact unknown") self.return_failure("Common not found", 404)
def post(self): ''' When a post request is sent, the newebe downloads full size version of common specified in the request from the contact also specified in the request. ''' data = self.get_body_as_dict() contact = ContactManager.getTrustedContact(data["contact"]["key"]) if contact: date = data["common"]["date"] common = CommonManager.get_owner_last_commons(date).first() if common: self.on_common_found(common, id) else: logger.info("Common no more available.") self.return_failure("Common not found.", 404) else: logger.info("Contact unknown") self.return_failure("Common not found", 404)
def when_i_get_my_last_commons(step): world.commons = CommonManager.get_owner_last_commons().all()
def when_i_get_owner_commons_until_november_1(step): world.commons = CommonManager.get_owner_last_commons( "2011-11-01T23:59:00Z").all()
def when_i_get_my_last_commons(step): world.commons = CommonManager.get_owner_last_commons().all()
def when_i_get_owner_commons_until_november_1(step): world.commons = CommonManager.get_owner_last_commons( "2011-11-01T23:59:00Z").all()