def base_create_dep_objs(cls): """ Create all objects that FileKeyValue need. """ cite = Citations() TestCitations.base_create_dep_objs() cite.from_hash(SAMPLE_CITATION_HASH) cite.save(force_insert=True)
def base_create_dep_objs(cls): """ Create all objects that Files depend on. """ cite1 = Citations() TestCitations.base_create_dep_objs() cite1.from_hash(SAMPLE_CITATION_HASH) cite1.save(force_insert=True) contrib = Contributors() TestContributors.base_create_dep_objs() contrib.from_hash(SAMPLE_CONTRIBUTOR_HASH) contrib.save(force_insert=True)
def base_create_dep_objs(cls): """ Create all objects that FileKeyValue need. """ prop1 = Proposals() TestProposals.base_create_dep_objs() prop1.from_hash(SAMPLE_PROPOSAL_HASH) prop1.save(force_insert=True) cite = Citations() TestCitations.base_create_dep_objs() cite.from_hash(SAMPLE_CITATION_HASH) cite.save(force_insert=True)
def from_hash(self, obj): """Convert the hash into the object.""" super(CitationProposal, self).from_hash(obj) if 'citation_id' in obj: self.citation = Citations.get(Citations.id == obj['citation_id']) if 'proposal_id' in obj: self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
def from_hash(self, obj): """ Converts the hash into the object """ super(CitationProposal, self).from_hash(obj) if 'citation_id' in obj: self.citation = Citations.get(Citations.id == obj['citation_id']) if 'proposal_id' in obj: self.proposal = Proposals.get(Proposals.id == obj['proposal_id'])
def from_hash(self, obj): """Convert the hash into the object.""" super(CitationKeyword, self).from_hash(obj) self._set_only_if( 'citation_id', obj, 'citation', lambda: Citations.get(Citations.id == obj['citation_id'])) self._set_only_if( 'keyword_id', obj, 'keyword', lambda: Keywords.get(Keywords.id == obj['keyword_id']))
def from_hash(self, obj): """Convert the hash into the object.""" super(CitationContributor, self).from_hash(obj) if 'citation_id' in obj: self.citation = Citations.get(Citations.id == obj['citation_id']) if 'author_id' in obj: self.author = Contributors.get(Contributors.id == obj['author_id']) if 'author_precedence' in obj: self.author_precedence = int(obj['author_precedence'])
def where_clause(self, kwargs): """Where clause for the various elements.""" where_clause = super(CitationProposal, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(CitationProposal.citation, OP.EQ, citation) if 'proposal_id' in kwargs: proposal = Proposals.get(Proposals.id == kwargs['proposal_id']) where_clause &= Expression(CitationProposal.proposal, OP.EQ, proposal) return where_clause
def where_clause(self, kwargs): """Where clause for the various elements.""" where_clause = super(CitationKeyword, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(CitationKeyword.citation, OP.EQ, citation) if 'keyword_id' in kwargs: keyword = Keywords.get(Keywords.id == kwargs['keyword_id']) where_clause &= Expression(CitationKeyword.keyword, OP.EQ, keyword) return where_clause
def from_hash(self, obj): """ Converts the hash into the object """ super(CitationContributor, self).from_hash(obj) if 'citation_id' in obj: self.citation = Citations.get(Citations.id == obj['citation_id']) if 'author_id' in obj: self.author = Contributors.get(Contributors.id == obj['author_id']) if 'author_precedence' in obj: self.author_precedence = int(obj['author_precedence'])
def where_clause(self, kwargs): """ Where clause for the various elements. """ where_clause = super(CitationProposal, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(CitationProposal.citation, OP.EQ, citation) if 'proposal_id' in kwargs: proposal = Proposals.get(Proposals.id == kwargs['proposal_id']) where_clause &= Expression(CitationProposal.proposal, OP.EQ, proposal) return where_clause
def where_clause(self, kwargs): """ Where clause for the various elements. """ where_clause = super(CitationContributor, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(CitationContributor.citation, OP.EQ, citation) if 'person_id' in kwargs: author = Contributors.get(Contributors.id == kwargs['author_id']) where_clause &= Expression(CitationContributor.author, OP.EQ, author) if 'author_precedence' in kwargs: auth_prec = int(kwargs['author_precedence']) where_clause &= Expression(CitationContributor.author_precedence, OP.EQ, auth_prec) return where_clause
def where_clause(self, kwargs): """ Where clause for the various elements. """ where_clause = super(Keywords, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(Keywords.citation, OP.EQ, citation) if '_id' in kwargs: where_clause &= Expression(Keywords.id, OP.EQ, kwargs['_id']) if 'encoding' in kwargs: where_clause &= Expression(Keywords.encoding, OP.EQ, kwargs['encoding']) if 'keyword' in kwargs: where_clause &= Expression(Keywords.keyword, OP.EQ, kwargs['keyword']) return where_clause
def from_hash(self, obj): """ Converts the hash to the object """ super(Keywords, self).from_hash(obj) if '_id' in obj: # pylint: disable=invalid-name self.id = obj['_id'] # pylint: enable=invalid-name if 'keyword' in obj: self.keyword = unicode(obj['keyword']) if 'encoding' in obj: self.encoding = str(obj['encoding']) if 'citation_id' in obj: self.citation = Citations.get(Citations.id == obj['citation_id'])
def base_create_dep_objs(cls): """Create all objects that Files depend on.""" cite1 = Citations() TestCitations.base_create_dep_objs() cite1.from_hash(SAMPLE_CITATION_HASH) cite1.save(force_insert=True) contrib = Contributors() TestContributors.base_create_dep_objs() contrib.from_hash(SAMPLE_CONTRIBUTOR_HASH) contrib.save(force_insert=True)
def base_create_dep_objs(cls): """Create all objects that Files depend on.""" keyword = Keywords() TestKeywords.base_create_dep_objs() keyword.from_hash(SAMPLE_KEYWORD_HASH) keyword.save(force_insert=True) cite1 = Citations() TestCitations.base_create_dep_objs() cite1.from_hash(SAMPLE_CITATION_HASH) cite1.save(force_insert=True)
def base_create_dep_objs(cls): """Create all objects that FileKeyValue need.""" prop1 = Proposals() TestProposals.base_create_dep_objs() prop1.from_hash(SAMPLE_PROPOSAL_HASH) prop1.save(force_insert=True) cite = Citations() TestCitations.base_create_dep_objs() cite.from_hash(SAMPLE_CITATION_HASH) cite.save(force_insert=True)
def where_clause(self, kwargs): """Where clause for the various elements.""" where_clause = super(CitationContributor, self).where_clause(kwargs) if 'citation_id' in kwargs: citation = Citations.get(Citations.id == kwargs['citation_id']) where_clause &= Expression(CitationContributor.citation, OP.EQ, citation) if 'author_id' in kwargs: author = Contributors.get(Contributors.id == kwargs['author_id']) where_clause &= Expression(CitationContributor.author, OP.EQ, author) if 'author_precedence' in kwargs: auth_prec = int(kwargs['author_precedence']) where_clause &= Expression(CitationContributor.author_precedence, OP.EQ, auth_prec) return where_clause