def __adduser(self): """create a user account""" assert self.url is not None if not self.url.isLocalHost: if not AddUserDialog(self.url, self.dlg.username, self.dlg.password).exec_(): raise CancelledError Players.createIfUnknown(self.username) adduserCmd = SERVERMARK.join( ['adduser', self.dlg.username, self.dlg.password]) return self.loginCommand(adduserCmd)
def srvMessage(*args): """ concatenate all args needed for m18n encoded in one string. For an explanation see util.translateServerMessage. @returns: The string to be wired. @rtype: C{str}, utf-8 encoded """ strArgs = [] for arg in args: if isinstance(arg, unicode): arg = arg.encode('utf-8') else: arg = str(arg).encode('utf-8') strArgs.append(arg) mark = SERVERMARK.encode() return mark + mark.join(strArgs) + mark
def srvMessage(*args): """ concatenate all args needed for i18n encoded in one string. For an explanation see util.translateServerMessage. @returns: The string to be wired. @rtype: C{str}, utf-8 encoded """ strArgs = [] for arg in args: if isinstance(arg, str): arg = arg.encode('utf-8') else: arg = str(arg).encode('utf-8') strArgs.append(arg) mark = SERVERMARK.encode() return mark + mark.join(strArgs) + mark