Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GraceDB Server
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michael William Coughlin
GraceDB Server
Commits
c36766dc
Commit
c36766dc
authored
12 years ago
by
Brian Moe
Browse files
Options
Downloads
Patches
Plain Diff
Misc changes
parent
e5570441
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gracedb/api.py
+38
-5
38 additions, 5 deletions
gracedb/api.py
gracedb/urls_rest.py
+11
-6
11 additions, 6 deletions
gracedb/urls_rest.py
settings/default.py
+18
-0
18 additions, 0 deletions
settings/default.py
with
67 additions
and
11 deletions
gracedb/api.py
+
38
−
5
View file @
c36766dc
...
...
@@ -6,14 +6,47 @@ import simplejson
from
gracedb.models
import
Event
from
piston.handler
import
BaseHandler
import
os
class
EventHandler
(
BaseHandler
):
model
=
Event
allowed_methods
=
(
'
GET
'
,)
##################################################################
# Piston
##################################################################
# rest_framework
from
rest_framework
import
generics
,
serializers
class
EventSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
Event
class
EventList
(
generics
.
ListCreateAPIView
):
model
=
Event
serializer_class
=
EventSerializer
class
EventDetail
(
generics
.
RetrieveUpdateDestroyAPIView
):
model
=
Event
serializer_class
=
EventSerializer
def
api_root
(
request
):
"""
the api root
"""
return
HttpResponse
(
"""
<html>
<head>
</head>
<body>
O Hai. %s<br/>%s
</body>
</html>
"""
%
(
reverse
(
'
event-list
'
),
reverse
(
'
event-detail
'
,
args
=
[
12
]),
))
#""" % reverse('download', kwargs={"graceid":"G12", "filename":"FLED_THE_FILER"}))
#""" % reverse(download, args=["G12", "FRED_THE_FILE"]))
##################################################################
# Old. Must support this.
def
download
(
request
,
graceid
,
filename
=
""
):
# Do not filename to be None. That messes up later os.path.join
filename
=
filename
or
""
...
...
This diff is collapsed.
Click to expand it.
gracedb/urls_rest.py
+
11
−
6
View file @
c36766dc
from
django.conf.urls.defaults
import
*
from
django.conf.urls.defaults
import
patterns
,
url
from
piston.resource
import
Resource
from
gracedb.api
import
EventHandler
eventHandler
=
Resource
(
EventHandler
)
# rest_framework
from
gracedb.api
import
EventList
,
EventDetail
urlpatterns
=
patterns
(
'
gracedb.api
'
,
url
(
r
'
^events/[A-Z]?(?P<id>[\w\d]+)$
'
,
eventHandler
,
name
=
"
api_event
"
),
url
(
r
'
^$
'
,
'
api_root
'
),
# Piston
# rest_framework
url
(
r
'
^revents/$
'
,
EventList
.
as_view
(),
name
=
'
event-list
'
),
url
(
r
'
^revents/[GEHT](?P<pk>\d+)$
'
,
EventDetail
.
as_view
(),
name
=
'
event-detail
'
),
# Legacy
url
(
r
'
^events/(?P<graceid>[\w\d]+)/files/(?P<filename>.+)?$
'
,
'
download
'
,
name
=
"
download
"
),
url
(
r
'
^event/(?P<graceid>[\w\d]+)/files/(?P<filename>.+)?$
'
,
'
download
'
,
name
=
"
download2
"
),
)
This diff is collapsed.
Click to expand it.
settings/default.py
+
18
−
0
View file @
c36766dc
...
...
@@ -152,6 +152,7 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"
django.core.context_processors.debug
"
,
"
django.core.context_processors.i18n
"
,
"
django.core.context_processors.media
"
,
"
django.core.context_processors.static
"
,
"
django.core.context_processors.request
"
,
"
gracedb.middleware.auth.LigoAuthContext
"
,
'
middleware.debug.LigoDebugContext
'
,
...
...
@@ -183,6 +184,23 @@ INSTALLED_APPS = (
'
django.contrib.contenttypes
'
,
'
django.contrib.sessions
'
,
'
django.contrib.sites
'
,
'
django.contrib.staticfiles
'
,
'
gracedb
'
,
'
userprofile
'
,
'
rest_framework
'
,
)
REST_FRAMEWORK
=
{
'
PAGINATE_BY
'
:
10
}
STATIC_URL
=
"
/gracedb-static/
"
STATICFILES_FINDERS
=
(
'
django.contrib.staticfiles.finders.FileSystemFinder
'
,
'
django.contrib.staticfiles.finders.AppDirectoriesFinder
'
,
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
STATICFILES_DIRS
=
()
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