| | 137 | subtitle_element = self.entry.get_child('subtitle', ATOM10_NS) |
|---|
| | 138 | if not subtitle_element and not self.subtitle.text().isEmpty(): |
|---|
| | 139 | E(u'subtitle', namespace=ATOM10_NS, prefix=ATOM10_PREFIX, |
|---|
| | 140 | attributes={u'type': u'text'}, |
|---|
| | 141 | content=unicode(self.subtitle.text()), |
|---|
| | 142 | parent=self.entry) |
|---|
| | 143 | elif subtitle_element and not self.subtitle.text().isEmpty(): |
|---|
| | 144 | subtitle_element.xml_text = unicode(self.subtitle.text()) |
|---|
| | 145 | elif subtitle_element and self.subtitle.text().isEmpty(): |
|---|
| | 146 | subtitle_element.forget() |
|---|
| | 147 | |
|---|
| | 148 | rights_element = self.entry.get_child('rights', ATOM10_NS) |
|---|
| | 149 | if not rights_element and not self.rights.text().isEmpty(): |
|---|
| | 150 | E(u'rights', namespace=ATOM10_NS, prefix=ATOM10_PREFIX, |
|---|
| | 151 | attributes={u'type': u'text'}, |
|---|
| | 152 | content=unicode(self.rights.text()), |
|---|
| | 153 | parent=self.entry) |
|---|
| | 154 | elif rights_element and not self.rights.text().isEmpty(): |
|---|
| | 155 | rights_element.xml_text = unicode(self.rights.text()) |
|---|
| | 156 | elif rights_element and self.rights.text().isEmpty(): |
|---|
| | 157 | # When no rights were provided we remove the atom:rights element |
|---|
| | 158 | rights_element.forget() |
|---|
| | 159 | |
|---|
| | 160 | summary_element = self.entry.get_child('summary', ATOM10_NS) |
|---|
| | 161 | text = self.summary.toPlainText() |
|---|
| | 162 | if not summary_element and not text.isEmpty(): |
|---|
| | 163 | E(u'summary', namespace=ATOM10_NS, prefix=ATOM10_PREFIX, |
|---|
| | 164 | attributes={u'type': u'text'}, content=unicode(text), |
|---|
| | 165 | parent=self.entry) |
|---|
| | 166 | elif summary_element and not text.isEmpty(): |
|---|
| | 167 | summary_element.xml_text = unicode(text) |
|---|
| | 168 | elif summary_element and text.isEmpty(): |
|---|
| | 169 | summary_element.xml_text = u'' |
|---|
| | 170 | |
|---|
| | 171 | content_element = self.entry.get_child('content', ATOM10_NS) |
|---|
| | 172 | text = self.content.toPlainText() |
|---|
| | 173 | if not content_element and not text.isEmpty(): |
|---|
| | 174 | E(u'content', namespace=ATOM10_NS, prefix=ATOM10_PREFIX, |
|---|
| | 175 | attributes={u'type': u'text'}, content=unicode(text), |
|---|
| | 176 | parent=self.entry) |
|---|
| | 177 | elif content_element and not text.isEmpty(): |
|---|
| | 178 | content_element.xml_text = unicode(text) |
|---|
| | 179 | elif content_element and text.isEmpty(): |
|---|
| | 180 | content_element.xml_text = u'' |
|---|
| | 181 | |
|---|