Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/geocam/geocamUtilWeb
- Loading branch information
Showing
11 changed files
with
146 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
*.pyc | ||
*.swp | ||
*.swo | ||
dev.db | ||
local_settings.py | ||
media/ugc | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# __BEGIN_LICENSE__ | ||
# Copyright (C) 2008-2010 United States Government as represented by | ||
# the Administrator of the National Aeronautics and Space Administration. | ||
# All Rights Reserved. | ||
# __END_LICENSE__ | ||
|
||
from geocamUtil import anyjson as json | ||
|
||
|
||
def convertToDotDictRecurse(struct): | ||
if isinstance(struct, dict): | ||
for k, v in struct.iteritems(): | ||
struct[k] = convertToDotDictRecurse(v) | ||
return DotDict(struct) | ||
elif isinstance(struct, list): | ||
return [convertToDotDictRecurse(elt) for elt in struct] | ||
else: | ||
return struct | ||
|
||
|
||
class DotDict(dict): | ||
# At the moment this object exists pretty much solely to let you | ||
# get and set elements in its __dict__ dictionary via dotted | ||
# notation. Someday it could do more. | ||
|
||
# these are fields that must not be defined to avoid causing problems | ||
# with Django | ||
_badFields = ('prepare_database_save',) | ||
|
||
def __repr__(self): | ||
return json.dumps(self, sort_keys=True, indent=4) | ||
|
||
def __getattr__(self, attr): | ||
if attr in self._badFields: | ||
raise KeyError(attr) | ||
return self.get(attr, None) | ||
__setattr__ = dict.__setitem__ | ||
__delattr__ = dict.__delitem__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.