]> jfr.im git - z_archive/twitter.git/commitdiff
More misc cleanup
authorMike Verdone <redacted>
Thu, 2 Apr 2009 03:04:53 +0000 (21:04 -0600)
committerMike Verdone <redacted>
Thu, 2 Apr 2009 03:07:05 +0000 (21:07 -0600)
twitter/cmdline.py

index a76a48a71379c303c244a6027920263513bcad2a..7271c41a4f49d1afb16f550cbb428abcafdd8447 100644 (file)
@@ -204,8 +204,8 @@ def get_admin_formatter(options):
     return sf()
 
 class Action(object):
-    @staticmethod
-    def ask(subject='perform this action', careful=False):
+
+    def ask(self, subject='perform this action', careful=False):
         '''
         Requests fromt he user using `raw_input` if `subject` should be
         performed. When `careful`, the default answer is NO, otherwise YES.
@@ -271,7 +271,7 @@ class StatusAction(Action):
 
 class AdminAction(Action):
     def __call__(self, twitter, options):
-        if not options['extra_args'] or options['extra_args'][0]:
+        if not (options['extra_args'] and options['extra_args'][0]):
             raise TwitterError("You need to specify a user (screen name)")
         af = get_admin_formatter(options)
         try:
@@ -316,8 +316,8 @@ class SetStatusAction(Action):
         twitter.statuses.update(status=status)
 
 class TwitterShell(Action):
-    @staticmethod
-    def render_prompt(prompt):
+
+    def render_prompt(self, prompt):
         '''Parses the `prompt` string and returns the rendered version'''
         prompt = prompt.strip("'").replace("\\'","'")
         for colour in ansi.COLOURS_NAMED:
@@ -326,9 +326,11 @@ class TwitterShell(Action):
                             '[%s]' %(colour), ansi.cmdColourNamed(colour))
         prompt = prompt.replace('[R]', ansi.cmdReset())
         return prompt
+    
     def __call__(self, twitter, options):
         prompt = self.render_prompt(options.get('prompt', 'twitter> '))
         while True:
+            options['action'] = ""
             try:
                 args = raw_input(prompt).split()
                 parse_args(args, options)