This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from inspect import getmembers, ismethod | |
import logging | |
from twisted.application import internet | |
from twisted.web import resource, server | |
from twisted.internet import reactor | |
class Base(object): | |
def __init__(self, manager): | |
self.manager = manager | |
self.log = logging.getLogger("plugin") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet | |
from twisted.web import resource, server | |
class Plugin(Base): | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>" | |
self.log.info(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet | |
from twisted.web import resource, server | |
class Plugin(Base): | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>" | |
self.log.info(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet | |
from twisted.web import resource, server | |
class Plugin(Base): | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>" | |
self.log.info(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet | |
from twisted.web import resource, server | |
class Plugin(Base): | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
line = "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>" | |
self.log.info(line) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet | |
from twisted.web import resource, server | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
return "<html><head><title>Ohai2</title></head><body>Hello, world 2!</body></html>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socbot.pluginbase import Base | |
from twisted.application import internet, service | |
from twisted.web import resource, server | |
class Simple(resource.Resource): | |
isLeaf = True | |
def render_GET(self, request): | |
return "<html>Hello, world!</html>" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Manager(object): | |
def __init__(self): | |
self.funcs = {} | |
def regTrigger(self, func, trig): | |
trig = trig.lower() | |
if not trig in self.funcs: | |
self.funcs[trig] = [] | |
self.funcs[trig].append(func) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
numchars = 41 | |
wait = 0.25 | |
x = "." | |
o = " " | |
def wave(x, o): | |
for num in xrange(1, numchars, 2): | |
time.sleep(wait) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HACK-n-PATCH! Allow dotted syntax access. | |
def monkeypatch1(self, name): | |
if self.has_key(name): | |
return self[name] | |
super(ConfigObj, self).__getattr__(name) | |
ConfigObj.__getattr__ = monkeypatch1 | |
def monkeypatch2(self, name): | |
if self.has_key(name): | |
return self[name] |