Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
django-rest-framework
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
django-rest-framework
Commits
2e9fd9c6
Commit
2e9fd9c6
authored
Jan 28, 2011
by
Tom Christie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixups on pygments example
parent
8e8547ff
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
26 deletions
+8
-26
.hgignore
+3
-0
examples/initial_data.json
+0
-21
examples/pygments_api/views.py
+3
-3
examples/settings.py
+1
-1
examples/urls.py
+1
-1
No files found.
.hgignore
View file @
2e9fd9c6
...
...
@@ -2,9 +2,12 @@ syntax: glob
*.pyc
*.db
*~
env
docs-build
html
examples/media/pygments/*
examples/media/objectstore/*
.project
.pydevproject
.settings
...
...
examples/initial_data.json
deleted
100644 → 0
View file @
8e8547ff
[
{
"pk"
:
1
,
"model"
:
"auth.user"
,
"fields"
:
{
"username"
:
"admin"
,
"first_name"
:
""
,
"last_name"
:
""
,
"is_active"
:
true
,
"is_superuser"
:
true
,
"is_staff"
:
true
,
"last_login"
:
"2010-01-01 00:00:00"
,
"groups"
:
[],
"user_permissions"
:
[],
"password"
:
"sha1$6cbce$e4e808893d586a3301ac3c14da6c84855999f1d8"
,
"email"
:
"test@example.com"
,
"date_joined"
:
"2010-01-01 00:00:00"
}
}
]
\ No newline at end of file
examples/pygments_api/views.py
View file @
2e9fd9c6
...
...
@@ -38,15 +38,15 @@ class PygmentsRoot(Resource):
if
not
os
.
path
.
exists
(
pathname
):
# We only need to generate the file if it doesn't already exist.
title
=
content
[
'title'
]
if
content
[
'title'
]
else
None
options
=
{
'title'
:
content
[
'title'
]}
if
content
[
'title'
]
else
{}
linenos
=
'table'
if
content
[
'linenos'
]
else
False
lexer
=
get_lexer_by_name
(
content
[
'lexer'
])
formatter
=
HtmlFormatter
(
style
=
content
[
'style'
],
linenos
=
linenos
,
full
=
True
,
title
=
title
)
formatter
=
HtmlFormatter
(
style
=
content
[
'style'
],
linenos
=
linenos
,
full
=
True
,
**
options
)
with
open
(
pathname
,
'w'
)
as
outfile
:
highlight
(
content
[
'code'
],
lexer
,
formatter
,
outfile
)
return
Response
(
status
.
HTTP_
303_SEE_OTHER
,
headers
=
{
'Location'
:
self
.
reverse
(
PygmentsInstance
,
unique_id
)})
return
Response
(
status
.
HTTP_
201_CREATED
,
headers
=
{
'Location'
:
self
.
reverse
(
PygmentsInstance
,
unique_id
)})
class
PygmentsInstance
(
Resource
):
...
...
examples/settings.py
View file @
2e9fd9c6
...
...
@@ -48,7 +48,7 @@ USE_L10N = True
# Absolute filesystem path to the directory that will hold user-uploaded files.
# Example: "/home/media/media.lawrence.com/"
MEDIA_ROOT
=
'
/Users/tomchristie
/'
MEDIA_ROOT
=
'
media
/'
# URL that handles the media served from MEDIA_ROOT. Make sure to use a
# trailing slash if there is a path component (optional in other cases).
...
...
examples/urls.py
View file @
2e9fd9c6
...
...
@@ -4,7 +4,7 @@ from django.contrib import admin
admin
.
autodiscover
()
urlpatterns
=
patterns
(
''
,
(
r'pygments-example/'
,
include
(
'pygments_api.urls'
)),
(
r'
^
pygments-example/'
,
include
(
'pygments_api.urls'
)),
(
r'^blog-post-example/'
,
include
(
'blogpost.urls'
)),
(
r'^object-store-example/'
,
include
(
'objectstore.urls'
)),
(
r'^accounts/login/$'
,
'django.contrib.auth.views.login'
),
...
...
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