def __init__(self, storage_type=MEM): self.st = RedBarrelStorage.get(storage_type) self.ql = self.st.get_queuelist()
import socket import fcntl import struct import thread import gevent from redbarrel.storage import RedBarrelStorage, REDIS, MEM try: import redis # NOQA storage = REDIS except ImportError: storage = MEM # XXX see if we want this to be in the DSL storage = RedBarrelStorage.get(storage) _BUFFER = storage.get_list('chat') _D = json.dumps _INTERFACE = 'eth0' def add(msg): _BUFFER.append(msg) if len(_BUFFER) > 10: del _BUFFER[0] def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: return socket.inet_ntoa(
import fcntl import struct import thread import gevent from redbarrel.storage import RedBarrelStorage, REDIS, MEM try: import redis # NOQA storage = REDIS except ImportError: storage = MEM # XXX see if we want this to be in the DSL storage = RedBarrelStorage.get(storage) _BUFFER = storage.get_list('chat') _D = json.dumps _INTERFACE = 'eth0' def add(msg): _BUFFER.append(msg) if len(_BUFFER) > 10: del _BUFFER[0] def get_ip_address(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) try: return socket.inet_ntoa(fcntl.ioctl(