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):
     """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']))
Ejemplo n.º 3
0
 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 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 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
Ejemplo n.º 9
0
 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
Ejemplo n.º 10
0
 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 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
Ejemplo n.º 12
0
 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