mirror of
https://github.com/evennia/evennia.git
synced 2026-03-16 21:06:30 +01:00
Port a few miscellaneous items.
This commit is contained in:
parent
b5cf27fc18
commit
ee58e59e7e
3 changed files with 7 additions and 6 deletions
|
|
@ -7,7 +7,6 @@ make sure to homogenize self.caller to always be the account object
|
|||
for easy handling.
|
||||
|
||||
"""
|
||||
from past.builtins import cmp
|
||||
from django.conf import settings
|
||||
from evennia.comms.models import ChannelDB, Msg
|
||||
from evennia.accounts.models import AccountDB
|
||||
|
|
@ -711,7 +710,7 @@ class CmdPage(COMMAND_DEFAULT_CLASS):
|
|||
|
||||
if not self.args or not self.rhs:
|
||||
pages = pages_we_sent + pages_we_got
|
||||
pages.sort(lambda x, y: cmp(x.date_created, y.date_created))
|
||||
pages = sorted(pages, key=lambda page: page.date_created)
|
||||
|
||||
number = 5
|
||||
if self.args:
|
||||
|
|
|
|||
|
|
@ -753,7 +753,9 @@ def initialize_nick_templates(in_template, out_template):
|
|||
# create the regex for in_template
|
||||
regex_string = fnmatch.translate(in_template)
|
||||
# we must account for a possible line break coming over the wire
|
||||
regex_string = regex_string[:-7] + r"(?:[\n\r]*?)\Z(?ms)"
|
||||
|
||||
# NOTE-PYTHON3: fnmatch.translate format changed since Python2
|
||||
regex_string = regex_string[:-2] + r"(?:[\n\r]*?)\Z"
|
||||
|
||||
# validate the templates
|
||||
regex_args = [match.group(2) for match in _RE_NICK_ARG.finditer(regex_string)]
|
||||
|
|
|
|||
|
|
@ -708,7 +708,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
|||
if not isinstance(string, str):
|
||||
string = string.decode('utf-8')
|
||||
|
||||
ansi_string = super(ANSIString, cls).__new__(ANSIString, to_str(clean_string), "utf-8")
|
||||
ansi_string = super(ANSIString, cls).__new__(ANSIString, to_str(clean_string))
|
||||
ansi_string._raw_string = string
|
||||
ansi_string._clean_string = clean_string
|
||||
ansi_string._code_indexes = code_indexes
|
||||
|
|
@ -716,7 +716,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
|||
return ansi_string
|
||||
|
||||
def __str__(self):
|
||||
return self._raw_string.encode('utf-8')
|
||||
return self._raw_string
|
||||
|
||||
def __unicode__(self):
|
||||
"""
|
||||
|
|
@ -849,7 +849,7 @@ class ANSIString(with_metaclass(ANSIMeta, str)):
|
|||
if not slice_indexes:
|
||||
return ANSIString('')
|
||||
try:
|
||||
string = self[slc.start]._raw_string
|
||||
string = self[slc.start or 0]._raw_string
|
||||
except IndexError:
|
||||
return ANSIString('')
|
||||
last_mark = slice_indexes[0]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue