Skip to content

Instantly share code, notes, and snippets.

from bottle import Bottle, template, request, run
app = Bottle()
@app.route('/hello/')
def greet():
return template('''
<html>
<body>
Please introduce yourself:
# crochet allows non-twisted apps to call twisted code
import crochet
crochet.no_setup()
from twisted.application import internet, service
from twisted.web import server, wsgi, static, resource
from twisted.internet import reactor
from twisted.python import threadpool
# boilerplate to get any WSGI app running under twisted
import crochet
crochet.setup()
from twisted.web import resource, server
import random
from datetime import datetime
import json
def _format_sse(msg, event=None):
<html>
<head>
<script type="text/javascript">
var evtSource = new EventSource("/sse");
evtSource.onmessage = function(e) {
// onmessage is the generic handler
var eventList = document.getElementById("eventlist");
var newElement = document.createElement("li");
newElement.innerHTML = "message: " + e.data;
def test():
pass
print 'edited from home'
url = http://www.example.com/trunk/projects/1234-Project/Production
fetch = trunk:refs/remotes/trunk
branches = branches/*:refs/remotes/*
tags = tags/*:refs/remotes/tags/*
[svn-remote "svn"]
url = http://www.example.com/trunk/projects/1234-project/Production
fetch = trunk:refs/remotes/trunk
branches = trunk/projects/1234-project/Production/branches/*:refs/remotes/*
tags = trunk/projects/1234-project/Production/tags/*:refs/remotes/tags/*
SERVER = "localhost"
FROM = "sender@example.com"
TO = ["user@example.com"] # must be a list
SUBJECT = "Hello!"
TEXT = "This message was sent with Python's smtplib."
message = """\
/usr/local/bin/pip run on Fri Oct 2 16:22:14 2009
Exception:
Traceback (most recent call last):
File "/Library/Python/2.5/site-packages/pip-0.4-py2.5.egg/pip.py", line 274, in main
self.run(options, args)
File "/Library/Python/2.5/site-packages/pip-0.4-py2.5.egg/pip.py", line 431, in run
requirement_set.install_files(finder, force_root_egg_info=self.bundle)
File "/Library/Python/2.5/site-packages/pip-0.4-py2.5.egg/pip.py", line 1784, in install_files
if req_to_install.check_if_exists():
File "/Library/Python/2.5/site-packages/pip-0.4-py2.5.egg/pip.py", line 1641, in check_if_exists
from twisted.web.resource import Resource
from twisted.web.static import File
from twisted.web.proxy import ReverseProxyResource
from twisted.web.server import Site
from twisted.internet import reactor
from imageserver import ModuleImage
from settings import settings