Package gavo :: Package base
[frames] | no frames]

Source Code for Package gavo.base

  1  """ 
  2  Basic code for defining objects in the data center: Structures, their  
  3  attributes, fundamental VO conventions. 
  4  """ 
  5   
  6  #c Copyright 2008-2019, the GAVO project 
  7  #c 
  8  #c This program is free software, covered by the GNU GPL.  See the 
  9  #c COPYING file in the source distribution. 
 10   
 11   
 12  # Not checked by pyflakes: API file with gratuitous imports 
 13   
 14  # This doesn't belong here and it should go away again, but right now, 
 15  # astLib has an issue in the de_DE (and probably other) locales. 
 16  import locale, os 
 17  os.environ["LC_ALL"] = 'C' 
 18  locale.setlocale(locale.LC_ALL, 'C') 
 19   
 20  from gavo.base import caches 
 21   
 22  from gavo.base.attrdef import * 
 23   
 24  from gavo.base.complexattrs import * 
 25   
 26  from gavo.base.config import( 
 27          get as getConfig, set as setConfig, 
 28          getDBProfile) 
 29   
 30  from gavo.base.events import EventDispatcher 
 31   
 32  from gavo.base.macros import (StandardMacroMixin, MacroPackage, 
 33          MacDefAttribute, MacroError, ExpansionDelegator) 
 34   
 35  ui = EventDispatcher() 
 36  del EventDispatcher 
 37   
 38  from gavo.utils import Undefined 
 39   
 40  from gavo.base.common import * 
 41   
 42  from gavo.base.literals import * 
 43   
 44  from gavo.base.meta import ( 
 45          MetaSyntaxError, MetaError, MetaCardError, NoMetaKey, 
 46          InfoItem as MetaInfoItem, 
 47          MetaMixin, ComputedMetaMixin, 
 48          MetaBuilder, 
 49          META_CLASSES_FOR_KEYS, 
 50          getMetaText) 
 51   
 52  from gavo.base.metavalidation import MetaValidationError, validateStructure 
 53   
 54  from gavo.base.observer import ObserverBase, listensTo 
 55   
 56  from gavo.base.osinter import (getGroupId, makeSharedDir, makeSitePath, 
 57          getBinaryName, makeAbsoluteURL, getVersion, sendMail, 
 58          openDistFile, getPathForDistFile, tryRemoteReload, 
 59          getHTTPBase, getHTTPSBase, getCurrentServerURL) 
 60   
 61  from gavo.base.parsecontext import ( 
 62          IdAttribute, OriginalAttribute, ReferenceAttribute, ParseContext, 
 63          ReferenceListAttribute, resolveId, resolveCrossId, resolveNameBased, 
 64          getTableDefForTable) 
 65   
 66  from gavo.base.sqlsupport import (getDBConnection,  
 67          DBError, QueryCanceledError, IntegrityError, 
 68          AdhocQuerier, UnmanagedQuerier, 
 69          savepointOn, 
 70          connectionConfiguration, 
 71          getUntrustedConn, 
 72          NullConnection, 
 73          getTableConn, getAdminConn, getUntrustedConn, 
 74          getWritableTableConn, getWritableAdminConn, getWritableUntrustedConn, 
 75          setDBMeta, getDBMeta, 
 76          NUMERIC_TYPES, ORDERED_TYPES) 
 77   
 78  from gavo.base.structure import (Structure, ParseableStructure,  
 79          DataContent, makeStruct, RestrictionMixin) 
 80   
 81   
 82  from gavo.base.typesystems import * 
 83   
 84  from gavo.base.valuemappers import (SerManager, ValueMapperFactoryRegistry, 
 85          VOTNameMaker, registerDefaultMF) 
 86   
 87  from gavo.base.sqlmunge import (getSQLForField, getSQLKey,  
 88          joinOperatorExpr) 
 89   
 90  from gavo.base.unitconv import ( 
 91          computeConversionFactor, parseUnit, computeColumnConversions, 
 92          IncompatibleUnits, BadUnit) 
 93   
 94  from gavo.base.xmlstruct import parseFromString, parseFromStream, feedTo 
 95   
 96  # preferred MIME type for VOTables we make 
 97  votableType = "application/x-votable+xml" 
 98   
 99  __version__ = getVersion() 
100   
101  # this flag is set by user.cli if a --debug flag was passed 
102  DEBUG = False 
103  # this flag is set by gavo serve if this is a long-running server process 
104  IS_DACHS_SERVER = False 
105