Skip to content
Newer
Older
100644 26 lines (20 sloc) 535 Bytes
df02500 @richo initial import
authored Sep 24, 2011
1 import time
2 import os
3
4 ## CONFIG
5
6 # Trailing slash is important.
7 webroot = "http://natalya.psych0tik.net/~pyBawt/"
8 docroot = "/home/pyBawt/public_html"
9
10 class PublicationError(Exception):
11 pass
12
13 def publish(content, prefix="", suffix="txt"):
14 name = ""
15 if prefix:
16 name += prefix + "_"
17 name += "%i.%s" % (time.time(), suffix)
18 try:
19 fh = open(os.path.join(docroot, name), 'w')
20 fh.write(content)
21 fh.close()
22 return webroot + name
23
24 except IOError:
25 raise PublicationError
Something went wrong with that request. Please try again.