Changeset 116

Show
Ignore:
Timestamp:
04/07/08 15:04:37 (4 years ago)
Author:
phil
Message:

changed rdfSingle to throw an error if it is passed a list to __set__

Location:
rdfalchemy/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • rdfalchemy/trunk/rdfalchemy/descriptors.py

    r108 r116  
    146146        log.debug("SET with descriptor value %s of type %s"%(value,type(value))) 
    147147        #setattr(obj, self.name, value)  #this recurses indefinatly 
     148        if isinstance(value,(list,tuple,set)): 
     149            raise AttributeError("to set an rdfSingle you must pass in a single value") 
    148150        obj.__dict__[self.name]= value 
    149151        o =value2object(value) 
     
    180182    def __set__(self, obj, newvals): 
    181183        log.debug("SET with descriptor value %s of type %s"%(newvals,type(newvals))) 
    182         if not isinstance(newvals, list): 
    183             raise AttributeError("to set a rdfMulti you must pass in a list (it can be a list of one)") 
     184        if not isinstance(newvals, (list,tuple)): 
     185            raise AttributeError("to set a rdfMultiple you must pass in a list (it can be a list of one)") 
    184186        try: 
    185187            oldvals = obj.__dict__[self.name] 
     
    231233    def __set__(self, obj, newvals): 
    232234        log.debug("SET with descriptor value %s of type %s"%(newvals,type(newvals))) 
    233         if not isinstance(newvals, list): 
     235        if not isinstance(newvals, (list,tuple)): 
    234236            raise AttributeError("to set a rdfList you must pass in a list (it can be a list of one)") 
    235237        try: 
     
    301303    def __set__(self, obj, newvals): 
    302304        log.debug("SET with descriptor value %s of type %s"%(newvals,type(newvals))) 
    303         if not isinstance(newvals, list): 
     305        if not isinstance(newvals, (list,tuple)): 
    304306            raise AttributeError("to set a rdfList you must pass in a list (it can be a list of one)") 
    305307        seq = obj.db.value(obj.resUri, self.pred) 
  • rdfalchemy/trunk/test/sesame2_test.py

    r108 r116  
    11from rdfalchemy.sesame2 import SesameGraph 
    22 
    3 url = 'http://www.openvest.com:8080/sesame/repositories/Portfolio/' 
     3url = 'http://www.openvest.com:8080/openrdf-sesame/repositories/Portfolio/' 
    44g = SesameGraph(url) 
    55 
    6 q1 = "select ?s ?p ?o where {?s ?p ?o}" 
     6q1 = "select ?s ?p ?o where {?s ?p ?o} limit 100" 
    77 
    88responses = {}