Beispiel #1
0
 def get(self, character_id: int, mail_id: int):
     cc = current_user.get_character(character_id)
     if cc:  # pragma: no cover (Needs live character)
         api = mail_api(cc)
         try:
             api.delete_characters_character_id_mail_mail_id(
                 character_id, mail_id)
             flash('Mail has been deleted.', 'success')
         except ApiException as e:
             return api_fail(e)
         return redirect(url_for('.maillist', character_id=character_id))
     else:
         flash('Please select one of your characters.', 'warning')
     return redirect(url_for('.dashboard'))
Beispiel #2
0
 def get(self, character_id: int, mail_id: int, read: int):
     cc = current_user.get_character(character_id)
     if cc:  # pragma: no cover (Needs live character)
         api = mail_api(cc)
         try:
             status = 'read' if read else 'unread'
             esi.mark_mail_read(api, character_id, mail_id, read)
             flash(f'Mail has been marked as {status}.', 'success')
         except ApiException as e:
             return api_fail(e)
         return redirect(url_for('.maillist', character_id=character_id))
     else:
         flash('Please select one of your characters.', 'warning')
     return redirect(url_for('.dashboard'))
Beispiel #3
0
 def get(self, character_id):
     cc = current_user.get_character(character_id)
     if cc:  # pragma: no cover (Needs live character)
         api = skills_api(cc)
         try:
             rv = api.get_characters_character_id_skillqueue(character_id)
             return render_template('skillqueue.html',
                                    eveCache=eveCache,
                                    character_id=character_id,
                                    skillq=sorted(
                                        rv,
                                        key=attrgetter('queue_position')))
         except ApiException as e:
             return api_fail(e)
     else:
         flash('Please select one of your characters.', 'warning')
     return redirect(url_for('.dashboard'))
Beispiel #4
0
 def get(self, character_id: int, mail_id: int):
     cc = current_user.get_character(character_id)
     if cc:
         api = mail_api(cc)
         try:
             rv = api.get_characters_character_id_mail_mail_id(
                 character_id, mail_id)
             return render_template('mail.html',
                                    character_id=character_id,
                                    mail_id=mail_id,
                                    eveCache=eveCache,
                                    mail=rv)
         except ApiException as e:
             return api_fail(e)
     else:
         flash('Please select one of your characters.', 'warning')
     return redirect(url_for('.dashboard'))
Beispiel #5
0
 def get(self, character_id, label=None):
     cc = current_user.get_character(character_id)
     if cc:  # pragma: no cover (Needs live character)
         api = mail_api(cc)
         kwargs = {'labels': [label]} if isinstance(label, int) else {}
         try:
             labels = esi.get_mail_labels(api, character_id)
             mails = esi.get_mails(api, character_id, **kwargs)
             mail_ids = {m._from for m in mails}
             eveCache.eve_characters(mail_ids)
         except ApiException as e:
             return api_fail(e)
         sl = sorted(labels.labels, key=attrgetter('label_id'))
         sm = sorted(mails, key=attrgetter('timestamp'), reverse=True)
         return render_template('maillist.html',
                                eveCache=eveCache,
                                character_id=character_id,
                                labels=sl,
                                maillist=sm)
     else:
         flash('Please select one of your characters.', 'warning')
     return redirect(url_for('.dashboard'))