Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(368)  |  Call(320)  |  Derive(0)  |  Import(48)

src/p/y/pyon-HEAD/pyon/datastore/couchbase/base_store.py   pyon(Download)
from pyon.datastore.couchdb.couch_common import AbstractCouchDataStore
from pyon.datastore.couchbase.views import get_couch_view_designs
from pyon.core.exception import BadRequest, Conflict, NotFound, ServerError
from pyon.util.containers import get_safe, DictDiffer
 
    def __init__(self, datastore_name=None, config=None, scope=None, profile=None, **kwargs):
        super(CouchbaseDataStore, self).__init__(datastore_name=datastore_name, config=config, scope=scope, profile=profile)
 
        if self.config.get("type", None) and self.config['type'] != "couchbase":
            raise BadRequest("Datastore server config is not couchbase: %s" % self.config)
        if self.datastore_name and self.datastore_name != self.datastore_name.lower():
            raise BadRequest("Invalid Couchbase datastore name: '%s'" % self.datastore_name)
        if self.scope and self.scope != self.scope.lower():
            raise BadRequest("Invalid Couchbase scope name: '%s'" % self.scope)
            return ds, ds_name
        except ValueError:
            raise BadRequest("Datastore name '%s' invalid" % ds_name)
 
    def _create_datastore(self, datastore_name):

src/p/y/pyon-HEAD/pyon/ion/resregistry.py   pyon(Download)
from pyon.core import bootstrap
from pyon.core.bootstrap import IonObject, CFG
from pyon.core.exception import BadRequest, NotFound, Inconsistent
from pyon.core.object import IonObjectBase
from pyon.core.registry import getextends
        """
        if object is None:
            raise BadRequest("Object not present")
        if not isinstance(object, IonObjectBase):
            raise BadRequest("Object is not an IonObject")
        if not is_resource(object):
            raise BadRequest("Object is not a Resource")
        if "_id" in object:
            raise BadRequest("Object must not contain _id")

src/p/y/pyon-HEAD/pyon/datastore/couchdb/base_store.py   pyon(Download)
from pyon.datastore.couchdb.couch_common import AbstractCouchDataStore
from pyon.datastore.couchdb.views import get_couchdb_view_designs
from pyon.core.exception import BadRequest, Conflict, NotFound
from pyon.util.containers import get_safe, DictDiffer
 
    def __init__(self, datastore_name=None, config=None, scope=None, profile=None, **kwargs):
        super(CouchDataStore, self).__init__(datastore_name=datastore_name, config=config, scope=scope, profile=profile)
 
        if self.config.get("type", None) and self.config['type'] != "couchdb":
            raise BadRequest("Datastore server config is not couchdb: %s" % self.config)
        if self.datastore_name and self.datastore_name != self.datastore_name.lower():
            raise BadRequest("Invalid CouchDB datastore name: '%s'" % self.datastore_name)
        if self.scope and self.scope != self.scope.lower():
            raise BadRequest("Invalid CouchDB scope name: '%s'" % self.scope)
            raise NotFound("Datastore '%s' does not exist" % datastore_name)
        except ValueError:
            raise BadRequest("Datastore name '%s' invalid" % datastore_name)
        except ServerError as se:
            raise BadRequest("Data store name %s invalid" % datastore_name)

src/p/y/pyon-HEAD/pyon/datastore/couchdb/couchdb_standalone.py   pyon(Download)
from couchdb.http import PreconditionFailed, ResourceConflict, ResourceNotFound, ServerError
 
from pyon.core.exception import BadRequest, Conflict, NotFound
from pyon.util.containers import get_safe, DictDiffer
 
            datastore_name = self.datastore_name
        else:
            raise BadRequest("No data store name provided")
        return datastore_name
 
            raise NotFound("Data store '%s' does not exist" % datastore_name)
        except ValueError:
            raise BadRequest("Data store name '%s' invalid" % datastore_name)
        except ServerError as se:
            raise BadRequest("Data store name %s invalid" % datastore_name)
            self.server.create(datastore_name)
        except PreconditionFailed:
            raise BadRequest("Data store with name %s already exists" % datastore_name)
        except ValueError:
            raise BadRequest("Data store name %s invalid" % datastore_name)

src/p/y/pyon-HEAD/pyon/agent/agent.py   pyon(Download)
# Pyon exceptions.
from pyon.core.exception import IonException
from pyon.core.exception import BadRequest
from pyon.core.exception import Conflict
from pyon.core.exception import NotFound
                getattr(self, key)
            except (TypeError, AttributeError):
                ex = BadRequest('Bad agent parameter: %s', str(x))
                self._on_command_error('get_agent', None, [params], None, ex)
 
 
            except (TypeError, AttributeError):
                ex = BadRequest('Bad agent parameter: %s', str(x))
                self._on_command_error('set_agent', None, [params], None, ex)
 
        """
        if not command or not command.command:
            ex = BadRequest('Execute argument "command" not set.')
            self._on_command_error('execute_agent', None, None, None, ex)
 
 
        else:
            iex = BadRequest('Invalid type to set agent parameter "example".')
            self._on_command_error('aparam_set_example', None, val, None, iex)
 

src/p/y/pyon-HEAD/pyon/datastore/postgresql/base_store.py   pyon(Download)
from ooi.logging import log
 
