Show
Ignore:
Timestamp:
01/18/10 16:45:34 (2 years ago)
Author:
apdavison
Message:

datastore key-generators now work properly if the component is the __main__ module.
Fixed a couple of rounding errors in signals.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/datastore/keygenerators.py

    r385 r443  
    22Key generators for data store objects 
    33""" 
    4 import hashlib, pickle 
     4import hashlib, pickle, sys, os.path 
    55 
    66def full_type(component): 
    77    """Returns a string representing the full type of the component.""" 
    88    if component.__class__.__name__ == 'module': # component is a module 
    9         return component.__name__ 
     9        if component.__name__ == "__main__": 
     10            return os.path.basename(sys.argv[0][:-3]) 
     11        else: 
     12            return component.__name__ 
    1013    else: 
    1114        return component.__module__ + '.' + component.__class__.__name__