-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changed SAMBRO homepage 500 error #1494
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from datetime import datetime, timedelta | ||
from gluon.messageboxhandler import Tkinter | ||
|
||
try: | ||
import json # try stdlib (Python 2.6) | ||
|
@@ -45,11 +46,15 @@ def __call__(self): | |
layer = current.db(query).select(ftable.layer_id, | ||
limitby=(0, 1) | ||
).first() | ||
|
||
skipMap = True | ||
try: | ||
layer_id = layer.layer_id | ||
skipMap = False | ||
except: | ||
current.log.error("Cannot find Layer for Map") | ||
layer_id = None | ||
Tkinter.messagebox.showinfo("Error", "Cannot find Layer for Map") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The message should be shown on the client-side, not on the server as normally there's no user there (hence the log message here). Besides, Tkinter is an optional module, and (for the same reason) not normally installed on the server. The message can be shown either as HTML in place of the map (simply by putting it into the _map variable), or as response.error. |
||
|
||
|
||
feature_resources = [{"name" : T("Alerts"), | ||
"id" : "search_results", | ||
|
@@ -59,15 +64,15 @@ def __call__(self): | |
# We activate in callback after ensuring URL is updated for current filter status | ||
"active" : False, | ||
}] | ||
|
||
_map = current.gis.show_map(callback='''S3.search.s3map()''', | ||
catalogue_layers=True, | ||
collapsed=True, | ||
feature_resources=feature_resources, | ||
save=False, | ||
search=True, | ||
toolbar=True, | ||
) | ||
if not skipMap: | ||
_map = current.gis.show_map(callback='''S3.search.s3map()''', | ||
catalogue_layers=True, | ||
collapsed=True, | ||
feature_resources=feature_resources, | ||
save=False, | ||
search=True, | ||
toolbar=True, | ||
) | ||
output["_map"] = _map | ||
|
||
# Filterable List of Alerts | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming convention: not pascalCase, but all_lower_case with underscore as word separator