def _validate_location(self): # ---- make sure code and server are valid # first, set the server value in the environment server_var = DpaVars.data_server() server_var.value = self.server server_var.set() # now query the location code try: location = Location.get(self.code) except ActionError as e: raise ActionError( "Unable to verify location: " + self.code + "\n" + str(e) ) return location
def __init__(self, data_server=None): if data_server is None: from dpa.env.vars import DpaVars self.data_server = DpaVars.data_server().get() else: self.data_server = data_server