OpenQuizz
Une application de gestion des contenus pédagogiques
AutoReference Class Reference
Inheritance diagram for AutoReference:
Collaboration diagram for AutoReference:

Public Member Functions

def __init__ (self, db)
 
def will_copy (self)
 
def transform_incoming (self, son, collection)
 
def transform_outgoing (self, son, collection)
 

Data Fields

 database
 

Detailed Description

Transparently reference and de-reference already saved embedded objects.

This manipulator should probably only be used when the NamespaceInjector is
also being used, otherwise it doesn't make too much sense - documents can
only be auto-referenced if they have an *_ns* field.

NOTE: this will behave poorly if you have a circular reference.

TODO: this only works for documents that are in the same database. To fix
this we'll need to add a DatabaseInjector that adds *_db* and then make
use of the optional *database* support for DBRefs.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  db 
)

Member Function Documentation

◆ transform_incoming()

def transform_incoming (   self,
  son,
  collection 
)
Replace embedded documents with DBRefs.

Reimplemented from SONManipulator.

◆ transform_outgoing()

def transform_outgoing (   self,
  son,
  collection 
)
Replace DBRefs with embedded documents.

Reimplemented from SONManipulator.

◆ will_copy()

def will_copy (   self)
We need to copy so the user's document doesn't get transformed refs.

Reimplemented from SONManipulator.

Field Documentation

◆ database

database

The documentation for this class was generated from the following file: