Django

Code

Changeset 5809

Show
Ignore:
Timestamp:
08/06/07 00:04:27 (1 year ago)
Author:
adrian
Message:

Fixed #5082 -- Enabled tab completion in 'django-admin.py shell' for objects that were imported into the global namespace at runtime. Thanks, dusk@woofle.net

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r5764 r5809  
    9797    Jeremy Dunck <http://dunck.us/> 
    9898    Andrew Durdin <adurdin@gmail.com> 
     99    dusk@woofle.net 
    99100    Andy Dustman <farcepest@gmail.com> 
    100101    Clint Ecker 
  • django/trunk/django/core/management.py

    r5803 r5809  
    13011301    except ImportError: 
    13021302        import code 
     1303        # Set up a dictionary to serve as the environment for the shell, so 
     1304        # that tab completion works on objects that are imported at runtime. 
     1305        # See ticket 5082. 
     1306        imported_objects = {} 
    13031307        try: # Try activating rlcompleter, because it's handy. 
    13041308            import readline 
     
    13091313            # we already know 'readline' was imported successfully. 
    13101314            import rlcompleter 
     1315            readline.set_completer(rlcompleter.Completer(imported_objects).complete) 
    13111316            readline.parse_and_bind("tab:complete") 
    1312         code.interact(
     1317        code.interact(local=imported_objects
    13131318run_shell.args = '[--plain]' 
    13141319 
     
    14251430                                (format, fixture_name, humanize(fixture_dir)) 
    14261431                        try: 
    1427                             objects = serializers.deserialize(format, fixture) 
     1432                            objects = serializers.deserialize(format, fixture) 
    14281433                            for obj in objects: 
    14291434                                count[0] += 1