Display fetchmail errors to the user, fixes #23

This commit is contained in:
Pierre Jaury
2016-09-10 13:05:55 +02:00
parent 709869d4ba
commit 2cb4a44b5a
5 changed files with 53 additions and 18 deletions

View File

@@ -208,3 +208,5 @@ class Fetch(Base):
tls = db.Column(db.Boolean(), nullable=False)
username = db.Column(db.String(255), nullable=False)
password = db.Column(db.String(255), nullable=False)
last_check = db.Column(db.DateTime, nullable=True)
error = db.Column(db.String(1023), nullable=True)

View File

@@ -17,11 +17,10 @@ Fetched accounts
<tbody>
<tr>
<th>Actions</th>
<th>Protocol</th>
<th>Hostname</th>
<th>Port</th>
<th>TLS</th>
<th>Endpoint</th>
<th>Username</th>
<th>Last check</th>
<th>Status</th>
<th>Created</th>
<th>Last edit</th>
</tr>
@@ -31,11 +30,10 @@ Fetched accounts
<a href="{{ url_for('.fetch_edit', fetch_id=fetch.id) }}" title="Edit"><i class="fa fa-pencil"></i></a>&nbsp;
<a href="{{ url_for('.fetch_delete', fetch_id=fetch.id) }}" title="Delete"><i class="fa fa-trash"></i></a>
</td>
<td>{{ fetch.protocol }}</td>
<td>{{ fetch.host }}</td>
<td>{{ fetch.port }}</td>
<td>{{ fetch.tls }}</td>
<td>{{ fetch.protocol }}{{ 's' if fetch.tls else '' }}://{{ fetch.host }}:{{ fetch.port }}</td>
<td>{{ fetch.username }}</td>
<td>{{ fetch.last_check or '-' }}</td>
<td>{{ fetch.error or '-' }}</td>
<td>{{ fetch.created_at }}</td>
<td>{{ fetch.updated_at or '' }}</td>
</tr>

View File

@@ -0,0 +1,25 @@
""" Add metadata related to fetches
Revision ID: dc8c25cf5b98
Revises: a4accda8a8c7
Create Date: 2016-09-10 12:41:01.161357
"""
# revision identifiers, used by Alembic.
revision = 'dc8c25cf5b98'
down_revision = 'a4accda8a8c7'
from alembic import op
import sqlalchemy as sa
def upgrade():
op.add_column('fetch', sa.Column('error', sa.String(length=1023), nullable=True))
op.add_column('fetch', sa.Column('last_check', sa.DateTime(), nullable=True))
def downgrade():
with op.batch_alter_table('fetch') as batch:
batch.drop_column('last_check')
batch.drop_column('error')