-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Tim Julien
committed
Mar 3, 2010
1 parent
a1a9527
commit 39dfe3f
Showing
10 changed files
with
253 additions
and
6 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# substitute your own values and rename to local_settings.py | ||
|
||
SPREADSHEET_CLIENT = # 'limewire-ss2sd-0.1' | ||
USERNAME = '' | ||
PASSWORD = '' | ||
SPREADSHEET_URL = ''# 'http://spreadsheets.google.com/ccc?key=0AtIpI26ufpzXdDJBbXdxQkpCYk8xQjJqZGtoNDZaMHc' | ||
WORKSHEET_NAME = '' # 'Stories and services' | ||
JIRA_PREFIX = '' # 'https://www.limewire.org/jira/browse/' | ||
HOST = '' # 'http://10.254.193.77:8000/assets/' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/python | ||
from django.core.management import execute_manager | ||
try: | ||
import settings # Assumed to be in the same directory. | ||
except ImportError: | ||
import sys | ||
sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) | ||
sys.exit(1) | ||
|
||
if __name__ == "__main__": | ||
execute_manager(settings) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import os | ||
# Django settings for spreadsheet2seqdiagram project. | ||
|
||
PROJECT_ROOT = os.path.realpath(os.path.dirname(__file__)) | ||
|
||
DEBUG = True | ||
TEMPLATE_DEBUG = DEBUG | ||
|
||
ADMINS = ( | ||
# ('Your Name', '[email protected]'), | ||
) | ||
|
||
MANAGERS = ADMINS | ||
|
||
DATABASE_ENGINE = 'sqlite3' | ||
DATABASE_NAME = 'dev.db' | ||
DATABASE_USER = '' # Not used with sqlite3. | ||
DATABASE_PASSWORD = '' # Not used with sqlite3. | ||
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. | ||
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. | ||
|
||
# Local time zone for this installation. Choices can be found here: | ||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name | ||
# although not all choices may be available on all operating systems. | ||
# If running in a Windows environment this must be set to the same as your | ||
# system time zone. | ||
TIME_ZONE = 'America/Chicago' | ||
|
||
# Language code for this installation. All choices can be found here: | ||
# http://www.i18nguy.com/unicode/language-identifiers.html | ||
LANGUAGE_CODE = 'en-us' | ||
|
||
SITE_ID = 1 | ||
|
||
# If you set this to False, Django will make some optimizations so as not | ||
# to load the internationalization machinery. | ||
USE_I18N = True | ||
|
||
# Absolute path to the directory that holds media. | ||
# Example: "/home/media/media.lawrence.com/" | ||
MEDIA_ROOT = os.path.join(PROJECT_ROOT, "assets") | ||
|
||
# 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: "http://media.lawrence.com", "http://example.com/media/" | ||
MEDIA_URL = '/assets/' | ||
|
||
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a | ||
# trailing slash. | ||
# Examples: "http://foo.com/media/", "/media/". | ||
ADMIN_MEDIA_PREFIX = '/media/' | ||
|
||
# Make this unique, and don't share it with anybody. | ||
SECRET_KEY = '&80_ljwhfrst#c=o8ksl8w^e%$8n7hf%%_4-2uj5kp8mu#w=(8' | ||
|
||
# List of callables that know how to import templates from various sources. | ||
TEMPLATE_LOADERS = ( | ||
'django.template.loaders.filesystem.load_template_source', | ||
'django.template.loaders.app_directories.load_template_source', | ||
# 'django.template.loaders.eggs.load_template_source', | ||
) | ||
|
||
MIDDLEWARE_CLASSES = ( | ||
'django.middleware.common.CommonMiddleware', | ||
'django.contrib.sessions.middleware.SessionMiddleware', | ||
'django.contrib.auth.middleware.AuthenticationMiddleware', | ||
) | ||
|
||
ROOT_URLCONF = 'spreadsheet2seqdiagram.urls' | ||
|
||
TEMPLATE_DIRS = ( | ||
# Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". | ||
# Always use forward slashes, even on Windows. | ||
# Don't forget to use absolute paths, not relative paths. | ||
os.path.join(PROJECT_ROOT, 'templates') | ||
) | ||
|
||
INSTALLED_APPS = ( | ||
'django.contrib.auth', | ||
'django.contrib.contenttypes', | ||
'django.contrib.sessions', | ||
'django.contrib.sites', | ||
'django.contrib.admin', | ||
#'django.contrib.admindocs', | ||
|
||
'spreadsheet2seqdiagram.ss2sd' | ||
) | ||
|
||
try: | ||
from local_settings import * | ||
except ImportError: | ||
pass |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
""" | ||
This file demonstrates two different styles of tests (one doctest and one | ||
unittest). These will both pass when you run "manage.py test". | ||
Replace these with more appropriate tests for your application. | ||
""" | ||
|
||
from django.test import TestCase | ||
|
||
class SimpleTest(TestCase): | ||
def test_basic_addition(self): | ||
""" | ||
Tests that 1 + 1 always equals 2. | ||
""" | ||
self.failUnlessEqual(1 + 1, 2) | ||
|
||
__test__ = {"doctest": """ | ||
Another way to test that 1 + 1 is equal to 2. | ||
>>> 1 + 1 == 2 | ||
True | ||
"""} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import os | ||
from django.template import Context, loader | ||
from django.http import HttpRequest, HttpResponse | ||
from django.conf import settings | ||
|
||
from ss2sd.forms import * | ||
|
||
from ss2sd.sd import * | ||
from settings import MEDIA_ROOT | ||
|
||
def ss2sd_form(request): | ||
if request.method == 'POST': | ||
start = request.POST['start'] | ||
end = request.POST['end'] | ||
filename = os.path.join(MEDIA_ROOT, start + '-' + end + '-' + 'outfile.png') | ||
if os.path.exists(filename): | ||
os.remove(filename) | ||
jiras, story = create_seq_diag(settings.SPREADSHEET_URL, start, end, filename) | ||
c = Context({'start' : start, | ||
'end' : end, | ||
'mimetype' : 'text/html', | ||
'jiras' : get_jiras(jiras), | ||
'story' : story, | ||
'host' : settings.HOST}) | ||
return HttpResponse(loader.get_template('ss2sd/generated_seq_diag.html').render(c), mimetype='text/html') | ||
else: | ||
form = RowInputForm() | ||
c = Context({}) | ||
return HttpResponse(loader.get_template('ss2sd/row_form.html').render(c), mimetype='text/html') | ||
|
||
def browse_next(request): | ||
previous = request.POST['previous_end'] | ||
start, end = get_next_seq(settings.SPREADSHEET_URL, previous) | ||
request = HttpRequest() | ||
request.method = 'POST' | ||
request.POST['start'] = str(start) | ||
request.POST['end'] = str(end) | ||
print start | ||
print end | ||
return ss2sd_form(request) | ||
|
||
def get_jiras(ids): | ||
jira_ids = ids.split(',') | ||
jiras = [] | ||
for id in jira_ids: | ||
jiras.append(settings.JIRA_PREFIX + id.strip()) | ||
return jiras |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django.conf.urls.defaults import * | ||
import os | ||
|
||
# Uncomment the next two lines to enable the admin: | ||
from django.contrib import admin | ||
admin.autodiscover() | ||
|
||
urlpatterns = patterns('', | ||
# Example: | ||
# (r'^spreadsheet2seqdiagram/', include('spreadsheet2seqdiagram.foo.urls')), | ||
|
||
# Uncomment the admin/doc line below and add 'django.contrib.admindocs' | ||
# to INSTALLED_APPS to enable admin documentation: | ||
#(r'^admin/doc/', include('django.contrib.admindocs.urls')), | ||
|
||
# Uncomment the next line to enable the admin: | ||
(r'^admin/', include(admin.site.urls)), | ||
(r'^ss2sd/browse_next', 'spreadsheet2seqdiagram.ss2sd.views.browse_next'), | ||
(r'^ss2sd/', 'spreadsheet2seqdiagram.ss2sd.views.ss2sd_form'), | ||
(r'^assets/(?P<path>.*)$', 'django.views.static.serve', {'document_root': os.path.join(os.path.dirname(__file__), 'assets')}), | ||
) |