Welcome to mirror list, hosted at ThFree Co, Russian Federation.

dev.gajim.org/gajim/gajim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorred-agent <hell.director@gmail.com>2009-09-13 01:22:17 +0400
committerred-agent <hell.director@gmail.com>2009-09-13 01:22:17 +0400
commitcae86299e496abbd2b09884d8eb8848fd3902428 (patch)
treea38588a84d06c247a6bef66881fa3c5f5a55f5ac
parent981572f79d95a66d3f99120381d96d34f2aabcae (diff)
Rolled in a bunch of fixes for the command system
-rw-r--r--src/chat_control.py2
-rw-r--r--src/commands/framework.py11
-rw-r--r--src/commands/middleware.py1
3 files changed, 5 insertions, 9 deletions
diff --git a/src/chat_control.py b/src/chat_control.py
index dc259dfbe..66e13114b 100644
--- a/src/chat_control.py
+++ b/src/chat_control.py
@@ -82,8 +82,6 @@ class ChatControlBase(MessageControl, CommonCommands):
'''A base class containing a banner, ConversationTextview, MessageTextView
'''
- DISPATCHED_BY = CommonCommands
-
def make_href(self, match):
url_color = gajim.config.get('urlmsgcolor')
return '<a href="%s"><span color="%s">%s</span></a>' % (match.group(),
diff --git a/src/commands/framework.py b/src/commands/framework.py
index c5a2fe84c..86e890db9 100644
--- a/src/commands/framework.py
+++ b/src/commands/framework.py
@@ -27,12 +27,11 @@ class CommandInternalError(Exception):
class CommandError(Exception):
def __init__(self, message=None, command=None, name=None):
+ self.command = command
+ self.name = name
+
if command:
- self.command = command
self.name = command.first_name
- elif name:
- self.command = None
- self.name = name
if message:
super(CommandError, self).__init__(message)
@@ -343,7 +342,7 @@ class CommandProcessor(object):
# Quite complex piece of regular expression logic.
ARG_PATTERN = re.compile(r'(\'|")?(?P<body>(?(1).+?|\S+))(?(1)\1)')
- OPT_PATTERN = re.compile(r'--?(?P<key>[\w-]+)(?:(?:=|\s)(\'|")?(?P<value>(?(2)[^-]+?|[^-\s]+))(?(2)\2))?')
+ OPT_PATTERN = re.compile(r'(?<!\w)--?(?P<key>[\w-]+)(?:(?:=|\s)(\'|")?(?P<value>(?(2)[^-]+?|[^-\s]+))(?(2)\2))?')
EXPAND_SHORT_OPTIONS = True
@@ -509,7 +508,7 @@ class CommandProcessor(object):
return False
text = text[len(self.COMMAND_PREFIX):]
- text = text.lstrip()
+ text = text.strip()
parts = text.split(' ', 1)
diff --git a/src/commands/middleware.py b/src/commands/middleware.py
index a0db07bdd..839c82c3e 100644
--- a/src/commands/middleware.py
+++ b/src/commands/middleware.py
@@ -19,7 +19,6 @@ would be dropped in. Defines a little bit of scaffolding to support interaction
between the two and a few utility methods so you don't need to dig up the host
code to write basic commands.
"""
-
from types import StringTypes
from framework import CommandProcessor, CommandError
from traceback import print_exc