Clean up backup files and .pyc files.
authorPuneeth Chaganti <punchagan@fossee.in>
Sun, 30 Jan 2011 12:32:06 +0530
changeset 4 e6e33366df0f
parent 3 de4a2ed2f34b
child 5 c263a26867d4
Clean up backup files and .pyc files.
sphinx_django/__init__.pyc
sphinx_django/db_script.py~
sphinx_django/settings.pyc
sphinx_django/settings.py~
sphinx_django/sphinxcomment/__init__.pyc
sphinx_django/sphinxcomment/admin.pyc
sphinx_django/sphinxcomment/admin.py~
sphinx_django/sphinxcomment/models.pyc
sphinx_django/sphinxcomment/models.py~
sphinx_django/sphinxcomment/views.pyc
sphinx_django/sphinxcomment/views.py~
sphinx_django/templates/comment.html~
sphinx_django/test.db
sphinx_django/urls.pyc
sphinx_django/urls.py~
Binary file sphinx_django/__init__.pyc has changed
--- a/sphinx_django/db_script.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-from sqlalchemy import *
-
-db = create_engine('sqlite:///test.db')
-
-db.echo = False  # Try changing this to True and see what happens
-
-metadata = MetaData(db)
-
-chapter = Table('Chapter', metadata,
-    Column('id', Integer, primary_key=True),
-    Column('name', String(40)),
-)
-chapter.create()
-
-i = users.insert()
-i.execute(name='basic_func')
-
Binary file sphinx_django/settings.pyc has changed
--- a/sphinx_django/settings.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,88 +0,0 @@
-# Django settings for sphinx_django project.
-import os
-
-DEBUG = True
-TEMPLATE_DEBUG = DEBUG
-
-ADMINS = (
-    ('Amit Sethi', 'amit.pureenergy@gmail.com'),
-)
-
-MANAGERS = ADMINS
-
-DATABASE_ENGINE = 'sqlite3'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-DATABASE_NAME = 'test.db'             # Or path to database file if using sqlite3.
-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 = ''
-
-# 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 = ''
-
-# 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 = '21^&3e-nh_hxqkruwj72gtwy^$i6t$#gbn&r36u0tj+ydk&&g8'
-
-# 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 = 'sphinx_django.urls'
-
-
-
-
-TEMPLATE_DIRS = (
-    "/home/amit/review/sphinx_django/templates/"
-    
-    # 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.
-)
-# Path of your sphinx static files 
-SPHINX_PROJECT = 'SPHINX STATIC FILES'
-INSTALLED_APPS = (
-    'django.contrib.admin',
-    'django.contrib.auth',
-    'django.contrib.contenttypes',
-    'django.contrib.sessions',
-    'django.contrib.sites',
-    'sphinx_django.sphinxcomment',
-)
Binary file sphinx_django/sphinxcomment/__init__.pyc has changed
Binary file sphinx_django/sphinxcomment/admin.pyc has changed
--- a/sphinx_django/sphinxcomment/admin.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-from django.contrib import admin
-from sphinx_django.sphinxcomment.models import Comment, Element
-
-class CommentAdmin(admin.ModelAdmin):
-    list_display = ['element', 'submitter_name', 'comment', 'reviewed',
-                    'hidden', 'date']
-    search_fields = ['comment']
-    date_hierarchy = 'date'
-    list_filter = ['date', 'submitter_name']
-    search_fields = ['title', 'submitter_name', 'submitter_url']
-    fieldsets = (
-        (None, {'fields': ('submitter_name', 'element', 'comment')}),
-        ('Review and presentation state', {'fields': ('reviewed', 'hidden')}),
-        ('Other info', {'fields': ('submitter_url', 'ip')}),
-        )
-    # XXX: adding 'date' to the 'Other info' fieldset results in a
-    # ImproperlyConfigured error. :S
-
-class ElementAdmin(admin.ModelAdmin):
-    search_fields = ['id', 'chapter']
-    list_filter = ['chapter', 'title']
-
-admin.site.register(Comment, CommentAdmin)
-admin.site.register(Element, ElementAdmin)
Binary file sphinx_django/sphinxcomment/models.pyc has changed
--- a/sphinx_django/sphinxcomment/models.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-from django.db import models
-
-# Create your models here.
-from django.db import models
-
-
-mutable = True
-
-class Element(models.Model):
-    paragraph_id = models.CharField('Paragraph Id', max_length=100, editable=False, primary_key=True) 
-    chapter_name = models.CharField('Chapter name', max_length=100, editable=False,db_index=True)
-    
-
-    def __unicode__(self):
-        return self.paragraph_id
-    
-class Comment(models.Model):
-    element = models.ForeignKey(Element,
-        help_text='ID of paragraph that was commented on')
-    comment = models.TextField(editable=mutable,
-        help_text='Text of submitted comment (please do not modify)')
-    submitter_name = models.CharField('Submitter', max_length=64,
-        help_text='Self-reported name of submitter (may be bogus)')
-    submitter_url = models.URLField('URL', blank=True, editable=mutable,
-        help_text='Self-reported URL of submitter (may be empty or bogus)')
-    ip = models.IPAddressField('IP address', editable=mutable,
-        help_text='IP address from which comment was submitted')
-    date = models.DateTimeField('date submitted', auto_now=True,
-                                auto_now_add=True)
-
-    def __unicode__(self):
-        return self.comment[:32]
-
-    
Binary file sphinx_django/sphinxcomment/views.pyc has changed
--- a/sphinx_django/sphinxcomment/views.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-# Create your views here.
-from django.http import HttpResponse
-from django.utils.simplejson import dumps 
-from django.contrib.csrf.middleware import csrf_exempt
-import django.forms as forms
-from django.db import connection
-from django.http import HttpResponse,Http404
-from sphinxcomment.models import Comment, Element
-from django.shortcuts import get_object_or_404, render_to_response
-from django.template import Context
-from django.template.loader import get_template
-from django.utils.simplejson import dumps 
-from django.conf import settings
-from os.path import join, splitext
-from BeautifulSoup import BeautifulSoup as bss, Tag
-
-#placeholder_string = open('paragraph_id.py').read()
-#exec placeholder_string
-
-def dump_queries():
-    # requires settings.DEBUG to be set to True in order to work
-    if len(connection.queries) == 1:
-        print connection.queries
-    else:
-        qs = {}
-        for q in connection.queries:
-            qs[q['sql']] = qs.setdefault(q['sql'], 0) + 1
-        for q in sorted(qs.items(), key=lambda x: x[1], reverse=True):
-            print q
-        print len(connection.queries)
-
-class CommentForm(forms.Form):
-    name = forms.CharField(max_length=64)
-    url = forms.URLField(max_length=128, required=False)
-    comment = forms.CharField(widget=forms.Textarea(attrs={
-        'rows': 8, 'cols': 60
-        }))
-    remember = forms.BooleanField(initial=True, required=False)
-
-def comments_by_chapter(chapter):
-     objs = {}
-
-     for c in Comment.objects.filter(element__chapter_name=chapter).order_by('date'):
-         objs.setdefault(c.element.paragraph_id, []).append(c)
-         
-
-             
-     
-     return objs
-
-
-     
-
-
-
-
-# def chapter(request):
-#     template = get_template('comment.html')
-#     resp = {}
-#     for elt, comments in comments_by_chapter(chapter).iteritems():
-#         print elt ,comments
-#         form = CommentForm(initial={
-#             'paragraph_id': elt,
-#             'name': name
-#             })
-#         resp[elt] = template.render(Context({
-#             'paragraph_id': elt,
-#             'form': form,
-#             'length': len(comments),
-#             'query': comments,
-#             }))
-#     return HttpResponse(dumps(resp), mimetype='application/json')
-
-def chapter_count(request,chapter_name):
-    print chapter_name
-    chapter_name=chapter_name.split('.')[0]
-    comment_objs = comments_by_chapter(chapter_name)
-    resp={}
-    temp_dict={}
-    for elt, comments in comment_objs.iteritems():
-        temp_dict[elt]=len(comments)
-
-    resp['count']=temp_dict
-      
-    
-    print resp
-    return HttpResponse(dumps(resp), mimetype='application/json')
-    
-def single(request,paragraph_id, form=None, newid=None):
-    if paragraph_id[-1]=='/':
-        paragraph_id=paragraph_id[:-1]
-    queryset = Comment.objects.filter(element=paragraph_id)
-    print len(queryset)
-    if form is None:
-        form = CommentForm(initial={
-            'paragraph_id': paragraph_id,
-            'name': request.session.get('name', ''),
-            })
-    try:
-        error = form.errors[0]
-    except:
-        error = ''
-    print form.errors
-    return render_to_response('comment.html', {
-        'paragraph_id': paragraph_id,
-        'form': form,
-        'length': len(queryset),
-        'query': queryset,
-        'newid': newid or True,
-        'error': error,
-        })
-
-
-
-
-def submit(request, paragraph_id):
-
-    try:
-        element = get_object_or_404(Element, paragraph_id=paragraph_id)
-    except Http404:
-        #creating chapter name from paragraph_id surely there is a better way using the context but i do not know as yet
-        chapter_id='_'.join(paragraph_id.split('_')[0:-1])
-        chapter_name=chapter_id[-1::-1].replace('_','/',1)[-1::-1]
-        element=Element(chapter_name=chapter_name,paragraph_id=paragraph_id)
-        element.save()
-    print element.chapter_name
-    form = None
-    newid = None
-    
-    if request.method == 'POST':
-        form = CommentForm(request.POST)
-        print form.errors
-        if form.is_valid():
-            print form.cleaned_data
-            data = form.cleaned_data
-            if data.get('remember'):
-                request.session['name'] = data['name']
-                request.session['url'] = data['url']
-            else:
-                request.session.pop('name', None)
-                request.session.pop('url', None)
-            c = Comment(element=element,
-                        comment=data['comment'],
-                        submitter_name=data['name'],
-                        submitter_url=data['url'],
-                        ip=request.META.get('REMOTE_ADDR'))
-            print c
-            c.save()
-           
-            form = None
-    return single(request, paragraph_id, form,)
-
-def test(request):
-    print request
-    string="<p>test comment</p>"
-    return HttpResponse(string,mimetype="text/plain")
-    
-def page(req, path):
-    if splitext(path)[1] == '.html':
-        soup = bss(open(join(settings.SPHINX_PROJECT, path)).read())
-        head = soup.find('head')
-        first_script = Tag(soup, 'script')
-        first_script['src'] = "_static/simplecomment.js"
-        first_script['type'] = "text/javascript"
-        second_script = Tag(soup, 'script')
-        second_script['src'] = "_static/jquery.form.js"
-        second_script['type'] = "text/javascript"
-        head.insert(-1, first_script)
-        head.insert(-1, second_script)
-        counter = 0
-        page_identity = path.split('.')[0].replace('/', '_')
-        for p in soup.findAll('p'):
-            p['id'] = '%s_%s' %(page_identity, counter)
-            counter += 1
-        return HttpResponse(str(soup))
-    else:
-        return HttpResponse(open(join(settings.SPHINX_PROJECT, path)).read())
-    
-#return HttpResponse(dumps(string),mimetype="text/plain")
-#test= csrf_exempt(test)
-
--- a/sphinx_django/templates/comment.html~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-{% ifequal length 1 %}
-  <a class="commenttoggle" id="toggle_{{ id }}"
-      onclick="return toggleComment('{{ id }}')"
-      href="comments: show / hide">One comment</a>
-{% else %}
-  {% if length %}
-    <a class="commenttoggle" id="toggle_{{ id }}"
-      onclick="return toggleComment('{{ id }}')"
-      href="comments: show / hide">{{ length }} comments</a>
-  {% else %}
-    <a class="commenttoggle" id="toggle_{{ id }}"
-      onclick="return toggleComment('{{ id }}')"
-      href="comments: show / hide">No comments</a>
-    <div class="comment" {% if not newid %} style="display: none;" {% endif %}>
-      <div class="comment_body">Be the first to comment on this paragraph!</div>
-    </div>
-  {% endif %}
-{% endifequal %}
-{% for c in query %}
-  <div class="{% ifequal c.id newid %}new_{% endifequal %}comment"
-      {% if not newid %} style="display: none;" {% endif %}
-    id="comment{{ c.id }}">
-    <a name="comment{{ c.id }}"/>
-    <div class="comment_header">
-	<span class="comment_id"><a href="/admin/comments/comment/{{ c.id }}/">{{ c.id }}</a></span>
-      
-    </div>
-    <div class="comment_body">{{ c.comment|escape|linebreaks }}</div>
-  </div>
-{% endfor %}
-<form class="comment" id="form_{{ id }}" action="/comments/submit/{{ id }}/"
-    method="post" >
-  {{ form.id }}
-  <table>
-    <tbody>
-      <tr><td align="right" valign="top">Comment<br></td>
-	  <td>{{ form.comment }}</td></tr>
-      <tr><td align="right">Your name</td><td>{{ form.name }}
-	    <span class="comment_help"><b>Required</b> so we can give you credit</a></span></td></tr>
-      <tr><td align="right">Your URL</td><td>{{ form.url }}
-	    <span class="comment_help"><b>Optional</b> link to blog, home page,
-	      <i>etc</i>.</span></td></tr>
-      <tr><td align="right">Remember you?</td><td>{{ form.remember }}</td></tr>
-      <tr><td/><td><input name="submit" type="submit"
-	      value="Submit Comment"/><span class="comment_error">{{ error }}</span></td></tr>
-    </tbody>
-  </table>
-</form>
Binary file sphinx_django/test.db has changed
Binary file sphinx_django/urls.pyc has changed
--- a/sphinx_django/urls.py~	Wed Oct 27 13:59:11 2010 +0530
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,29 +0,0 @@
-from django.conf.urls.defaults import *
-from django.contrib import admin
-# Uncomment the next two lines to enable the admin:
-# from django.contrib import admin
-admin.autodiscover()
-
-urlpatterns = patterns('',
-    # Example:
-    # (r'^sphinx_django/', include('sphinx_django.foo.urls')),
-
-    (r'^test/','sphinxcomment.views.test' ),
-    (r'chapter/', 'sphinxcomment.views.chapter'),
-    (r'count/(?P<chapter_name>.+)?$', 'sphinxcomment.views.chapter_count'),                  
-    (r'single/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.single'),
-    (r'submit/(?P<paragraph_id>[^/]+)/$', 'sphinxcomment.views.submit'),
-    (r'^static/(?P<path>.*)$', 'django.views.static.serve',
-     {'document_root': '/home/amit/review/st-scripts/_build/commenthtml'}),
-                       
-    # 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'^pages/_static/(?P<path>.*)$', 'django.views.static.serve',
-     {'document_root': '/home/amit/review/st-scripts/_build/commenthtml/_static'}),
-                    
-     (r'^pages/(?P<path>.*)$', 'sphinxcomment.views.page'),
-)