diff options
| author | Tom Christie | 2011-01-28 09:14:04 +0000 | 
|---|---|---|
| committer | Tom Christie | 2011-01-28 09:14:04 +0000 | 
| commit | 2e9fd9c6b93a77dcf5caa42a4d71b9da2021693f (patch) | |
| tree | 22f9d6e6e6dba501ee1aadecadf324d39524dad4 | |
| parent | 8e8547ff9a0a77f39f0ec46dcc0772706ff9371f (diff) | |
| download | django-rest-framework-2e9fd9c6b93a77dcf5caa42a4d71b9da2021693f.tar.bz2 | |
Minor fixups on pygments example
| -rw-r--r-- | .hgignore | 3 | ||||
| -rw-r--r-- | examples/initial_data.json | 20 | ||||
| -rw-r--r-- | examples/pygments_api/views.py | 6 | ||||
| -rw-r--r-- | examples/settings.py | 2 | ||||
| -rw-r--r-- | examples/urls.py | 2 | 
5 files changed, 8 insertions, 25 deletions
| @@ -2,9 +2,12 @@ syntax: glob  *.pyc  *.db +*~  env  docs-build  html +examples/media/pygments/* +examples/media/objectstore/*  .project  .pydevproject  .settings diff --git a/examples/initial_data.json b/examples/initial_data.json deleted file mode 100644 index 62103cf9..00000000 --- a/examples/initial_data.json +++ /dev/null @@ -1,20 +0,0 @@ -[ -    { -        "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 diff --git a/examples/pygments_api/views.py b/examples/pygments_api/views.py index 01f1b4b6..02f541f3 100644 --- a/examples/pygments_api/views.py +++ b/examples/pygments_api/views.py @@ -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): diff --git a/examples/settings.py b/examples/settings.py index ea97d192..0ae3bf56 100644 --- a/examples/settings.py +++ b/examples/settings.py @@ -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). diff --git a/examples/urls.py b/examples/urls.py index 5e308f00..b1dec13d 100644 --- a/examples/urls.py +++ b/examples/urls.py @@ -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'), | 
