-
-
Notifications
You must be signed in to change notification settings - Fork 185
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add template list, point to from root
- Loading branch information
1 parent
5dbca5f
commit 6299ad2
Showing
8 changed files
with
105 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
from . import link, image | ||
from . import root | ||
from . import templates | ||
from . import links | ||
from . import image |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from collections import OrderedDict | ||
|
||
from flask import Blueprint, current_app as app, url_for, redirect | ||
|
||
from ..domain import Image | ||
|
||
|
||
blueprint = Blueprint('root', __name__, url_prefix="/") | ||
|
||
|
||
@blueprint.route("") | ||
def get(**kwargs): | ||
"""Generate memes from templates.""" | ||
data = OrderedDict() | ||
data['templates'] = url_for("templates.get", _external=True) | ||
return data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from collections import OrderedDict | ||
|
||
from flask import Blueprint, current_app as app, request, url_for | ||
from flask_api import exceptions | ||
|
||
|
||
blueprint = Blueprint('templates', __name__, url_prefix="/templates/") | ||
|
||
|
||
@blueprint.route("") | ||
def get(): | ||
"""Get a list of all meme templates.""" | ||
data = OrderedDict() | ||
data['Insanity Wolf'] = url_for(".create", key='iw', _external=True) | ||
return data | ||
|
||
|
||
@blueprint.route("<key>", methods=['GET', 'POST']) | ||
def create(key): | ||
"""Generate a meme from a templates.""" | ||
if request.method == 'GET': | ||
return dict(sample=url_for("links.get", key=key, _external=True, | ||
top="hello", bottom="world")) | ||
elif request.method == 'POST': | ||
# TODO: https://github.com/jacebrowning/memegen/issues/12 | ||
raise exceptions.PermissionDenied("Feature not implemented.") | ||
else: # pragma: no cover | ||
assert None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters