~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to ivle/util.py

  • Committer: William Grant
  • Date: 2010-02-26 06:33:35 UTC
  • Revision ID: grantw@unimelb.edu.au-20100226063335-25ka31up8cegwaiz
ivle.interpret.execute_raw now sets a clean environment, in particular with HOME set correctly.

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
        # Incomplete
198
198
        return count
199
199
 
200
 
def object_to_dict(attrnames, obj):
201
 
    """Convert an object into a dictionary.
202
 
 
203
 
    This takes a shallow copy of the object.
204
 
 
205
 
    @param attrnames: Set (or iterable) of names of attributes to be copied
206
 
                      into the dictionary. (We don't auto-lookup, because this
207
 
                      function needs to be used on magical objects).
208
 
    """
209
 
    return dict((k, getattr(obj, k))
210
 
        for k in attrnames if not k.startswith('_'))
211
 
 
212
200
def safe_rmtree(path, ignore_errors=False, onerror=None):
213
201
    """Recursively delete a directory tree.
214
202