def add(self, resource, replace=False):
        """Add a single resource, check for dupes."""
        uri = resource.uri
        for r in self:
            if (uri == r.uri):
                if (replace):
                    r = resource
                    return
                else:
                    raise ResourceListDupeError(
                        "Attempt to add resource already in resource_list")
        # didn't find it in list, add to end
        self.append(resource)
def add ( self , resource , replace = False ) : uri = resource . uri for r in self : if ( uri == r . uri ) : if ( replace ) : r = resource return else : raise ResourceListDupeError ( "Attempt to add resource already in resource_list" ) self . append ( resource )
Add a single resource, check for dupes.