Mercurial > libervia-web
diff src/server/blog.py @ 728:9d35d75566fb
server_side (blog): clean error message when unknown profile is requested
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 06 Oct 2015 16:38:41 +0200 |
parents | 3bd097380da7 |
children | 916075bd0356 |
line wrap: on
line diff
--- a/src/server/blog.py Mon Oct 05 09:15:47 2015 +0200 +++ b/src/server/blog.py Tue Oct 06 16:38:41 2015 +0200 @@ -23,6 +23,7 @@ from sat.core.log import getLogger log = getLogger(__name__) +from dbus.exceptions import DBusException from twisted.internet import defer from twisted.web import server from twisted.web.resource import Resource @@ -118,7 +119,10 @@ prof_requested = request.postpath[0] #TODO : char check: only use alphanumeric chars + some extra(_,-,...) here - prof_found = self.host.bridge.getProfileName(prof_requested) + try: + prof_found = self.host.bridge.getProfileName(prof_requested) + except DBusException: + prof_found = None if not prof_found or prof_found == C.SERVICE_PROFILE: return self.useTemplate(request, "static_blog_error", {'message': "Invalid nickname"})