Exemplo n.º 1
0
    def childDocument(self, doc):
        """
        """
        parent_form = self.getParentDatabase().getForm(doc.Plomino_Parent_Form)
        parent_field = parent_form.getFormField(doc.Plomino_Parent_Field)
        fields = parent_field.getSettings().field_mapping.split(',')

        raw_values = []
        for f in fields:
            v = doc.getItem(f)
            if hasattr(v, 'strftime'):
                raw_values.append(
                    DateToString(doc.getItem(f),
                                 self.getParentDatabase().getDateTimeFormat()))
            else:
                raw_values.append(v)

        html = """<div id="raw_values">%s</div>""" % json.dumps(raw_values)

        html = html + """<div id="parent_field">%s</div>""" % doc.Plomino_Parent_Field

        for f in fields:
            html = html + """<span id="%s" class="plominochildfield">%s</span>""" % (
                f, doc.getRenderedItem(f, form=self))

        return html
Exemplo n.º 2
0
 def rows(self, value, rendered=False):
     """
     """
     if value is None or value == "":
         value = []
     if isinstance(value, basestring):
         return value
     if isinstance(value, DateTime):
         value = DateToString(value)
     if isinstance(value, dict):
         if rendered:
             value = value['rendered']
         else:
             value = value['rawdata']
     return value
Exemplo n.º 3
0
 def rows(self, value, rendered=False):
     """
     """
     if value in [None, '']:
         value = []
     if isinstance(value, basestring):
         return value
     elif isinstance(value, DateTime):
         value = DateToString(value, '%Y-%m-%d')
     elif isinstance(value, dict):
         if rendered:
             value = value['rendered']
         else:
             value = value['rawdata']
     return value
Exemplo n.º 4
0
 def rows(self, value, rendered=False):
     """
     """
     if value in [None, '']:
         value = []
     if isinstance(value, basestring):
         return value
     elif isinstance(value, DateTime):
         db = self.context.getParentDatabase()
         value = DateToString(value, db=db)
         # TODO does anything require that format here?
         # value = DateToString(value, '%Y-%m-%d')
     elif isinstance(value, dict):
         if rendered:
             value = value['rendered']
         else:
             value = value['rawdata']
     return value