コード例 #1
0
def manage_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    if not subscription:
        abort(404)
    if not subscription.verified:
        Subscription.verify_email(subscription.email_verification_token)
    return render_template("edit_subscription.html", subscription=json.dumps(subscription.to_dict()))
コード例 #2
0
ファイル: views.py プロジェクト: heddle317/kateheddleston.com
def manage_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    if not subscription:
        abort(404)
    if not subscription.verified:
        Subscription.verify_email(subscription.email_verification_token)
    return render_template("edit_subscription.html", subscription=json.dumps(subscription.to_dict()))
コード例 #3
0
def edit_subscription(uuid):
    data = json.loads(request.data)
    subscription = Subscription.update_subscription(uuid,
                                                    name=data.get('name'))
    return json.dumps(subscription.to_dict()), 200, {
        'Content-Type': 'application/json'
    }
コード例 #4
0
def admin_subscription_delete_category(subscription_uuid, category_uuid):
    SubscriptionCategory.delete(subscription_uuid=subscription_uuid,
                                category_uuid=category_uuid)
    subscription = Subscription.get(uuid=subscription_uuid)
    return json.dumps(subscription.to_dict()), 200, {
        'Content-Type': 'application/json'
    }
コード例 #5
0
ファイル: apis.py プロジェクト: xiaoyaocp/kateheddleston.com
def subscribe():
    data = json.loads(request.data)
    if not data.get("email"):
        return json.dumps({"message": "An email address is required."}), 200, {"content-type": "application/json"}
    subscription, message = Subscription.create_or_update(data.get("email"), name=data.get("name"))
    message = {"message": message}
    return json.dumps(message), 200, {"content-type": "application/json"}
コード例 #6
0
def admin_subscription_add_category(subscription_uuid):
    category_uuid = json.loads(request.data).get('category_uuid')
    SubscriptionCategory.create(subscription_uuid=subscription_uuid,
                                category_uuid=category_uuid)
    subscription = Subscription.get(uuid=subscription_uuid)
    return json.dumps(subscription.to_dict()), 200, {
        'Content-Type': 'application/json'
    }
コード例 #7
0
def subscribe():
    data = json.loads(request.data)
    if not data.get('email'):
        return json.dumps({'message': 'An email address is required.'}), 200, {
            'content-type': 'application/json'
        }
    subscription, message = Subscription.create_or_update(
        data.get('email'), name=data.get('name'))
    message = {"message": message}
    return json.dumps(message), 200, {'content-type': 'application/json'}
コード例 #8
0
def get_subscriptions():
    subscriptions = Subscription.get_list(sort_by='created_at',
                                          desc=True,
                                          to_json=True)
    return json.dumps(subscriptions), 200, {'Content-Type': 'application/json'}
コード例 #9
0
import sys

from app import app
from app.db.subscriptions import Subscription
from app.db.galleries import Gallery

if __name__ == "__main__":
    email = sys.argv[1]
    gallery_uuid = sys.argv[2]
    gallery = Gallery.get(uuid=gallery_uuid)
    with app.app_context():
        Subscription.send_subscription_email(email, gallery)
コード例 #10
0
 def send_emails(uuid):
     gallery = Gallery.get(uuid=uuid)
     Subscription.send_subscription_emails(gallery)
コード例 #11
0
ファイル: views.py プロジェクト: heddle317/kateheddleston.com
def cancel_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    subscription = Subscription.cancel_subscription(uuid)
    return redirect('/subscription/{}'.format(subscription.uuid))
コード例 #12
0
def cancel_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    subscription = Subscription.cancel_subscription(uuid)
    return redirect('/subscription/{}'.format(subscription.uuid))
コード例 #13
0
ファイル: views.py プロジェクト: heddle317/kateheddleston.com
def verify_email(verification_code):
    subscription = Subscription.verify_email(verification_code)
    if not subscription:
        abort(404)
    return redirect('/subscription/{}'.format(subscription.uuid))
コード例 #14
0
def api_cancel_subscription(uuid):
    subscription = Subscription.cancel_subscription(uuid)
    return json.dumps(subscription.to_dict()), 200, {
        'Content-Type': 'application/json'
    }
コード例 #15
0
ファイル: apis.py プロジェクト: xiaoyaocp/kateheddleston.com
def subscription_add_category(subscription_uuid):
    category_uuid = json.loads(request.data).get("category_uuid")
    SubscriptionCategory.create(subscription_uuid=subscription_uuid, category_uuid=category_uuid)
    subscription = Subscription.get(uuid=subscription_uuid)
    return json.dumps(subscription.to_dict()), 200, {"Content-Type": "application/json"}
コード例 #16
0
ファイル: apis.py プロジェクト: xiaoyaocp/kateheddleston.com
def edit_subscription(uuid):
    data = json.loads(request.data)
    subscription = Subscription.update_subscription(uuid, name=data.get("name"))
    return json.dumps(subscription.to_dict()), 200, {"Content-Type": "application/json"}
コード例 #17
0
ファイル: apis.py プロジェクト: heddle317/kateheddleston.com
def admin_subscription_add_category(subscription_uuid):
    category_uuid = json.loads(request.data).get('category_uuid')
    SubscriptionCategory.create(subscription_uuid=subscription_uuid, category_uuid=category_uuid)
    subscription = Subscription.get(uuid=subscription_uuid)
    return json.dumps(subscription.to_dict()), 200, {'Content-Type': 'application/json'}
コード例 #18
0
ファイル: apis.py プロジェクト: heddle317/kateheddleston.com
def verify_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    subscription.send_verification_email()
    return json.dumps(subscription.to_dict()), 200, {'Content-Type': 'application/json'}
コード例 #19
0
ファイル: apis.py プロジェクト: heddle317/kateheddleston.com
def get_subscriptions():
    subscriptions = Subscription.get_list(sort_by='created_at', desc=True, to_json=True)
    return json.dumps(subscriptions), 200, {'Content-Type': 'application/json'}
コード例 #20
0
ファイル: apis.py プロジェクト: xiaoyaocp/kateheddleston.com
def api_cancel_subscription(uuid):
    subscription = Subscription.cancel_subscription(uuid)
    return json.dumps(subscription.to_dict()), 200, {"Content-Type": "application/json"}
コード例 #21
0
def verify_subscription(uuid):
    subscription = Subscription.get(uuid=uuid)
    subscription.send_verification_email()
    return json.dumps(subscription.to_dict()), 200, {
        'Content-Type': 'application/json'
    }
コード例 #22
0
ファイル: apis.py プロジェクト: xiaoyaocp/kateheddleston.com
def subscription_delete_category(subscription_uuid, category_uuid):
    SubscriptionCategory.delete(subscription_uuid=subscription_uuid, category_uuid=category_uuid)
    subscription = Subscription.get(uuid=subscription_uuid)
    return json.dumps(subscription.to_dict()), 200, {"Content-Type": "application/json"}
コード例 #23
0
def verify_email(verification_code):
    subscription = Subscription.verify_email(verification_code)
    if not subscription:
        abort(404)
    return redirect('/subscription/{}'.format(subscription.uuid))