from pyon.core.exception import BadRequest, Conflict, NotFound, Inconsistent
from pyon.datastore.datastore_common import DataStore
from pyon.datastore.datastore_query import DQ
                    log.info("Force disconnected %s user sessions", cur.rowcount)
                except Exception as ex:
                    raise BadRequest("Could disconnected users from database '%s': %s" % (database_name, ex))
 
    @classmethod
                    log.info("Dropped database '%s'", database_name)
                except Exception as ex:
                    raise BadRequest("Could not drop database '%s': %s" % (database_name, ex))
                # @TODO: Check whether drop was successful or timed out
                #    raise BadRequest("Could not drop database '%s'" % database_name)
            qual_ds_name = TABLE_PREFIX + self.datastore_name
        else:
            raise BadRequest("No datastore name provided")
 
        if qual_ds_name.lower() != qual_ds_name:
            raise BadRequest("Datastore name must be lower case")

src/p/y/pyon-HEAD/pyon/datastore/postgresql/datastore.py   pyon(Download)
 
from pyon.core.bootstrap import get_obj_registry, CFG
from pyon.core.exception import BadRequest, Conflict, NotFound, Inconsistent
from pyon.core.object import IonObjectBase, IonObjectSerializer, IonObjectDeserializer
from pyon.datastore.postgresql.base_store import PostgresDataStore
        """
        if not isinstance(obj, IonObjectBase):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.create_doc(self._ion_object_to_persistence_dict(obj),
    def create_mult(self, objects, object_ids=None, allow_ids=None):
        if any([not isinstance(obj, IonObjectBase) for obj in objects]):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.create_doc_mult([self._ion_object_to_persistence_dict(obj) for obj in objects], object_ids)
 
 
    def update(self, obj, datastore_name=""):
        if not isinstance(obj, IonObjectBase):
            raise BadRequest("Obj param is not instance of IonObjectBase")
    def update_mult(self, objects):
        if any([not isinstance(obj, IonObjectBase) for obj in objects]):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.update_doc_mult([self._ion_object_to_persistence_dict(obj) for obj in objects])

src/p/y/pyon-HEAD/pyon/datastore/couchdb/pyon_store.py   pyon(Download)
import simplejson as json
from pyon.core.bootstrap import get_obj_registry
from pyon.core.exception import BadRequest, Conflict, NotFound
from pyon.core.object import IonObjectBase, IonObjectSerializer, IonObjectDeserializer
from pyon.datastore.couchdb.couch_common import AbstractCouchDataStore
        """
        if not isinstance(obj, IonObjectBase):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.create_doc(self._ion_object_to_persistence_dict(obj),
    def create_mult(self, objects, object_ids=None, allow_ids=None):
        if any([not isinstance(obj, IonObjectBase) for obj in objects]):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.create_doc_mult([self._ion_object_to_persistence_dict(obj) for obj in objects], object_ids)
 
 
    def update(self, obj, datastore_name=""):
        if not isinstance(obj, IonObjectBase):
            raise BadRequest("Obj param is not instance of IonObjectBase")
    def update_mult(self, objects):
        if any([not isinstance(obj, IonObjectBase) for obj in objects]):
            raise BadRequest("Obj param is not instance of IonObjectBase")
 
        return self.update_doc_mult([self._ion_object_to_persistence_dict(obj) for obj in objects])

src/p/y/pyon-HEAD/pyon/ion/resource.py   pyon(Download)
from pyon.core.registry import getextends, issubtype, is_ion_object, isenum
from pyon.core.bootstrap import IonObject
from pyon.core.exception import BadRequest, NotFound, Inconsistent, Unauthorized
from pyon.util.config import Config
from pyon.util.containers import DotDict, named_any, get_ion_ts
def lcstate(maturity, availability):
    """Creates a composite lcstate and availability string"""
    if not maturity and maturity not in LCS:
        return BadRequest("lcstate maturity %s unknown" % maturity)
    if not availability and availability not in AS:
        return BadRequest("lcstate availability %s unknown" % availability)
        """
        if some_state and "_" in some_state:
            raise BadRequest("Compound lcstates are obsolete")
        return {evt: targ for (src, evt), targ in self.lcstate_transitions.iteritems() if src == some_state}
 
        """
        if some_state and "_" in some_state:
            raise BadRequest("Compound lcstates are obsolete")
        return {evt: targ for (src, evt), targ in self.availability_transitions.iteritems() if src == some_state}
 

src/p/y/pyon-HEAD/pyon/core/governance/negotiation.py   pyon(Download)
from pyon.core.bootstrap import IonObject
from pyon.core.registry import issubtype
from pyon.core.exception import  Inconsistent, NotFound, BadRequest
from pyon.ion.resource import RT, PRED, OT
from interface.objects import ProposalStatusEnum, NegotiationTypeEnum, ProposalOriginatorEnum, NegotiationStatusEnum
    def create_counter_proposal(self,negotiation=None, proposal_status=ProposalStatusEnum.COUNTER,
                                originator=ProposalOriginatorEnum.CONSUMER):
 
        if negotiation is None or negotiation.type_ != RT.Negotiation:
            raise BadRequest('The negotiation parameter must be a valid Negotiation object')
    def read_negotiation(self, sap=None):
 
        if sap is None or ( sap.type_ != OT.ServiceAgreementProposal and not issubtype(sap.type_, OT.ServiceAgreementProposal)):
            raise BadRequest('The sap parameter must be a valid Service Agreement Proposal object')
 
        if not sap.negotiation_id:
            raise BadRequest('The Service Agreement Proposal object (sap) is missing a negotiation_id value')
    def create_negotiation(self, sap=None):
 
        if sap is None or ( sap.type_ != OT.ServiceAgreementProposal and not issubtype(sap.type_, OT.ServiceAgreementProposal)):
            raise BadRequest('The sap parameter must be a valid Service Agreement Proposal object')
 

  1 | 2 | 3 | 4 | 5  Next