Exemplo n.º 1
0
 def _last_changeset(self):
     user = self._get_tg().user
     changesets = ch.get_user_changesets(user)
     if changesets:
         self._register_changeset(changesets[0]['id'])
     else:
         self.sender.sendMessage(self.t('no_changesets'))
Exemplo n.º 2
0
 def _list_changesets(self):
     user = self._get_tg().user
     changesets = ch.get_user_changesets(user, lang=self.lang)
     if changesets:
         msg = self.t('list_header') + u'\n\n' + u'\n'.join([u'{}: {}, {}'.format(
             c['id'], c['htime'], c['comment']) for c in changesets[:5]])
         self.sender.sendMessage(msg)
     else:
         self.sender.sendMessage(self.t('no_changesets'))
Exemplo n.º 3
0
 def _last_changeset(self):
     user = self._get_tg().user
     changesets = ch.get_user_changesets(user)
     if changesets:
         # Force create task for users who don't want to bother
         ch.get_or_create_task_for_user(user)
         self._register_changeset(changesets[0]['id'])
     else:
         self.sender.sendMessage(self.t('no_changesets'))
Exemplo n.º 4
0
def get_changesets():
    if 'osm_token' not in session:
        return jsonify(error='Log in please')
    user = User.get(User.uid == session['osm_uid'])
    try:
        result = ch.get_user_changesets(user, openstreetmap, lang=g.lang)
    except Exception as e:
        import logging
        logging.error('Error getting user changesets: %s', e)
        return jsonify(error='Error connecting to OSM API')
    return jsonify(changesets=result[:10])