close Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Scratchpad

Scratchpad is a simple “nopaste” service that is included with Diva as an example application.

It uses CouchDB (via the CouchDB-Python library) for storage, and Pygments for syntax highlighting.

CouchDB Views

All views are in Javascript.

_design/snippets

by_author

function(doc) {
  if (doc.author) {
    emit([doc.author, doc.time], {
      title: doc.title,
      author: doc.author,
      time: doc.time,
      mimetype: doc.mimetype,
      description: doc.description,
      num_comments: doc.comments ? doc.comments.length : 0
    });
  }
}

by_time

function(doc) {
  emit([doc.time, doc.title], {
    title: doc.title, author: doc.author, time: doc.time,
    mimetype: doc.mimetype, description: doc.description,
    num_comments: doc.comments ? doc.comments.length : 0
  });
}

by_type

function(doc) {
  emit([doc.mimetype, doc.time], {
    title: doc.title, author: doc.author, time: doc.time,
    mimetype: doc.mimetype, description: doc.description,
    num_comments: doc.comments ? doc.comments.length : 0
  })
}
Last modified 16 years ago Last modified on Aug 26, 2008, 3:50:07 PM