Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
2fc47465
Commit
2fc47465
authored
Jun 19, 2014
by
LE GAC Renaud
Browse files
Add error detection in the controller publications/update.
Bug fixed in epydoc strings.
parent
1f991b65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
controllers/publications.py
controllers/publications.py
+19
-11
modules/harvest_tools.py
modules/harvest_tools.py
+5
-6
static/CHANGELOG
static/CHANGELOG
+1
-0
No files found.
controllers/publications.py
View file @
2fc47465
...
...
@@ -2,20 +2,17 @@
"""
import
json
import
plugin_dbui
def
read
():
"""Read a publication record identified by its id.
Design to load a record within a basic Ext.formPanel.
Design to load a record within a basic Ext.form
.
Panel.
"""
id
=
request
.
vars
.
id
row
=
db
.
publications
[
id
]
rep
=
dict
(
success
=
True
,
data
=
row
.
as_dict
())
return
json
.
dumps
(
rep
)
return
json
.
dumps
(
dict
(
success
=
True
,
data
=
row
.
as_dict
()))
def
update
():
...
...
@@ -26,10 +23,21 @@ def update():
"""
id
=
request
.
vars
.
id
del
request
.
vars
.
id
table
=
db
.
publications
db
.
publications
[
id
]
=
request
.
vars
rep
=
dict
(
success
=
True
,
msg
=
"Record %s modified"
%
id
)
# update the record
try
:
rep
=
db
(
table
.
id
==
id
).
update
(
**
request
.
vars
)
# operation can be rejected by the database
except
Exception
as
dbe
:
return
json
.
dumps
(
dict
(
success
=
False
,
msg
=
dbe
.
message
))
# operation can be reject by callbacks table._before_update
if
not
rep
:
msg
=
"Reject by a callback"
if
plugin_dbui
.
CALLBACK_ERRORS
in
table
:
return
json
.
dumps
(
dict
(
success
=
False
,
msg
=
table
.
_callback_errors
))
return
json
.
dumps
(
rep
)
\ No newline at end of file
return
json
.
dumps
(
dict
(
success
=
True
,
msg
=
"Record %s modified"
%
id
))
\ No newline at end of file
modules/harvest_tools.py
View file @
2fc47465
...
...
@@ -467,7 +467,6 @@ class Msg(Storage):
class
MsgCollection
(
Storage
):
"""Message for a collection. The class contains five public attributes:
- C{error}: error when scanning the collection
- C{found}: number of publication found in the harvester repository
- C{url}: URL used to scan the harvester repository, returning a list ids.
...
...
@@ -907,12 +906,12 @@ class PublicationsTool(object):
@rtype: dict
@return:
- C
(
cfg_statStore
)
(str) configuration of the statStore JSON encoded
- C
(
cfg_logsStore
)
(str) configuration of the logsStore JSON encoded
- C{collection_logs
)
(list) one L{MsgCollection}) for each collection
- C
{
cfg_statStore
}
(str) configuration of the statStore JSON encoded
- C
{
cfg_logsStore
}
(str) configuration of the logsStore JSON encoded
- C{collection_logs
}
(list) one L{MsgCollection}) for each collection
- C{harvester} (Storage)
- C{logs
)
(list) one L{Msg} for each publication
- C{selector} (Selecor)
- C{logs
}
(list) one L{Msg} for each publication
- C{selector} (Selec
t
or)
"""
...
...
static/CHANGELOG
View file @
2fc47465
...
...
@@ -9,6 +9,7 @@ HEAD
- Redesign the harvester/check_validate views using inline javascript.
- Redesing the harvester/check_validate views returning LaTex document.
- Add the wizard compare_publications.
- Add the possibility to modify a record from the check_validate view.
0.8.5 (May 2014)
- Migrate to plugin_dbui 0.6.1.1 and web2py 2.9.5
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment