Commits

Marcin Kasperski committed a652adb

Fixed possible issue with make_tell_command parameters (mutable parameter
used as default argument).

Comments (0)

Files changed (1)

src/mekk/fics/tell_commands/fics_client_mixin_tell_commands.py

 #        logger.info(msg + failure.getBriefTraceback())
 #        context.getTellMaker().templatedShortTell(who, tmpl, args)
 
-def make_tell_command(callable, name, name_aliases = [],
-                      named_parameters=[],
+def make_tell_command(callable,
+                      name,
+                      name_aliases = None,
+                      named_parameters=None,
                       min_positional_parameter_count = 0,
                       max_positional_parameter_count = 0,
                       help_text = ""):
     """
     Creating tell command without subclassing
     """
+    if not name_aliases:
+        name_aliases = []
+    if not named_parameters:
+        named_parameters = []
     cls = type('DynCmd' + name, (object,), {
         'name': lambda self: name,
         'name_aliases': lambda self: name_aliases,
         'positional_parameters_count': lambda self: (min_positional_parameter_count, max_positional_parameter_count),
         'named_parameters': lambda self: named_parameters,
-        'run': lambda self, client, player, *args, **kwargs: callable(client, player, *args, **kwargs),
+        'run': lambda self, client, player, *args, **kwargs: callable(
+            client, player, *args, **kwargs),
         'help': lambda self, client: help_text,
         })
     return cls()