Commit 17ebbf32 authored by Yábir García's avatar Yábir García

Fix special case when the urls takes no arguments

parent 1d31fd24
...@@ -6,10 +6,10 @@ urls = { ...@@ -6,10 +6,10 @@ urls = {
"followers": "/users/{username}/followers", "followers": "/users/{username}/followers",
"featured": "/users/{username}/collections/featured", "featured": "/users/{username}/collections/featured",
"atom": "/users/atom/{id}/", "atom": "/users/atom/{id}/",
"sharedInbox": "/inbox" "sharedInbox": "/inbox",
"photos": "/@{username}/photos", "photos": "/@{username}/photos",
"status": "/p/{username}/{id}", "status": "/p/{username}/{id}/ap",
"user": "/users/{username}", "user": "/users/{username}",
"profile_image": "/media/files/avatars/{name}", "profile_image": "/media/files/avatars/{name}",
...@@ -25,7 +25,10 @@ from models.base import BaseModel ...@@ -25,7 +25,10 @@ from models.base import BaseModel
from settings import (DOMAIN, SCHEME) from settings import (DOMAIN, SCHEME)
def reverse_uri(name, *args): def reverse_uri(name, *args):
return urls[name].format(**args[0]) if len(args):
return urls[name].format(**args[0])
else:
return urls[name]
def uri(name, *args): def uri(name, *args):
path = reverse_uri(name, *args) path = reverse_uri(name, *args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment