My favorites | Sign in
Project Home
Checkout   Browse   Changes    
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
import BeautifulSoup
import base64
import chardet
import codecs
import collections
import copy
import csv
import datetime
import dateutil
import encodings
import feedparser
import getopt
import glob
import gzip
import htmlentitydefs
import itertools
import new
import mailbox
import md5
import mimetypes
import operator
import os
import pytz
import quopri
import random
import re
import sets
import simplejson
import simplejson as json
import socket
import string
import StringIO
import sys
import textwrap
import time
import unescape
import unicodedata
import urllib
import urllib2
import urlparse
import xml
import zlib
from BeautifulSoup import BeautifulSoup as soup
from html2text import html2text
from os import path
from xml.dom import minidom

from google.appengine import api

import base

def get(uri):
return urllib.urlopen(uri).read()

def text(html):
return html2text(html).encode("utf8")

def run(uri):
exec(get(uri))

def load(uri):
load.module = new.module("module")
exec get(uri) in load.module.__dict__
return load.module

class Main(base.RequestHandler):

def get(self, *args):
command = args[1] or ""
command = urllib.unquote(command)
output = StringIO.StringIO()
sys.stdout = output
sys.stderr = output
try:
try:
output.write(str(eval(command)))
except SyntaxError:
exec(command)
output.seek(0)
self.ok(output.readline())
except Exception, error:
if str(error):
return self.ok("%s: %s" % (type(error).__name__, str(error)))
else:
return self.ok(type(error).__name__)

Change log

r162 by nsla...@tumbolia.org on Aug 31, 2009   Diff
upgradez
Go to: 
Project members, sign in to write a code review

Older revisions

r145 by nsla...@tumbolia.org on May 14, 2009   Diff
sbp is lazy
r144 by nsla...@tumbolia.org on May 13, 2009   Diff
added text() convienience function
r143 by nsla...@tumbolia.org on May 13, 2009   Diff
fixed stupid bug
All revisions of this file

File info

Size: 1707 bytes, 85 lines
Powered by Google Project Hosting