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

All Samples(9)  |  Call(6)  |  Derive(0)  |  Import(3)

src/p/y/pyon-HEAD/pyon/ion/resource.py   pyon(Download)
import time
 
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
def is_resource(object):
    """Returns true if the given object is a resource (i.e. a sub-type of Resource)"""
    return issubtype(object.type_, "Resource")
 
 
            log.error('The requested extended resource %s does not contain an OriginResourceType decorator.' , extended_resource_type)
 
        elif originResourceType != resource_object.type_ and not issubtype(resource_object.type_, originResourceType):
            raise Inconsistent('The OriginResourceType decorator of the requested resource %s(%s) does not match the type of the specified resource id(%s).' % (
                extended_resource_type, originResourceType, resource_object.type_))
            resource_object = self._rr.read(resource_id)
 
            if origin_resource_type != resource_object.type_ and not issubtype(resource_object.type_, origin_resource_type):
                raise Inconsistent('The OriginResourceType decorator of the requested resource %s(%s) does not match the type of the specified resource id(%s).' % (
                    prepare_resource_type, origin_resource_type, resource_object.type_))

src/p/y/pyon-HEAD/pyon/core/object.py   pyon(Download)
            for content_type in split_content_types:
                #First check for valid ION types
                from pyon.core.registry import issubtype
                if isinstance(value, dict) and value.has_key('type_'):
                    if value['type_'] == content_type.strip() or issubtype(value['type_'], content_type.strip()):

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
    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')
 
    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')