예제 #1
0
 def as_xml(self, transclude_xml=False, **kwargs):
     fields_element = OUT('fields')
     row_element = OUT('row', fields_element, id=text_type(self.id))
     for field in self.fields.values():
         try:
             data = self._data[field.name]
         except KeyError:
             pass
         else:
             fields_element.append(field.as_xml(self, data, **kwargs))
     if transclude_xml and self.is_file and self._data.get(
             'DocIcon') == 'xml':
         try:
             content = etree.parse(self.open()).getroot()
         except HTTPError:
             content_element = OUT('content', missing='true')
         else:
             content_element = OUT('content', content)
         row_element.append(content_element)
     return row_element
예제 #2
0
 def as_xml(self, transclude_xml=False, **kwargs):
     fields_element = OUT('fields')
     row_element = OUT('row', fields_element, id=unicode(self.id))
     for field in self.fields.values():
         try:
             data = self._data[field.name]
         except KeyError:
             pass
         else:
             fields_element.append(field.as_xml(self, data, **kwargs))
     if transclude_xml and self.is_file and self._data.get('DocIcon') == 'xml':
         try:
             content = etree.parse(self.open()).getroot()
         except HTTPError as e:
             content_element = OUT('content', missing='true')
         else:
             content_element = OUT('content', content)
         row_element.append(content_element)
     return row_element
예제 #3
0
 def as_xml(self, transclude_xml=False, **kwargs):
     fields_element = OUT("fields")
     row_element = OUT("row", fields_element, id=unicode(self.id))
     for field in self.fields.values():
         try:
             data = self._data[field.name]
         except KeyError:
             pass
         else:
             fields_element.append(field.as_xml(self, data, **kwargs))
     if transclude_xml and self.is_file and self._data.get("DocIcon") == "xml":
         try:
             content = etree.parse(self.open()).getroot()
         except HTTPError as e:
             content_element = OUT("content", missing="true")
         else:
             content_element = OUT("content", content)
         row_element.append(content_element)
     return row_element
예제 #4
0
    def as_xml(self, include_list_data=True, include_field_definitions=True, **kwargs):
        list_element = OUT('list', name=self.name, id=self.id)

        if include_field_definitions:
            fields_element = OUT('fields')
            for field in self.fields.values():
                field_element = OUT('field',
                                  name=field.name,
                                  display_name=field.display_name,
                                  sharepoint_type=field.sharepoint_type,
                                  type=field.type_name,
                                  **field.extra_field_definition())
                if field.description:
                    field_element.attrib['description'] = field.description
                field_element.attrib['multi'] = 'true' if field.multi else 'false'
                fields_element.append(field_element)
            list_element.append(fields_element)

        if include_list_data:
            rows_element = OUT('rows')
            for row in self.rows:
                rows_element.append(row.as_xml(**kwargs))
            list_element.append(rows_element)
        return list_element
예제 #5
0
 def as_xml(self, list_names=None, **kwargs):
     if list_names is not None:
         lists = (self[list_name] for list_name in list_names)
     else:
         lists = self
     return OUT.lists(*[l.as_xml(**kwargs) for l in lists])
예제 #6
0
    def as_xml(self,
               include_list_data=True,
               include_field_definitions=True,
               **kwargs):
        list_element = OUT('list', name=self.name, id=self.id)

        if include_field_definitions:
            fields_element = OUT('fields')
            for field in self.fields.values():
                field_element = OUT('field',
                                    name=field.name,
                                    display_name=field.display_name,
                                    sharepoint_type=field.sharepoint_type,
                                    type=field.type_name,
                                    **field.extra_field_definition())
                if field.description:
                    field_element.attrib['description'] = field.description
                field_element.attrib[
                    'multi'] = 'true' if field.multi else 'false'
                fields_element.append(field_element)
            list_element.append(fields_element)

        if include_list_data:
            rows_element = OUT('rows')
            for row in self.rows:
                rows_element.append(row.as_xml(**kwargs))
            list_element.append(rows_element)
        return list_element
예제 #7
0
 def as_xml(self, list_names=None, **kwargs):
     if list_names is not None:
         lists = (self[list_name] for list_name in list_names)
     else:
         lists = self
     return OUT.lists(*[l.as_xml(**kwargs) for l in lists])
예제 #8
0
    def as_xml(self, include_list_data=True, include_field_definitions=True, **kwargs):
        list_element = OUT("list", name=self.name, id=self.id)

        if include_field_definitions:
            fields_element = OUT("fields")
            for field in self.fields.values():
                field_element = OUT(
                    "field",
                    name=field.name,
                    display_name=field.display_name,
                    sharepoint_type=field.sharepoint_type,
                    type=field.type_name,
                    **field.extra_field_definition()
                )
                if field.description:
                    field_element.attrib["description"] = field.description
                field_element.attrib["multi"] = "true" if field.multi else "false"
                fields_element.append(field_element)
            list_element.append(fields_element)

        if include_list_data:
            rows_element = OUT("rows")
            for row in self.rows:
                rows_element.append(row.as_xml(**kwargs))
            list_element.append(rows_element)
        return list_element