Initial commit. Just a single view that fetches Jobvite XML, parses it and returns some JSON.
This commit is contained in:
Коммит
0433e8d368
|
@ -0,0 +1,2 @@
|
|||
*.pyc
|
||||
*.egg-info
|
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2011, Paul Osman <paul@mozillafoundation.org>.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Mozilla nor the names of its contributors may
|
||||
be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@ -0,0 +1,32 @@
|
|||
==============
|
||||
django-jobvite
|
||||
==============
|
||||
|
||||
django-jobvite is a `Django`_ application that provides a friendly interface to
|
||||
Jobvite.
|
||||
|
||||
.. _Django: http://www.djangoproject.com/
|
||||
|
||||
Not much here right now, just proofing the concept first. Stay tuned.
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
To use ``django_jobvite`` to ``INSTALLED_APPS`` in ``settings.py``: ::
|
||||
|
||||
INSTALLED_APPS = (
|
||||
...
|
||||
'django_jobvite',
|
||||
...
|
||||
)
|
||||
|
||||
Additionally, you'll need to specify the URI to the Jobvite XML file: ::
|
||||
|
||||
JOBVITE_URI = 'http://www.jobvite.com/CompanyJobs/Xml.aspx?c=XXXXX'
|
||||
|
||||
License
|
||||
-------
|
||||
This software is licensed under the [MPL/GPL/LGPL tri-license][MPL]. For more
|
||||
information, read the file ``LICENSE``.
|
||||
|
||||
[MPL]: http://www.mozilla.org/MPL/
|
|
@ -0,0 +1,2 @@
|
|||
VERSION = (0, 1)
|
||||
__version__ = '.'.join(map(str, VERSION))
|
|
@ -0,0 +1,6 @@
|
|||
from django.conf.urls.defaults import patterns, url
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^test/', 'django_jobvite.views.test', name='jobvite_test'),
|
||||
)
|
|
@ -0,0 +1,18 @@
|
|||
import json
|
||||
import urllib
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse, HttpResponseNotFound
|
||||
|
||||
from xml.etree import ElementTree
|
||||
|
||||
|
||||
def test(request):
|
||||
uri = getattr(settings, 'JOBVITE_URI', None)
|
||||
if not uri:
|
||||
return HttpResponseNotFound()
|
||||
xml = urllib.urlopen(uri).read()
|
||||
et = ElementTree.fromstring(xml)
|
||||
jobs = dict([(job.find('id').text, job.find('title').text)
|
||||
for job in et.findall('job')])
|
||||
return HttpResponse(json.dumps(jobs), content_type='application/json')
|
|
@ -0,0 +1,16 @@
|
|||
from setuptools import setup
|
||||
|
||||
import django_jobvite
|
||||
|
||||
|
||||
setup(
|
||||
name='django-jobvite',
|
||||
version=django_jobvite.__version__,
|
||||
description='Simpler, JSON based interface to Jobvite',
|
||||
long_description=open('README.rst').read(),
|
||||
author='Paul Osman',
|
||||
author_email='paul@mozillafoundation.org',
|
||||
url='http://github.com/mozilla/django-jobvite',
|
||||
license='BSD',
|
||||
packages=['django_jobvite'],
|
||||
)
|
Загрузка…
Ссылка в новой задаче