On Thu, Apr 7, 2011 at 3:10 AM, Hamdy <hfa...@cloud9ers.com> wrote:
> Hi,
>
> I'm having a case in which I'm making an admin command that takes some
> options
> This's great and works just fine
> the problem appears when trying to call another command from within
> the first
>
> option_list = BaseCommand.option_list + (
>        make_option('--host',
>                             default='127.0.0.1'), )
>
>    def handle(self, *args, **options):
>        # change some settings
>        call_command('test', *args, **options)   # Here's the problem
>        #call_command('test', *args, **options) # This didn't help too
>
> the test command has no --host and thus we get an error that test
> command has no test option
> Any ideas how to overcome this ?

Can you just take 'host' out of the options dictionary?

def handle(self, *args, **options):
    self.host = options.pop('host') # 'host' isn't in options anymore
   # do some more stuff
    call_command('test', *args, **options)


-- 
Regards,
Ian Clelland
<clell...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to