Back to index

plone3  3.1.7
Classes | Functions
CMFDiffTool.BaseDiff Namespace Reference

Classes

class  BaseDiff

Functions

def _getValue

Detailed Description

CMFDiffTool.py

   Calculate differences between content objects

Function Documentation

def CMFDiffTool.BaseDiff._getValue (   ob,
  field 
) [private]

Definition at line 46 of file BaseDiff.py.

00046 
00047 def _getValue(ob, field):
00048     # Check for the attribute without acquisition.  If it's there,
00049     # grab it *with* acquisition, so things like ComputedAttribute
00050     # will work
00051     if hasattr(aq_base(ob), field):
00052         value = getattr(ob, field)
00053     else:
00054         raise AttributeError, field
00055 
00056     # Handle case where the field is a method
00057     try:
00058         value = value()
00059     except (AttributeError, TypeError):
00060         pass
00061 
00062     # If this is some object, convert it to a string
00063     try:
00064         if isinstance(value, Acquisition.Implicit):
00065             value = str(value)
00066     except TypeError:
00067         pass
00068 
00069     return value
00070 
00071 InitializeClass(BaseDiff)

Here is the caller graph for this function: