CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
querying.factory Class Reference

Public Member Functions

def __init__
 
def object
 

Public Attributes

 connection
 

Detailed Description

Definition at line 319 of file querying.py.

Constructor & Destructor Documentation

def querying.factory.__init__ (   self,
  connection 
)

Definition at line 321 of file querying.py.

322  def __init__(self, connection):
323  self.connection = connection

Member Function Documentation

def querying.factory.object (   self,
  class_name,
  pkargs 
)

Definition at line 327 of file querying.py.

References data.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer.createObject(), Vispa.Views.LineDecayView.LineDecayContainer.delete(), Vispa.Views.LineDecayView.DecayLine.delete(), Vispa.Views.LineDecayView.LineDecayContainer.mouseReleaseEvent(), and Vispa.Views.BoxDecayView.BoxDecayContainer.toggleCollapse().

328  def object(self, class_name, **pkargs):
329  from data_sources import json_list
330  model = self.connection.model(class_name)
331  if self.connection.session == None:
332  return None
333  model_data = self.connection.session.query(model)
334  if len(pkargs.items()) != 0:
335  for pk in pkargs:
336  if pkargs[pk].__class__ != list:
337  if pkargs[pk].__class__ == json_list:
338  pkargs[pk] = pkargs[pk].data()
339  else:
340  pkargs[pk] = [pkargs[pk]]
341  model_data = model_data.filter(model.__dict__[pk].in_(pkargs[pk]))
342  if model_data.count() > 1:
343  return json_list(model_data.all())
344  elif model_data.count() == 1:
345  return model_data.first()
346  else:
347  return None
348  else:
349  new_object = model()
350  new_object.empty = True
351  return new_object
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

querying.factory.connection

Definition at line 322 of file querying.py.

Referenced by testing_classes.querying_tests.test_check_connection(), and testing_classes.data_formats_tests.test_dicts_to_orm_objects().