Remove commented out print statements.
This commit is contained in:
parent
402cbed8fa
commit
bc340fbf0d
35 changed files with 0 additions and 103 deletions
|
|
@ -296,7 +296,6 @@ def get_and_merge_cmdsets(caller, session, player, obj,
|
||||||
tempmergers = {}
|
tempmergers = {}
|
||||||
for cmdset in cmdsets:
|
for cmdset in cmdsets:
|
||||||
prio = cmdset.priority
|
prio = cmdset.priority
|
||||||
#print cmdset.key, prio
|
|
||||||
if prio in tempmergers:
|
if prio in tempmergers:
|
||||||
# merge same-prio cmdset together separately
|
# merge same-prio cmdset together separately
|
||||||
tempmergers[prio] = yield cmdset + tempmergers[prio]
|
tempmergers[prio] = yield cmdset + tempmergers[prio]
|
||||||
|
|
@ -309,8 +308,6 @@ def get_and_merge_cmdsets(caller, session, player, obj,
|
||||||
# Merge all command sets into one, beginning with the lowest-prio one
|
# Merge all command sets into one, beginning with the lowest-prio one
|
||||||
cmdset = cmdsets[0]
|
cmdset = cmdsets[0]
|
||||||
for merging_cmdset in cmdsets[1:]:
|
for merging_cmdset in cmdsets[1:]:
|
||||||
#print "<%s(%s,%s)> onto <%s(%s,%s)>" % (merging_cmdset.key, merging_cmdset.priority, merging_cmdset.mergetype,
|
|
||||||
# cmdset.key, cmdset.priority, cmdset.mergetype)
|
|
||||||
cmdset = yield merging_cmdset + cmdset
|
cmdset = yield merging_cmdset + cmdset
|
||||||
# store the full sets for diagnosis
|
# store the full sets for diagnosis
|
||||||
cmdset.merged_from = cmdsets
|
cmdset.merged_from = cmdsets
|
||||||
|
|
@ -321,7 +318,6 @@ def get_and_merge_cmdsets(caller, session, player, obj,
|
||||||
|
|
||||||
for cset in (cset for cset in local_obj_cmdsets if cset):
|
for cset in (cset for cset in local_obj_cmdsets if cset):
|
||||||
cset.duplicates = cset.old_duplicates
|
cset.duplicates = cset.old_duplicates
|
||||||
#print "merged set:", cmdset.key
|
|
||||||
returnValue(cmdset)
|
returnValue(cmdset)
|
||||||
except ErrorReported:
|
except ErrorReported:
|
||||||
raise
|
raise
|
||||||
|
|
|
||||||
|
|
@ -490,7 +490,6 @@ class CmdSet(object):
|
||||||
commands.append(cmd)
|
commands.append(cmd)
|
||||||
# extra run to make sure to avoid doublets
|
# extra run to make sure to avoid doublets
|
||||||
self.commands = list(set(commands))
|
self.commands = list(set(commands))
|
||||||
#print "In cmdset.add(cmd):", self.key, cmd
|
|
||||||
# add system_command to separate list as well,
|
# add system_command to separate list as well,
|
||||||
# for quick look-up
|
# for quick look-up
|
||||||
if cmd.key.startswith("__"):
|
if cmd.key.startswith("__"):
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,6 @@ def import_cmdset(path, cmdsetobj, emit_to_obj=None, no_logging=False):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# first try to get from cache
|
# first try to get from cache
|
||||||
#print "importing %s: _CACHED_CMDSETS=%s" % (python_path, _CACHED_CMDSETS)
|
|
||||||
cmdsetclass = _CACHED_CMDSETS.get(python_path, None)
|
cmdsetclass = _CACHED_CMDSETS.get(python_path, None)
|
||||||
|
|
||||||
if not cmdsetclass:
|
if not cmdsetclass:
|
||||||
|
|
@ -243,7 +242,6 @@ class CmdSetHandler(object):
|
||||||
mergelist = []
|
mergelist = []
|
||||||
if len(self.cmdset_stack) > 1:
|
if len(self.cmdset_stack) > 1:
|
||||||
# We have more than one cmdset in stack; list them all
|
# We have more than one cmdset in stack; list them all
|
||||||
#print self.cmdset_stack, self.mergetype_stack
|
|
||||||
for snum, cmdset in enumerate(self.cmdset_stack):
|
for snum, cmdset in enumerate(self.cmdset_stack):
|
||||||
mergetype = self.mergetype_stack[snum]
|
mergetype = self.mergetype_stack[snum]
|
||||||
permstring = "non-perm"
|
permstring = "non-perm"
|
||||||
|
|
@ -310,7 +308,6 @@ class CmdSetHandler(object):
|
||||||
if init_mode:
|
if init_mode:
|
||||||
# reimport all permanent cmdsets
|
# reimport all permanent cmdsets
|
||||||
storage = self.obj.cmdset_storage
|
storage = self.obj.cmdset_storage
|
||||||
#print "cmdset_storage:", self.obj.cmdset_storage
|
|
||||||
if storage:
|
if storage:
|
||||||
self.cmdset_stack = []
|
self.cmdset_stack = []
|
||||||
for pos, path in enumerate(storage):
|
for pos, path in enumerate(storage):
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ class CmdBan(MuxCommand):
|
||||||
# replace * with regex form and compile it
|
# replace * with regex form and compile it
|
||||||
ipregex = ban.replace('.', '\.')
|
ipregex = ban.replace('.', '\.')
|
||||||
ipregex = ipregex.replace('*', '[0-9]{1,3}')
|
ipregex = ipregex.replace('*', '[0-9]{1,3}')
|
||||||
#print "regex:",ipregex
|
|
||||||
ipregex = re.compile(r"%s" % ipregex)
|
ipregex = re.compile(r"%s" % ipregex)
|
||||||
bantup = ("", ban, ipregex, now, reason)
|
bantup = ("", ban, ipregex, now, reason)
|
||||||
# save updated banlist
|
# save updated banlist
|
||||||
|
|
|
||||||
|
|
@ -2416,7 +2416,6 @@ class CmdTag(MuxCommand):
|
||||||
category = None
|
category = None
|
||||||
if ":" in tag:
|
if ":" in tag:
|
||||||
tag, category = [part.strip() for part in tag.split(":", 1)]
|
tag, category = [part.strip() for part in tag.split(":", 1)]
|
||||||
#print "tag search:", tag, search_category
|
|
||||||
objs = search.search_tag(tag, category=category)
|
objs = search.search_tag(tag, category=category)
|
||||||
nobjs = len(objs)
|
nobjs = len(objs)
|
||||||
if nobjs > 0:
|
if nobjs > 0:
|
||||||
|
|
|
||||||
|
|
@ -267,13 +267,11 @@ class CmdChannels(MuxPlayerCommand):
|
||||||
# all channels we have available to listen to
|
# all channels we have available to listen to
|
||||||
channels = [chan for chan in ChannelDB.objects.get_all_channels()
|
channels = [chan for chan in ChannelDB.objects.get_all_channels()
|
||||||
if chan.access(caller, 'listen')]
|
if chan.access(caller, 'listen')]
|
||||||
#print channels
|
|
||||||
if not channels:
|
if not channels:
|
||||||
self.msg("No channels available.")
|
self.msg("No channels available.")
|
||||||
return
|
return
|
||||||
# all channel we are already subscribed to
|
# all channel we are already subscribed to
|
||||||
subs = ChannelDB.objects.get_subscriptions(caller)
|
subs = ChannelDB.objects.get_subscriptions(caller)
|
||||||
#print subs
|
|
||||||
|
|
||||||
if self.cmdstring == "comlist":
|
if self.cmdstring == "comlist":
|
||||||
# just display the subscribed channels with no extra info
|
# just display the subscribed channels with no extra info
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,6 @@ class CmdGet(MuxCommand):
|
||||||
if not self.args:
|
if not self.args:
|
||||||
caller.msg("Get what?")
|
caller.msg("Get what?")
|
||||||
return
|
return
|
||||||
#print "general/get:", caller, caller.location, self.args, caller.location.contents
|
|
||||||
obj = caller.search(self.args, location=caller.location)
|
obj = caller.search(self.args, location=caller.location)
|
||||||
if not obj:
|
if not obj:
|
||||||
return
|
return
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,6 @@ class MuxCommand(Command):
|
||||||
switches = []
|
switches = []
|
||||||
if args and len(args) > 1 and args[0] == "/":
|
if args and len(args) > 1 and args[0] == "/":
|
||||||
# we have a switch, or a set of switches. These end with a space.
|
# we have a switch, or a set of switches. These end with a space.
|
||||||
#print "'%s'" % args
|
|
||||||
switches = args[1:].split(None, 1)
|
switches = args[1:].split(None, 1)
|
||||||
if len(switches) > 1:
|
if len(switches) > 1:
|
||||||
switches, args = switches
|
switches, args = switches
|
||||||
|
|
|
||||||
|
|
@ -592,7 +592,6 @@ class CmdColorTest(MuxPlayerCommand):
|
||||||
string = "ANSI colors:"
|
string = "ANSI colors:"
|
||||||
for row in table:
|
for row in table:
|
||||||
string += "\n " + " ".join(row)
|
string += "\n " + " ".join(row)
|
||||||
#print string
|
|
||||||
self.msg(string)
|
self.msg(string)
|
||||||
self.msg("{{X : black. {{/ : return, {{- : tab, {{_ : space, {{* : invert, {{u : underline")
|
self.msg("{{X : black. {{/ : return, {{- : tab, {{_ : space, {{* : invert, {{u : underline")
|
||||||
self.msg("To combine background and foreground, add background marker last, e.g. {{r{{[b.")
|
self.msg("To combine background and foreground, add background marker last, e.g. {{r{{[b.")
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,6 @@ class CmdOOCLook(default_cmds.CmdLook):
|
||||||
self.character = None
|
self.character = None
|
||||||
if utils.inherits_from(self.caller, "evennia.objects.objects.Object"):
|
if utils.inherits_from(self.caller, "evennia.objects.objects.Object"):
|
||||||
# An object of some type is calling. Convert to player.
|
# An object of some type is calling. Convert to player.
|
||||||
#print self.caller, self.caller.__class__
|
|
||||||
self.character = self.caller
|
self.character = self.caller
|
||||||
if hasattr(self.caller, "player"):
|
if hasattr(self.caller, "player"):
|
||||||
self.caller = self.caller.player
|
self.caller = self.caller.player
|
||||||
|
|
@ -151,7 +150,6 @@ class CmdOOCCharacterCreate(Command):
|
||||||
self.character = None
|
self.character = None
|
||||||
if utils.inherits_from(self.caller, "evennia.objects.objects.Object"):
|
if utils.inherits_from(self.caller, "evennia.objects.objects.Object"):
|
||||||
# An object of some type is calling. Convert to player.
|
# An object of some type is calling. Convert to player.
|
||||||
#print self.caller, self.caller.__class__
|
|
||||||
self.character = self.caller
|
self.character = self.caller
|
||||||
if hasattr(self.caller, "player"):
|
if hasattr(self.caller, "player"):
|
||||||
self.caller = self.caller.player
|
self.caller = self.caller.player
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,6 @@ def parse_sdescs_and_recogs(sender, candidates, string, search_mode=False):
|
||||||
# we scan backwards so we can replace in-situ without messing
|
# we scan backwards so we can replace in-situ without messing
|
||||||
# up later occurrences. Given a marker match, query from
|
# up later occurrences. Given a marker match, query from
|
||||||
# start index forward for all candidates.
|
# start index forward for all candidates.
|
||||||
#print "marker_match:", marker_match.re.pattern, marker_match.groups()
|
|
||||||
|
|
||||||
# first see if there is a number given (e.g. 1-tall)
|
# first see if there is a number given (e.g. 1-tall)
|
||||||
num_identifier, _ = marker_match.groups("") # return "" if no match, rather than None
|
num_identifier, _ = marker_match.groups("") # return "" if no match, rather than None
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,6 @@ class OpenLidState(DefaultScript):
|
||||||
automatically checked, so we don't need to worry about
|
automatically checked, so we don't need to worry about
|
||||||
adding the cmdset to a closed lid-button.
|
adding the cmdset to a closed lid-button.
|
||||||
"""
|
"""
|
||||||
#print "In Open at_start (should add cmdset)"
|
|
||||||
self.obj.cmdset.add(cmdsetexamples.LidOpenCmdSet)
|
self.obj.cmdset.add(cmdsetexamples.LidOpenCmdSet)
|
||||||
|
|
||||||
def is_valid(self):
|
def is_valid(self):
|
||||||
|
|
@ -215,7 +214,6 @@ class BlinkButtonEvent(DefaultScript):
|
||||||
"""
|
"""
|
||||||
Button will keep blinking unless it is broken.
|
Button will keep blinking unless it is broken.
|
||||||
"""
|
"""
|
||||||
#print "self.obj.db.lamp_works:", self.obj.db.lamp_works
|
|
||||||
return self.obj.db.lamp_works
|
return self.obj.db.lamp_works
|
||||||
|
|
||||||
def at_repeat(self):
|
def at_repeat(self):
|
||||||
|
|
|
||||||
|
|
@ -585,7 +585,6 @@ class DefaultObject(ObjectDB):
|
||||||
|
|
||||||
# Perform move
|
# Perform move
|
||||||
try:
|
try:
|
||||||
#print "move_to location:", destination
|
|
||||||
self.location = destination
|
self.location = destination
|
||||||
except Exception:
|
except Exception:
|
||||||
emit_to_obj.msg(errtxt % "location change")
|
emit_to_obj.msg(errtxt % "location change")
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,6 @@ class ScriptDBManager(TypedObjectManager):
|
||||||
if dbref and self.dbref(dbref, reqhash=False):
|
if dbref and self.dbref(dbref, reqhash=False):
|
||||||
scripts = self.get_id(dbref)
|
scripts = self.get_id(dbref)
|
||||||
elif obj:
|
elif obj:
|
||||||
#print "calling get_all_scripts_on_obj", obj, key, VALIDATE_ITERATION
|
|
||||||
scripts = self.get_all_scripts_on_obj(obj, key=key)
|
scripts = self.get_all_scripts_on_obj(obj, key=key)
|
||||||
else:
|
else:
|
||||||
scripts = self.get_all_scripts(key=key) #self.model.get_all_cached_instances()
|
scripts = self.get_all_scripts(key=key) #self.model.get_all_cached_instances()
|
||||||
|
|
@ -207,12 +206,9 @@ class ScriptDBManager(TypedObjectManager):
|
||||||
VALIDATE_ITERATION -= 1
|
VALIDATE_ITERATION -= 1
|
||||||
return None, None
|
return None, None
|
||||||
|
|
||||||
#print "scripts to validate: [%s]" % (", ".join(script.key for script in scripts))
|
|
||||||
for script in scripts:
|
for script in scripts:
|
||||||
#print "validating %s (%i) (init_mode=%s)" % (script.key, id(script), init_mode)
|
|
||||||
if script.is_valid():
|
if script.is_valid():
|
||||||
nr_started += script.start(force_restart=init_mode)
|
nr_started += script.start(force_restart=init_mode)
|
||||||
#print "back from start. nr_started=", nr_started
|
|
||||||
else:
|
else:
|
||||||
script.stop()
|
script.stop()
|
||||||
nr_stopped += 1
|
nr_stopped += 1
|
||||||
|
|
|
||||||
|
|
@ -226,7 +226,6 @@ class DefaultScript(ScriptBase):
|
||||||
callcount = self.ndb._task.callcount
|
callcount = self.ndb._task.callcount
|
||||||
maxcount = self.db_repeats
|
maxcount = self.db_repeats
|
||||||
if maxcount > 0 and maxcount <= callcount:
|
if maxcount > 0 and maxcount <= callcount:
|
||||||
#print "stopping script!"
|
|
||||||
self.stop()
|
self.stop()
|
||||||
|
|
||||||
def _step_task(self):
|
def _step_task(self):
|
||||||
|
|
|
||||||
|
|
@ -344,7 +344,6 @@ class TickerHandler(object):
|
||||||
ticker_storage = ServerConfig.objects.conf(key=self.save_name)
|
ticker_storage = ServerConfig.objects.conf(key=self.save_name)
|
||||||
if ticker_storage:
|
if ticker_storage:
|
||||||
self.ticker_storage = dbunserialize(ticker_storage)
|
self.ticker_storage = dbunserialize(ticker_storage)
|
||||||
#print "restore:", self.ticker_storage
|
|
||||||
for store_key, (args, kwargs) in self.ticker_storage.items():
|
for store_key, (args, kwargs) in self.ticker_storage.items():
|
||||||
obj, interval, idstring = store_key
|
obj, interval, idstring = store_key
|
||||||
obj = unpack_dbobj(obj)
|
obj = unpack_dbobj(obj)
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,6 @@ class AmpServerFactory(protocol.ServerFactory):
|
||||||
protocol (Protocol): The created protocol.
|
protocol (Protocol): The created protocol.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "Evennia Server connected to Portal at %s." % addr
|
|
||||||
self.server.amp_protocol = AMPProtocol()
|
self.server.amp_protocol = AMPProtocol()
|
||||||
self.server.amp_protocol.factory = self
|
self.server.amp_protocol.factory = self
|
||||||
return self.server.amp_protocol
|
return self.server.amp_protocol
|
||||||
|
|
@ -139,7 +138,6 @@ class AmpClientFactory(protocol.ReconnectingClientFactory):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
#print 'AMP started to connect:', connector
|
|
||||||
|
|
||||||
def buildProtocol(self, addr):
|
def buildProtocol(self, addr):
|
||||||
"""
|
"""
|
||||||
|
|
@ -149,7 +147,6 @@ class AmpClientFactory(protocol.ReconnectingClientFactory):
|
||||||
addr (str): Connection address. Not used.
|
addr (str): Connection address. Not used.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "Portal connected to Evennia server at %s." % addr
|
|
||||||
self.resetDelay()
|
self.resetDelay()
|
||||||
self.portal.amp_protocol = AMPProtocol()
|
self.portal.amp_protocol = AMPProtocol()
|
||||||
self.portal.amp_protocol.factory = self
|
self.portal.amp_protocol.factory = self
|
||||||
|
|
@ -417,7 +414,6 @@ class AMPProtocol(amp.AMP):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
#print "msg portal -> server (server side):", sessid, msg, loads(ret["data"])
|
|
||||||
self.factory.server.sessions.data_in(sessid, **kwargs)
|
self.factory.server.sessions.data_in(sessid, **kwargs)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
@ -434,7 +430,6 @@ class AMPProtocol(amp.AMP):
|
||||||
deferred (Deferred): Asynchronous return.
|
deferred (Deferred): Asynchronous return.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "msg portal->server (portal side):", sessid, msg, data
|
|
||||||
return self.send_data(MsgPortal2Server, sessid, text=text, **kwargs)
|
return self.send_data(MsgPortal2Server, sessid, text=text, **kwargs)
|
||||||
|
|
||||||
# Server -> Portal message
|
# Server -> Portal message
|
||||||
|
|
@ -454,7 +449,6 @@ class AMPProtocol(amp.AMP):
|
||||||
packed_data (str): Pickled data (sessid, kwargs) coming over the wire.
|
packed_data (str): Pickled data (sessid, kwargs) coming over the wire.
|
||||||
"""
|
"""
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
#print "msg server->portal (portal side):", sessid, ret["text"], loads(ret["data"])
|
|
||||||
self.factory.portal.sessions.data_out(sessid, **kwargs)
|
self.factory.portal.sessions.data_out(sessid, **kwargs)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
|
@ -470,7 +464,6 @@ class AMPProtocol(amp.AMP):
|
||||||
kwargs (any, optiona): Extra data.
|
kwargs (any, optiona): Extra data.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "msg server->portal (server side):", sessid, msg, data
|
|
||||||
return self.send_data(MsgServer2Portal, sessid, text=text, **kwargs)
|
return self.send_data(MsgServer2Portal, sessid, text=text, **kwargs)
|
||||||
|
|
||||||
# Server administration from the Portal side
|
# Server administration from the Portal side
|
||||||
|
|
@ -485,12 +478,10 @@ class AMPProtocol(amp.AMP):
|
||||||
packed_data (str): Incoming, pickled data.
|
packed_data (str): Incoming, pickled data.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "serveradmin (server side):", hashid, ipart, nparts
|
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
operation = kwargs.pop("operation", "")
|
operation = kwargs.pop("operation", "")
|
||||||
server_sessionhandler = self.factory.server.sessions
|
server_sessionhandler = self.factory.server.sessions
|
||||||
|
|
||||||
#print "serveradmin (server side):", sessid, ord(operation), data
|
|
||||||
|
|
||||||
if operation == PCONN: # portal_session_connect
|
if operation == PCONN: # portal_session_connect
|
||||||
# create a new session and sync it
|
# create a new session and sync it
|
||||||
|
|
@ -527,7 +518,6 @@ class AMPProtocol(amp.AMP):
|
||||||
data (str or dict, optional): Data used in the administrative operation.
|
data (str or dict, optional): Data used in the administrative operation.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "serveradmin (portal side):", sessid, ord(operation), data
|
|
||||||
return self.send_data(AdminPortal2Server, sessid, operation=operation, **kwargs)
|
return self.send_data(AdminPortal2Server, sessid, operation=operation, **kwargs)
|
||||||
|
|
||||||
# Portal administraton from the Server side
|
# Portal administraton from the Server side
|
||||||
|
|
@ -543,7 +533,6 @@ class AMPProtocol(amp.AMP):
|
||||||
packed_data (str): Data received, a pickled tuple (sessid, kwargs).
|
packed_data (str): Data received, a pickled tuple (sessid, kwargs).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "portaladmin (portal side):", sessid, ord(operation), data
|
|
||||||
sessid, kwargs = loads(packed_data)
|
sessid, kwargs = loads(packed_data)
|
||||||
operation = kwargs.pop("operation")
|
operation = kwargs.pop("operation")
|
||||||
portal_sessionhandler = self.factory.portal.sessions
|
portal_sessionhandler = self.factory.portal.sessions
|
||||||
|
|
|
||||||
|
|
@ -198,14 +198,11 @@ def handle_setup(last_step):
|
||||||
at_initial_setup,
|
at_initial_setup,
|
||||||
reset_server]
|
reset_server]
|
||||||
|
|
||||||
#print " Initial setup: %s steps." % (len(setup_queue))
|
|
||||||
|
|
||||||
# step through queue, from last completed function
|
# step through queue, from last completed function
|
||||||
for num, setup_func in enumerate(setup_queue[last_step:]):
|
for num, setup_func in enumerate(setup_queue[last_step:]):
|
||||||
# run the setup function. Note that if there is a
|
# run the setup function. Note that if there is a
|
||||||
# traceback we let it stop the system so the config
|
# traceback we let it stop the system so the config
|
||||||
# step is not saved.
|
# step is not saved.
|
||||||
#print "%s..." % num
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
setup_func()
|
setup_func()
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,6 @@ def oob_send(session, *args, **kwargs):
|
||||||
if obj:
|
if obj:
|
||||||
for name in (a.upper() for a in args if a):
|
for name in (a.upper() for a in args if a):
|
||||||
try:
|
try:
|
||||||
#print "MSDP SEND inp:", name
|
|
||||||
value = OOB_SENDABLE.get(name, _NA)(obj)
|
value = OOB_SENDABLE.get(name, _NA)(obj)
|
||||||
ret[name] = value
|
ret[name] = value
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -257,7 +256,6 @@ def oob_report(session, *args, **kwargs):
|
||||||
else:
|
else:
|
||||||
OOB_HANDLER.add_attribute_monitor(obj, session.sessid, propname, "return_attribute_report")
|
OOB_HANDLER.add_attribute_monitor(obj, session.sessid, propname, "return_attribute_report")
|
||||||
ret.append(_GA(obj, "db_value"))
|
ret.append(_GA(obj, "db_value"))
|
||||||
#print "ret:", ret
|
|
||||||
session.msg(oob=("MSDP_ARRAY", ret))
|
session.msg(oob=("MSDP_ARRAY", ret))
|
||||||
else:
|
else:
|
||||||
oob_error(session, "You must log in first.")
|
oob_error(session, "You must log in first.")
|
||||||
|
|
|
||||||
|
|
@ -448,7 +448,6 @@ class OOBHandler(TickerHandler):
|
||||||
(session, oobfuncname, args, kwargs)
|
(session, oobfuncname, args, kwargs)
|
||||||
raise RuntimeError(errmsg)
|
raise RuntimeError(errmsg)
|
||||||
|
|
||||||
#print "execute_oob:", session, oobfuncname, args, kwargs
|
|
||||||
try:
|
try:
|
||||||
oobfunc = _OOB_FUNCS[oobfuncname]
|
oobfunc = _OOB_FUNCS[oobfuncname]
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,6 @@ class PortalSessionHandler(SessionHandler):
|
||||||
|
|
||||||
self.sessions[session.sessid] = session
|
self.sessions[session.sessid] = session
|
||||||
session.server_connected = True
|
session.server_connected = True
|
||||||
#print "connecting", session.sessid, " number:", len(self.sessions)
|
|
||||||
self.portal.amp_protocol.send_AdminPortal2Server(session.sessid,
|
self.portal.amp_protocol.send_AdminPortal2Server(session.sessid,
|
||||||
operation=PCONN,
|
operation=PCONN,
|
||||||
sessiondata=sessdata)
|
sessiondata=sessdata)
|
||||||
|
|
@ -389,7 +388,6 @@ class PortalSessionHandler(SessionHandler):
|
||||||
# data throttle (anti DoS measure)
|
# data throttle (anti DoS measure)
|
||||||
now = time()
|
now = time()
|
||||||
dT = now - self.command_counter_reset
|
dT = now - self.command_counter_reset
|
||||||
#print " command rate:", _MAX_COMMAND_RATE / dT, dT, self.command_counter
|
|
||||||
self.command_counter = 0
|
self.command_counter = 0
|
||||||
self.command_counter_reset = now
|
self.command_counter_reset = now
|
||||||
self.command_overflow = dT < 1.0
|
self.command_overflow = dT < 1.0
|
||||||
|
|
@ -431,9 +429,7 @@ class PortalSessionHandler(SessionHandler):
|
||||||
if session:
|
if session:
|
||||||
# convert oob to the generic format
|
# convert oob to the generic format
|
||||||
if "oob" in kwargs:
|
if "oob" in kwargs:
|
||||||
#print "oobstruct_parser in:", kwargs["oob"]
|
|
||||||
kwargs["oob"] = self.oobstruct_parser(kwargs["oob"])
|
kwargs["oob"] = self.oobstruct_parser(kwargs["oob"])
|
||||||
#print "oobstruct_parser out:", kwargs["oob"]
|
|
||||||
session.data_out(text=text, **kwargs)
|
session.data_out(text=text, **kwargs)
|
||||||
|
|
||||||
PORTAL_SESSIONS = PortalSessionHandler()
|
PORTAL_SESSIONS = PortalSessionHandler()
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,6 @@ def verify_SSL_key_and_cert(keyfile, certfile):
|
||||||
# default:
|
# default:
|
||||||
#openssl req -new -x509 -key ssl.key -out ssl.cert -days 7300
|
#openssl req -new -x509 -key ssl.key -out ssl.cert -days 7300
|
||||||
exestring = "openssl req -new -x509 -key %s -out %s -days %s" % (keyfile, certfile, CERT_EXPIRE)
|
exestring = "openssl req -new -x509 -key %s -out %s -days %s" % (keyfile, certfile, CERT_EXPIRE)
|
||||||
#print "exestring:", exestring
|
|
||||||
try:
|
try:
|
||||||
#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
#, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
subprocess.call(exestring)
|
subprocess.call(exestring)
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
"""
|
"""
|
||||||
if data and data[0] == IAC or self.iaw_mode:
|
if data and data[0] == IAC or self.iaw_mode:
|
||||||
try:
|
try:
|
||||||
#print "IAC mode"
|
|
||||||
super(TelnetProtocol, self).dataReceived(data)
|
super(TelnetProtocol, self).dataReceived(data)
|
||||||
if len(data) == 1:
|
if len(data) == 1:
|
||||||
self.iaw_mode = True
|
self.iaw_mode = True
|
||||||
|
|
@ -196,12 +195,10 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
|
|
||||||
# if we get to this point the command should end with a linebreak.
|
# if we get to this point the command should end with a linebreak.
|
||||||
# We make sure to add it, to fix some clients messing this up.
|
# We make sure to add it, to fix some clients messing this up.
|
||||||
#print "line data in:", repr(data)
|
|
||||||
StatefulTelnetProtocol.dataReceived(self, data)
|
StatefulTelnetProtocol.dataReceived(self, data)
|
||||||
|
|
||||||
def _write(self, data):
|
def _write(self, data):
|
||||||
"hook overloading the one used in plain telnet"
|
"hook overloading the one used in plain telnet"
|
||||||
# print "_write (%s): %s" % (self.state, " ".join(str(ord(c)) for c in data))
|
|
||||||
data = data.replace('\n', '\r\n').replace('\r\r\n', '\r\n')
|
data = data.replace('\n', '\r\n').replace('\r\r\n', '\r\n')
|
||||||
#data = data.replace('\n', '\r\n')
|
#data = data.replace('\n', '\r\n')
|
||||||
super(TelnetProtocol, self)._write(mccp_compress(self, data))
|
super(TelnetProtocol, self)._write(mccp_compress(self, data))
|
||||||
|
|
@ -214,7 +211,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
line (str): Line to send.
|
line (str): Line to send.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "sendLine (%s):\n%s" % (self.state, line)
|
|
||||||
#escape IAC in line mode, and correctly add \r\n
|
#escape IAC in line mode, and correctly add \r\n
|
||||||
line += self.delimiter
|
line += self.delimiter
|
||||||
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n')
|
line = line.replace(IAC, IAC + IAC).replace('\n', '\r\n')
|
||||||
|
|
@ -305,7 +301,6 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
if "oob" in kwargs and "OOB" in self.protocol_flags:
|
if "oob" in kwargs and "OOB" in self.protocol_flags:
|
||||||
# oob is a list of [(cmdname, arg, kwarg), ...]
|
# oob is a list of [(cmdname, arg, kwarg), ...]
|
||||||
for cmdname, args, okwargs in kwargs["oob"]:
|
for cmdname, args, okwargs in kwargs["oob"]:
|
||||||
#print "telnet oob data_out:", cmdname, args, kwargs
|
|
||||||
self.oob.data_out(cmdname, *args, **okwargs)
|
self.oob.data_out(cmdname, *args, **okwargs)
|
||||||
|
|
||||||
# parse **kwargs, falling back to ttype if nothing is given explicitly
|
# parse **kwargs, falling back to ttype if nothing is given explicitly
|
||||||
|
|
@ -318,15 +313,12 @@ class TelnetProtocol(Telnet, StatefulTelnetProtocol, Session):
|
||||||
echo = kwargs.get("echo", None)
|
echo = kwargs.get("echo", None)
|
||||||
mxp = kwargs.get("mxp", self.protocol_flags.get("MXP", False))
|
mxp = kwargs.get("mxp", self.protocol_flags.get("MXP", False))
|
||||||
|
|
||||||
#print "telnet kwargs=%s, message=%s" % (kwargs, text)
|
|
||||||
#print "xterm256=%s, useansi=%s, raw=%s, nomarkup=%s, init_done=%s" % (xterm256, useansi, raw, nomarkup, ttype.get("init_done"))
|
|
||||||
if raw:
|
if raw:
|
||||||
# no processing whatsoever
|
# no processing whatsoever
|
||||||
self.sendLine(text)
|
self.sendLine(text)
|
||||||
elif text:
|
elif text:
|
||||||
# we need to make sure to kill the color at the end in order
|
# we need to make sure to kill the color at the end in order
|
||||||
# to match the webclient output.
|
# to match the webclient output.
|
||||||
#print "telnet data out:", self.protocol_flags, id(self.protocol_flags), id(self), "nomarkup: %s, xterm256: %s" % (nomarkup, xterm256)
|
|
||||||
linetosend = ansi.parse_ansi(_RE_N.sub("", text) + "{n", strip_ansi=nomarkup, xterm256=xterm256, mxp=mxp)
|
linetosend = ansi.parse_ansi(_RE_N.sub("", text) + "{n", strip_ansi=nomarkup, xterm256=xterm256, mxp=mxp)
|
||||||
if mxp:
|
if mxp:
|
||||||
linetosend = mxp_parse(linetosend)
|
linetosend = mxp_parse(linetosend)
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,6 @@ class TelnetOOB(object):
|
||||||
else:
|
else:
|
||||||
msdp_string = "%s%s%s" % (MSDP_VAR. cmdname, "".join(
|
msdp_string = "%s%s%s" % (MSDP_VAR. cmdname, "".join(
|
||||||
["%s%s%s%s" % (MSDP_VAR, key, MSDP_VAL, val) for key, val in kwargs.items()]))
|
["%s%s%s%s" % (MSDP_VAR, key, MSDP_VAL, val) for key, val in kwargs.items()]))
|
||||||
#print "encode msdp result:", cmdname, args, kwargs, "->", msdp_string
|
|
||||||
return force_str(msdp_string)
|
return force_str(msdp_string)
|
||||||
|
|
||||||
def encode_gmcp(self, cmdname, *args, **kwargs):
|
def encode_gmcp(self, cmdname, *args, **kwargs):
|
||||||
|
|
@ -194,7 +193,6 @@ class TelnetOOB(object):
|
||||||
gmcp_string = "%s %s" % (cmdname, json.dumps(args))
|
gmcp_string = "%s %s" % (cmdname, json.dumps(args))
|
||||||
elif kwargs:
|
elif kwargs:
|
||||||
gmcp_string = "%s %s" % (cmdname, json.dumps(kwargs))
|
gmcp_string = "%s %s" % (cmdname, json.dumps(kwargs))
|
||||||
#print "gmcp_encode", cmdname, args, kwargs, "->", gmcp_string
|
|
||||||
return force_str(gmcp_string).strip()
|
return force_str(gmcp_string).strip()
|
||||||
|
|
||||||
def decode_msdp(self, data):
|
def decode_msdp(self, data):
|
||||||
|
|
@ -233,8 +231,6 @@ class TelnetOOB(object):
|
||||||
parts = msdp_regex_val.split(varval)
|
parts = msdp_regex_val.split(varval)
|
||||||
variables[parts[0]] = tuple(parts[1:]) if len(parts) > 1 else ("", )
|
variables[parts[0]] = tuple(parts[1:]) if len(parts) > 1 else ("", )
|
||||||
|
|
||||||
#print "OOB: MSDP decode:", data, "->", variables, arrays, tables
|
|
||||||
|
|
||||||
# send to the sessionhandler
|
# send to the sessionhandler
|
||||||
if data:
|
if data:
|
||||||
for varname, var in variables.items():
|
for varname, var in variables.items():
|
||||||
|
|
@ -263,7 +259,6 @@ class TelnetOOB(object):
|
||||||
if hasattr(data, "__iter__"):
|
if hasattr(data, "__iter__"):
|
||||||
data = "".join(data)
|
data = "".join(data)
|
||||||
|
|
||||||
#print "decode_gmcp:", data
|
|
||||||
if data:
|
if data:
|
||||||
splits = data.split(None, 1)
|
splits = data.split(None, 1)
|
||||||
cmdname = splits[0]
|
cmdname = splits[0]
|
||||||
|
|
@ -282,7 +277,6 @@ class TelnetOOB(object):
|
||||||
args = tuple(struct)
|
args = tuple(struct)
|
||||||
else:
|
else:
|
||||||
args = (struct,)
|
args = (struct,)
|
||||||
#print "gmcp decode:", data, "->", cmdname, args, kwargs
|
|
||||||
self.protocol.data_in(oob=(cmdname, args, kwargs))
|
self.protocol.data_in(oob=(cmdname, args, kwargs))
|
||||||
|
|
||||||
# access methods
|
# access methods
|
||||||
|
|
@ -296,7 +290,6 @@ class TelnetOOB(object):
|
||||||
args, kwargs (any): Arguments to OOB command.
|
args, kwargs (any): Arguments to OOB command.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
#print "data_out:", encoded_oob
|
|
||||||
if self.MSDP:
|
if self.MSDP:
|
||||||
encoded_oob = self.encode_msdp(cmdname, *args, **kwargs)
|
encoded_oob = self.encode_msdp(cmdname, *args, **kwargs)
|
||||||
self.protocol._write(IAC + SB + MSDP + encoded_oob + IAC + SE)
|
self.protocol._write(IAC + SB + MSDP + encoded_oob + IAC + SE)
|
||||||
|
|
|
||||||
|
|
@ -90,8 +90,6 @@ class Ttype(object):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
#print "incoming TTYPE option:", option
|
|
||||||
|
|
||||||
if self.ttype_step == 0:
|
if self.ttype_step == 0:
|
||||||
# just start the request chain
|
# just start the request chain
|
||||||
self.protocol.requestNegotiation(TTYPE, SEND)
|
self.protocol.requestNegotiation(TTYPE, SEND)
|
||||||
|
|
@ -153,7 +151,6 @@ class Ttype(object):
|
||||||
self.protocol.protocol_flags['TTYPE'][option.upper()] = True
|
self.protocol.protocol_flags['TTYPE'][option.upper()] = True
|
||||||
|
|
||||||
self.protocol.protocol_flags['TTYPE']['init_done'] = True
|
self.protocol.protocol_flags['TTYPE']['init_done'] = True
|
||||||
# print "TTYPE final:", self.protocol.protocol_flags['TTYPE']
|
|
||||||
# we must sync ttype once it'd done
|
# we must sync ttype once it'd done
|
||||||
self.protocol.handshake_done()
|
self.protocol.handshake_done()
|
||||||
self.ttype_step += 1
|
self.ttype_step += 1
|
||||||
|
|
|
||||||
|
|
@ -268,7 +268,6 @@ class Evennia(object):
|
||||||
#update eventual changed defaults
|
#update eventual changed defaults
|
||||||
self.update_defaults()
|
self.update_defaults()
|
||||||
|
|
||||||
#print "run_init_hooks:", ObjectDB.get_all_cached_instances()
|
|
||||||
[o.at_init() for o in ObjectDB.get_all_cached_instances()]
|
[o.at_init() for o in ObjectDB.get_all_cached_instances()]
|
||||||
[p.at_init() for p in PlayerDB.get_all_cached_instances()]
|
[p.at_init() for p in PlayerDB.get_all_cached_instances()]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -607,7 +607,6 @@ class ServerSessionHandler(SessionHandler):
|
||||||
if not _OOB_HANDLER:
|
if not _OOB_HANDLER:
|
||||||
from evennia.server.oobhandler import OOB_HANDLER as _OOB_HANDLER
|
from evennia.server.oobhandler import OOB_HANDLER as _OOB_HANDLER
|
||||||
funcname, args, kwargs = kwargs.pop("oob")
|
funcname, args, kwargs = kwargs.pop("oob")
|
||||||
#print "OOB session.data_in:", funcname, args, kwargs
|
|
||||||
if funcname:
|
if funcname:
|
||||||
_OOB_HANDLER.execute_cmd(session, funcname, *args, **kwargs)
|
_OOB_HANDLER.execute_cmd(session, funcname, *args, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -286,7 +286,6 @@ class AttributeHandler(object):
|
||||||
ret = []
|
ret = []
|
||||||
key = [k.strip().lower() for k in make_iter(key) if k]
|
key = [k.strip().lower() for k in make_iter(key) if k]
|
||||||
category = category.strip().lower() if category is not None else None
|
category = category.strip().lower() if category is not None else None
|
||||||
#print "cache:", self._cache.keys(), key
|
|
||||||
if not key:
|
if not key:
|
||||||
# return all with matching category (or no category)
|
# return all with matching category (or no category)
|
||||||
catkey = "-%s" % category if category is not None else None
|
catkey = "-%s" % category if category is not None else None
|
||||||
|
|
|
||||||
|
|
@ -455,7 +455,6 @@ class TypedObject(SharedMemoryModel):
|
||||||
if hasattr(self.ndb, nattr):
|
if hasattr(self.ndb, nattr):
|
||||||
self.nattributes.remove(nattr)
|
self.nattributes.remove(nattr)
|
||||||
else:
|
else:
|
||||||
#print "deleting attrs ..."
|
|
||||||
self.attributes.clear()
|
self.attributes.clear()
|
||||||
self.nattributes.clear()
|
self.nattributes.clear()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,10 +134,8 @@ class ANSIParser(object):
|
||||||
|
|
||||||
if convert:
|
if convert:
|
||||||
colval = 16 + (red * 36) + (green * 6) + blue
|
colval = 16 + (red * 36) + (green * 6) + blue
|
||||||
#print "RGB colours:", red, green, blue
|
|
||||||
return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval/100, (colval % 100)/10, colval%10)
|
return "\033[%s8;5;%s%s%sm" % (3 + int(background), colval/100, (colval % 100)/10, colval%10)
|
||||||
else:
|
else:
|
||||||
#print "ANSI convert:", red, green, blue
|
|
||||||
# xterm256 not supported, convert the rgb value to ansi instead
|
# xterm256 not supported, convert the rgb value to ansi instead
|
||||||
if red == green and red == blue and red < 2:
|
if red == green and red == blue and red < 2:
|
||||||
if background:
|
if background:
|
||||||
|
|
|
||||||
|
|
@ -245,8 +245,6 @@ class EvForm(object):
|
||||||
ix0 = match.end()
|
ix0 = match.end()
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
#print "cell_coords:", cell_coords
|
|
||||||
#print "table_coords:", table_coords
|
|
||||||
|
|
||||||
# get rectangles and assign EvCells
|
# get rectangles and assign EvCells
|
||||||
for key, (iy, leftix, rightix) in cell_coords.items():
|
for key, (iy, leftix, rightix) in cell_coords.items():
|
||||||
|
|
@ -255,7 +253,6 @@ class EvForm(object):
|
||||||
dy_up = 0
|
dy_up = 0
|
||||||
if iy > 0:
|
if iy > 0:
|
||||||
for i in range(1,iy):
|
for i in range(1,iy):
|
||||||
#print "dy_up:", [form[iy-i][ix] for ix in range(leftix, rightix)]
|
|
||||||
if all(form[iy-i][ix] == cellchar for ix in range(leftix, rightix)):
|
if all(form[iy-i][ix] == cellchar for ix in range(leftix, rightix)):
|
||||||
dy_up += 1
|
dy_up += 1
|
||||||
else:
|
else:
|
||||||
|
|
@ -264,7 +261,6 @@ class EvForm(object):
|
||||||
dy_down = 0
|
dy_down = 0
|
||||||
if iy < nform-1:
|
if iy < nform-1:
|
||||||
for i in range(1,nform-iy-1):
|
for i in range(1,nform-iy-1):
|
||||||
#print "dy_down:", [form[iy+i][ix]for ix in range(leftix, rightix)]
|
|
||||||
if all(form[iy+i][ix] == cellchar for ix in range(leftix, rightix)):
|
if all(form[iy+i][ix] == cellchar for ix in range(leftix, rightix)):
|
||||||
dy_down += 1
|
dy_down += 1
|
||||||
else:
|
else:
|
||||||
|
|
@ -279,13 +275,10 @@ class EvForm(object):
|
||||||
# we have all the coordinates we need. Create EvCell.
|
# we have all the coordinates we need. Create EvCell.
|
||||||
data = self.cells_mapping.get(key, "")
|
data = self.cells_mapping.get(key, "")
|
||||||
#if key == "1":
|
#if key == "1":
|
||||||
# print "creating cell '%s' (%s):" % (key, data)
|
|
||||||
# print "iy=%s, iyup=%s, iydown=%s, leftix=%s, rightix=%s, width=%s, height=%s" % (iy, iyup, iydown, leftix, rightix, width, height)
|
|
||||||
|
|
||||||
options = { "pad_left":0, "pad_right":0, "pad_top":0, "pad_bottom":0, "align":"l", "valign":"t", "enforce_size":True}
|
options = { "pad_left":0, "pad_right":0, "pad_top":0, "pad_bottom":0, "align":"l", "valign":"t", "enforce_size":True}
|
||||||
options.update(custom_options)
|
options.update(custom_options)
|
||||||
#if key=="4":
|
#if key=="4":
|
||||||
#print "options:", options
|
|
||||||
|
|
||||||
mapping[key] = (iyup, leftix, width, height, EvCell(data, width=width, height=height,**options))
|
mapping[key] = (iyup, leftix, width, height, EvCell(data, width=width, height=height,**options))
|
||||||
|
|
||||||
|
|
@ -296,7 +289,6 @@ class EvForm(object):
|
||||||
dy_up = 0
|
dy_up = 0
|
||||||
if iy > 0:
|
if iy > 0:
|
||||||
for i in range(1,iy):
|
for i in range(1,iy):
|
||||||
#print "dy_up:", [form[iy-i][ix] for ix in range(leftix, rightix)]
|
|
||||||
if all(form[iy-i][ix] == tablechar for ix in range(leftix, rightix)):
|
if all(form[iy-i][ix] == tablechar for ix in range(leftix, rightix)):
|
||||||
dy_up += 1
|
dy_up += 1
|
||||||
else:
|
else:
|
||||||
|
|
@ -305,7 +297,6 @@ class EvForm(object):
|
||||||
dy_down = 0
|
dy_down = 0
|
||||||
if iy < nform-1:
|
if iy < nform-1:
|
||||||
for i in range(1,nform-iy-1):
|
for i in range(1,nform-iy-1):
|
||||||
#print "dy_down:", [form[iy+i][ix]for ix in range(leftix, rightix)]
|
|
||||||
if all(form[iy+i][ix] == tablechar for ix in range(leftix, rightix)):
|
if all(form[iy+i][ix] == tablechar for ix in range(leftix, rightix)):
|
||||||
dy_down += 1
|
dy_down += 1
|
||||||
else:
|
else:
|
||||||
|
|
@ -319,13 +310,10 @@ class EvForm(object):
|
||||||
|
|
||||||
# we have all the coordinates we need. Create Table.
|
# we have all the coordinates we need. Create Table.
|
||||||
table = self.tables_mapping.get(key, None)
|
table = self.tables_mapping.get(key, None)
|
||||||
#print "creating table '%s' (%s):" % (key, data)
|
|
||||||
#print "iy=%s, iyup=%s, iydown=%s, leftix=%s, rightix=%s, width=%s, height=%s" % (iy, iyup, iydown, leftix, rightix, width, height)
|
|
||||||
|
|
||||||
options = { "pad_left":0, "pad_right":0, "pad_top":0, "pad_bottom":0,
|
options = { "pad_left":0, "pad_right":0, "pad_top":0, "pad_bottom":0,
|
||||||
"align":"l", "valign":"t", "enforce_size":True}
|
"align":"l", "valign":"t", "enforce_size":True}
|
||||||
options.update(custom_options)
|
options.update(custom_options)
|
||||||
#print "options:", options
|
|
||||||
|
|
||||||
if table:
|
if table:
|
||||||
table.reformat(width=width, height=height, **options)
|
table.reformat(width=width, height=height, **options)
|
||||||
|
|
|
||||||
|
|
@ -1224,9 +1224,6 @@ class EvTable(object):
|
||||||
self._borders()
|
self._borders()
|
||||||
|
|
||||||
# equalize widths within each column
|
# equalize widths within each column
|
||||||
#print [col.options for col in self.worktable]
|
|
||||||
#print [[cell.get_width() for cell in col] for col in self.worktable]
|
|
||||||
#print [[cell.get_height() for cell in col] for col in self.worktable]
|
|
||||||
cwidths = [max(cell.get_width() for cell in col) for col in self.worktable]
|
cwidths = [max(cell.get_width() for cell in col) for col in self.worktable]
|
||||||
|
|
||||||
if self.width or self.maxwidth and self.maxwidth < sum(cwidths):
|
if self.width or self.maxwidth and self.maxwidth < sum(cwidths):
|
||||||
|
|
@ -1280,7 +1277,6 @@ class EvTable(object):
|
||||||
# get minimum possible cell heights for each collumn
|
# get minimum possible cell heights for each collumn
|
||||||
cheights_min = [max(cell.get_min_height() for cell in (col[iy] for col in self.worktable)) for iy in xrange(nrowmax)]
|
cheights_min = [max(cell.get_min_height() for cell in (col[iy] for col in self.worktable)) for iy in xrange(nrowmax)]
|
||||||
chmin = sum(cheights_min)
|
chmin = sum(cheights_min)
|
||||||
#print "cheights_min:", cheights_min
|
|
||||||
|
|
||||||
if chmin > self.height:
|
if chmin > self.height:
|
||||||
# we cannot shrink any more
|
# we cannot shrink any more
|
||||||
|
|
@ -1308,7 +1304,6 @@ class EvTable(object):
|
||||||
|
|
||||||
# we must tell cells to crop instead of expanding
|
# we must tell cells to crop instead of expanding
|
||||||
options["enforce_size"] = True
|
options["enforce_size"] = True
|
||||||
#print "cheights2:", cheights
|
|
||||||
|
|
||||||
# reformat table (for vertical align)
|
# reformat table (for vertical align)
|
||||||
for ix, col in enumerate(self.worktable):
|
for ix, col in enumerate(self.worktable):
|
||||||
|
|
@ -1322,7 +1317,6 @@ class EvTable(object):
|
||||||
# calculate actual table width/height in characters
|
# calculate actual table width/height in characters
|
||||||
self.cwidth = sum(cwidths)
|
self.cwidth = sum(cwidths)
|
||||||
self.cheight = sum(cheights)
|
self.cheight = sum(cheights)
|
||||||
#print "actual table width, height:", self.cwidth, self.cheight, self.width, self.height
|
|
||||||
|
|
||||||
def _generate_lines(self):
|
def _generate_lines(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,9 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
|
|
||||||
instance_key = cls._get_cache_key(args, kwargs)
|
instance_key = cls._get_cache_key(args, kwargs)
|
||||||
# depending on the arguments, we might not be able to infer the PK, so in that case we create a new instance
|
# depending on the arguments, we might not be able to infer the PK, so in that case we create a new instance
|
||||||
#print "SharedMemoryModelBase.__call__ 1: calledby:", calledby(3)
|
|
||||||
#print "SharedMemoryModelBase.__call__ 2: instance_key:", instance_key
|
|
||||||
if instance_key is None:
|
if instance_key is None:
|
||||||
return new_instance()
|
return new_instance()
|
||||||
cached_instance = cls.get_cached_instance(instance_key)
|
cached_instance = cls.get_cached_instance(instance_key)
|
||||||
#print "SharedMemoryModelBase.__call__ 3: cached_instance:", cached_instance
|
|
||||||
if cached_instance is None:
|
if cached_instance is None:
|
||||||
cached_instance = new_instance()
|
cached_instance = new_instance()
|
||||||
cls.cache_instance(cached_instance, new=True)
|
cls.cache_instance(cached_instance, new=True)
|
||||||
|
|
@ -113,7 +110,6 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
"Helper method to create property wrappers with unique names (must be in separate call)"
|
"Helper method to create property wrappers with unique names (must be in separate call)"
|
||||||
def _get(cls, fname):
|
def _get(cls, fname):
|
||||||
"Wrapper for getting database field"
|
"Wrapper for getting database field"
|
||||||
#print "_get:", fieldname, wrappername,_GA(cls,fieldname)
|
|
||||||
if _GA(cls, "_is_deleted"):
|
if _GA(cls, "_is_deleted"):
|
||||||
raise ObjectDoesNotExist("Cannot access %s: Hosting object was already deleted." % fname)
|
raise ObjectDoesNotExist("Cannot access %s: Hosting object was already deleted." % fname)
|
||||||
return _GA(cls, fieldname)
|
return _GA(cls, fieldname)
|
||||||
|
|
@ -195,12 +191,9 @@ class SharedMemoryModelBase(ModelBase):
|
||||||
for fieldname, field in ((fname, field) for fname, field in attrs.items()
|
for fieldname, field in ((fname, field) for fname, field in attrs.items()
|
||||||
if fname.startswith("db_") and type(field).__name__ != "ManyToManyField"):
|
if fname.startswith("db_") and type(field).__name__ != "ManyToManyField"):
|
||||||
foreignkey = type(field).__name__ == "ForeignKey"
|
foreignkey = type(field).__name__ == "ForeignKey"
|
||||||
#print fieldname, type(field).__name__, field
|
|
||||||
wrappername = "dbid" if fieldname == "id" else fieldname.replace("db_", "", 1)
|
wrappername = "dbid" if fieldname == "id" else fieldname.replace("db_", "", 1)
|
||||||
#print fieldname, wrappername
|
|
||||||
if wrappername not in attrs:
|
if wrappername not in attrs:
|
||||||
# makes sure not to overload manually created wrappers on the model
|
# makes sure not to overload manually created wrappers on the model
|
||||||
#print "wrapping %s -> %s" % (fieldname, wrappername)
|
|
||||||
create_wrapper(cls, fieldname, wrappername, editable=field.editable, foreignkey=foreignkey)
|
create_wrapper(cls, fieldname, wrappername, editable=field.editable, foreignkey=foreignkey)
|
||||||
|
|
||||||
return super(SharedMemoryModelBase, cls).__new__(cls, name, bases, attrs)
|
return super(SharedMemoryModelBase, cls).__new__(cls, name, bases, attrs)
|
||||||
|
|
@ -451,9 +444,7 @@ def flush_cache(**kwargs):
|
||||||
else:
|
else:
|
||||||
yield cls
|
yield cls
|
||||||
|
|
||||||
#print "start flush ..."
|
|
||||||
for cls in class_hierarchy([SharedMemoryModel]):
|
for cls in class_hierarchy([SharedMemoryModel]):
|
||||||
#print cls
|
|
||||||
cls.flush_instance_cache()
|
cls.flush_instance_cache()
|
||||||
# run the python garbage collector
|
# run the python garbage collector
|
||||||
return gc.collect()
|
return gc.collect()
|
||||||
|
|
|
||||||
|
|
@ -1008,8 +1008,6 @@ class PrettyTable(object):
|
||||||
if self.rowcount == 0 and (not options["print_empty"] or not options["border"]):
|
if self.rowcount == 0 and (not options["print_empty"] or not options["border"]):
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
#print "prettytable:", self._rows
|
|
||||||
|
|
||||||
# Get the rows we need to print, taking into account slicing, sorting, etc.
|
# Get the rows we need to print, taking into account slicing, sorting, etc.
|
||||||
rows = self._get_rows(options)
|
rows = self._get_rows(options)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,6 @@ class TestCrop(TestCase):
|
||||||
|
|
||||||
class TestDedent(TestCase):
|
class TestDedent(TestCase):
|
||||||
def test_dedent(self):
|
def test_dedent(self):
|
||||||
#print "Did TestDedent run?"
|
|
||||||
# Empty string, return empty string
|
# Empty string, return empty string
|
||||||
self.assertEqual("", utils.dedent(""))
|
self.assertEqual("", utils.dedent(""))
|
||||||
# No leading whitespace
|
# No leading whitespace
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue