Commits

Benoit Chesneau  committed ee1a1f6

some fixes

  • Participants
  • Parent commits e51443b

Comments (0)

Files changed (4)

File friendpaste/models.py

         return unidiff, tabular, previous
         
     def with_revisions(cls, db, pasteid, revid):
-        rows = cls.view(db, '_view/paste/with_revisions', startkey=[pasteid,0])
+        rows = cls.view(db, '_view/paste/with_revisions', startkey=[pasteid,0], endkey=[pasteid, 1])
         print rows
         results = list(iter(rows))
         print results

File friendpaste/views.py

 def view_revisions(request, id):
     snippet, revisions = Paste.with_revisions(local.db, id, request.values.get('rev'))
      
+    revisions = [snippet] + revisions
     if 'application/json' in request.accept_mimetypes:
         if revisions and revisions is not None:      
             return send_json([rev._data for rev in revisions])

File templates/paste/diff.html

 </div>
 <br />
 <div>
-    <form action="/{{ snippet['_id'] }}" method="get">
+    <form action="/{{ snippet.pasteid }}" method="get">
         <input type="submit" value="Back to the paste..." />
     </form>
 </div>

File templates/paste/view.html

 </form>
 
 <div id="revisions" class="hidden">
-    <h2><a href="/{{ snippet.pasteid }}" class="root">{{ snippet.paseid }}</a>&nbsp;/&nbsp;{% if snippet.title %}{{ snippet.title }}{% else %}No title{% endif %}</h2>
+    <h2><a href="/{{ snippet.pasteid }}" class="root">{{ snippet.pasteid }}</a>&nbsp;/&nbsp;{% if snippet.title %}{{ snippet.title }}{% else %}No title{% endif %}</h2>
     <p>last change {{ snippet.updated|datetimeformat }} (UTC)</p>
     <h3>Older revisions</h3>
     <table class="revisionstable">