Commits

Roma Sokolov committed 377822d

join two views in one and fix split_tags decorator

Comments (0)

Files changed (2)

 
 from flask import Flask
 from flask import request
+from flask import render_template
 
+from utils import split_tags
 
 import config
 try:
     return "Hello World!"
 
 
+@app.route("/get/")
 @app.route("/get/<plus_separated_tags>")
 @split_tags
 def get(*tags):
     return str(tags)
 
 
-@app.route("/get/")
-def get_all():
-    return 'all'
-
-
 @app.route("/add/<plus_separated_tags>")
 @split_tags
 def add(*tags):
 
 def split_tags(func):
     @wraps(func)
-    def wrapper(plus_separated_tags):
-        return func(*plus_separated_tags.split('+'))
+    def wrapper(plus_separated_tags=''):
+        if plus_separated_tags:
+            return func(*plus_separated_tags.split('+'))
+        else:
+            return func()
     return wrapper