summaryrefslogtreecommitdiff
path: root/indra/lib
diff options
context:
space:
mode:
authorKartic Krishnamurthy <drunkensufi@lindenlab.com>2008-11-07 00:07:44 +0000
committerKartic Krishnamurthy <drunkensufi@lindenlab.com>2008-11-07 00:07:44 +0000
commitb2bfb128e7d30e1cdb293a2ac192a0cbe63fe528 (patch)
tree29fbacff21395f53f5b029796f90a34638118fe9 /indra/lib
parent24ff4831f2a24045b3d06e81581dbe6d20475722 (diff)
Merged into release with command:
================================= svn merge -r100865:101402 svn+ssh://svn/svn/linden/branches/purge-dpo-code-for-merge . QAR-951 : Sandbox QA for DEV 20842 - Ensure DPO is not enabled accidentally QAR-967 : Merge Build for DEV 20842 - Ensure DPOis not enabled accidentally QA tested: Beast, Oskar DEV's fulfilled as part of this branch: ====================================== DEV-20842 Prevent accidental activation of DPO procs DEV-23028 Mac build fails - link error dual inclusion DEV-20824 VWR-9255: Build fails on mac_updater and mac_crash_logger targets due to info.plist problems DEV-22997 Xcode project: 'server' target has no dependencies DEV-23353 Friend request custom messages come through as an asset tag. DEV-23309 Voice Chat Indicator does not show active voice status DEV-23187 Can't teleport to home location
Diffstat (limited to 'indra/lib')
-rw-r--r--indra/lib/python/indra/util/named_query.py16
1 files changed, 11 insertions, 5 deletions
diff --git a/indra/lib/python/indra/util/named_query.py b/indra/lib/python/indra/util/named_query.py
index 1457ff2a30..e1f1ad2002 100644
--- a/indra/lib/python/indra/util/named_query.py
+++ b/indra/lib/python/indra/util/named_query.py
@@ -103,10 +103,11 @@ class NamedQuery(object):
def __init__(self, name, filename):
""" Construct a NamedQuery object. The name argument is an
arbitrary name as a handle for the query, and the filename is
- a path to a file containing an llsd named query document."""
+ a path to a file or a file-like object containing an llsd named
+ query document."""
self._stat_interval_seconds = 5 # 5 seconds
self._name = name
- if (filename is not None
+ if (filename is not None and isinstance(filename, (str, unicode))
and NQ_FILE_SUFFIX != filename[-NQ_FILE_SUFFIX_LEN:]):
filename = filename + NQ_FILE_SUFFIX
self._location = filename
@@ -122,8 +123,8 @@ class NamedQuery(object):
def get_modtime(self):
""" Returns the mtime (last modified time) of the named query
- file, if such exists."""
- if self._location:
+ filename. For file-like objects, expect a modtime of 0"""
+ if self._location and isinstance(self._location, (str, unicode)):
return os.path.getmtime(self._location)
return 0
@@ -131,7 +132,12 @@ class NamedQuery(object):
""" Loads and parses the named query file into self. Does
nothing if self.location is nonexistant."""
if self._location:
- self._reference_contents(llsd.parse(open(self._location).read()))
+ if isinstance(self._location, (str, unicode)):
+ contents = llsd.parse(open(self._location).read())
+ else:
+ # we probably have a file-like object. Godspeed!
+ contents = llsd.parse(self._location.read())
+ self._reference_contents(contents)
# Check for alternative implementations
try:
for name, alt in self._contents['alternative'].items():