Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
configdb
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
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
ai
configdb
Commits
c30cc8bc
Commit
c30cc8bc
authored
12 years ago
by
joe
Browse files
Options
Downloads
Patches
Plain Diff
Added the methods to get the timestamp as well.
parent
59246837
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
configdb/db/db_api.py
+18
-0
18 additions, 0 deletions
configdb/db/db_api.py
configdb/server/wsgiapp.py
+8
-0
8 additions, 0 deletions
configdb/server/wsgiapp.py
with
26 additions
and
0 deletions
configdb/db/db_api.py
+
18
−
0
View file @
c30cc8bc
...
...
@@ -241,3 +241,21 @@ class AdmDbApi(object):
self
.
schema
.
acl_check_entity
(
ent
,
auth_context
,
'
r
'
,
None
)
return
self
.
db
.
get_audit
(
query
,
session
)
@with_session
def
get_timestamp
(
self
,
session
,
entity_name
,
auth_context
):
"""
Get the timestamp of the last update on an entity.
"""
ent
=
self
.
schema
.
get_entity
(
entity_name
)
if
not
ent
:
raise
exceptions
.
NotFound
(
entity_name
)
self
.
schema
.
acl_check_entity
(
ent
,
auth_context
,
'
r
'
,
None
)
obj
=
self
.
db
.
get_by_name
(
'
__timestamp
'
,
entity_name
,
session
)
if
not
obj
:
raise
exceptions
.
NotFound
(
entity_name
)
return
obj
This diff is collapsed.
Click to expand it.
configdb/server/wsgiapp.py
+
8
−
0
View file @
c30cc8bc
...
...
@@ -156,6 +156,14 @@ def find(class_name):
def
delete
(
class_name
,
object_name
):
return
g
.
api
.
delete
(
class_name
,
object_name
,
g
.
auth_ctx
)
@api_app.route
(
'
/timestamp/<class_name>
'
)
@authenticate
def
ts
(
class_name
):
try
:
res
=
g
.
api
.
get_timestamp
(
class_name
,
g
.
auth_ctx
)
return
str
(
res
.
ts
)
except
exceptions
.
NotFound
:
return
"
0
"
@api_app.route
(
'
/audit
'
,
methods
=
[
'
POST
'
])
@authenticate
...
...
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