Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9c5969c7a9
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 47 lines (33 sloc) 1.076 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
"""
Web frontend to gitmarks for use as a bookmarklet.
"""

import bottle
bottle.debug(False)

from bottle import route, run, request, response, template
from gitmark import gitMark
import settings

@route("/")
def index():
    return template("index", port = settings.GITMARKS_WEB_PORT)

@route("/new")
def new():
    url = request.GET.get('url')

    return template("new", url=url, tags=None, message=None, error=None)

@route("/create", method = "POST")
def create():
    url = request.forms.get('url', '').strip()
    tags = request.forms.get('tags', '').strip()
    message = request.forms.get('message', '').strip()
    push = request.forms.get('nopush', True)

    if push == '1':
        push = False

    if not url:
        return template("new", url=url, tags=tags, message=message, error="URL is required.")

    options = {}
    options['tags'] = tags
    options['push'] = push
    options['msg'] = message

    args = [url]

    g = gitMark(options, args)

    return template("create")

run(host="localhost", port=settings.GITMARKS_WEB_PORT, reloader=False)
Something went wrong with that request. Please try again.