Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
plugin_dbui
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
Gitlab has been updated. More info
here
.
Show more breadcrumbs
w2pext
plugin_dbui
Commits
1532b80d
Commit
1532b80d
authored
14 years ago
by
Renaud Le Gac
Browse files
Options
Downloads
Patches
Plain Diff
Modify the error method to handle error code and message.
parent
71bf31d0
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/plugin_dbui/directsvc.py
+11
-6
11 additions, 6 deletions
modules/plugin_dbui/directsvc.py
with
11 additions
and
6 deletions
modules/plugin_dbui/directsvc.py
+
11
−
6
View file @
1532b80d
...
...
@@ -6,6 +6,7 @@ __version__ = "$Revision$"
import
pprint
import
traceback
import
sys
from
gluon.contrib
import
simplejson
as
json
...
...
@@ -74,7 +75,7 @@ class DirectSvc(object):
if
len
(
request
.
args
)
==
1
and
request
.
args
(
0
)
==
'
get_api
'
:
return
self
.
get_api
()
self
.
error
()
self
.
error
(
404
,
'
Object does not exist.
'
)
def
dbg
(
self
,
*
args
):
...
...
@@ -92,8 +93,8 @@ class DirectSvc(object):
return
x
def
error
(
self
):
raise
HTTP
(
404
,
'
Object does not exist.
'
)
def
error
(
self
,
code
,
message
):
raise
HTTP
(
code
,
message
)
def
get_api
(
self
):
...
...
@@ -165,13 +166,17 @@ class DirectSvc(object):
li
=
[]
for
arg
in
transactions
:
di
=
dict
(
arg
)
self
.
dbg
(
'
transaction:
'
,
di
)
try
:
k
=
proc_key
(
arg
[
'
action
'
],
arg
[
'
method
'
])
di
[
'
result
'
]
=
self
.
procedures
[
k
](
*
arg
[
'
data
'
])
if
arg
[
'
data
'
]:
di
[
'
result
'
]
=
self
.
procedures
[
k
](
*
arg
[
'
data
'
])
else
:
di
[
'
result
'
]
=
self
.
procedures
[
k
]()
except
Exception
:
except
Exception
,
e
:
traceback
.
print_exc
(
file
=
sys
.
stdout
)
raise
HTTP
(
500
,
'
Error on the server
'
)
self
.
error
(
500
,
'
Internal server error.
'
)
del
di
[
'
data
'
]
li
.
append
(
di
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment