Esempio n. 1
0
 def get(self, ident):
     prop = self.property_name
     if self._criterion:
         mapper = self._only_full_mapper_zero("get")
         # Don't use getattr/hasattr to check public existence, since this
         # might misinterpret a bug (AttributeError raised by some code in
         # property implementation) as missing attribute and cause all
         # private data going to public.
         if prop in dir(mapper.class_):
             crit = getattr(mapper.class_, prop)
             if crit is not None:
                 if not isinstance(crit, ClauseElement):
                     # This simplest safe way to make bare boolean column
                     # accepted as expression.
                     crit = cast(crit, Boolean)
                 if crit!=self._criterion:
                     # We can't verify that criterion is from our private()
                     # call.  Check from DB instead of looking in identity
                     # map.
                     assert False # XXX temporal to verify it's used
                     return Query.get(self.populate_existing(), ident)
         assert False # XXX temporal to verify it's used
     obj = Query.get(self, ident)
     if obj is not None and (prop not in dir(obj) or getattr(obj, prop)):
         return obj
Esempio n. 2
0
 def get(self, ident):
     prop = self.property_name
     if self._criterion:  # pragma: no cover
         mapper = self._only_full_mapper_zero("get")
         # Don't use getattr/hasattr to check public existence, since this
         # might misinterpret a bug (AttributeError raised by some code in
         # property implementation) as missing attribute and cause all
         # private data going to public.
         if prop in dir(mapper.class_):
             crit = getattr(mapper.class_, prop)
             if crit is not None:
                 if not isinstance(crit, ClauseElement):
                     # This simplest safe way to make bare boolean column
                     # accepted as expression.
                     crit = cast(crit, Boolean)
                 if crit != self._criterion:
                     # We can't verify that criterion is from our private()
                     # call.  Check from DB instead of looking in identity
                     # map.
                     assert False  # XXX temporal to verify it's used
                     return Query.get(self.populate_existing(), ident)
         assert False  # XXX temporal to verify it's used
     obj = Query.get(self, ident)
     if obj is not None and (prop not in dir(obj) or getattr(obj, prop)):
         return obj
Esempio n. 3
0
File: meta.py Progetto: clld/clld
 def get(self, ident):
     # override get() so that the flag is always checked in the
     # DB as opposed to pulling from the identity map.
     return Query.get(self.populate_existing(), ident)
Esempio n. 4
0
 def get(self, ident):
     obj = Query.get(self, ident)
     if obj is not None and getattr(obj, 'public', True):
         return obj
Esempio n. 5
0
 def get(self, ident):
     # override get() so that the flag is always checked in the
     # DB as opposed to pulling from the identity map. - this is optional.
     return Query.get(self.populate_existing(), ident)
Esempio n. 6
0
 def get(self, ident):
     obj = Query.get(self, ident)
     if obj is not None and getattr(obj, 'public', True):
         return obj