Skip to content

Commit 02337ba

Browse files
committed
Merge pull request #58 from CodingForChange/bug_fix
Close Issue #57
2 parents cda0859 + 7d66031 commit 02337ba

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

PostmonServer.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ def verifica_cep(cep):
4949
db.insert_or_update(item)
5050
result = db.get_one(cep, fields={ '_id': False, 'v_date': False })
5151

52-
response.headers['Cache-Control'] = 'public, max-age=2592000'
53-
return result
52+
if result:
53+
54+
response.headers['Cache-Control'] = 'public, max-age=2592000'
55+
return result
56+
else:
57+
response.status = '404 O CEP %s informado nao pode ser localizado' % cep
58+
return
5459

5560

5661
@app_v1.route('/rastreio/<provider>/<track>')

0 commit comments

Comments
 (0)