Show More
@@ -276,16 +276,20 b' class FileNode(Node):' | |||||
276 | mode = self._mode |
|
276 | mode = self._mode | |
277 | return mode |
|
277 | return mode | |
278 |
|
278 | |||
|
279 | def _get_content(self): | |||
|
280 | if self.changeset: | |||
|
281 | content = self.changeset.get_file_content(self.path) | |||
|
282 | else: | |||
|
283 | content = self._content | |||
|
284 | return content | |||
|
285 | ||||
279 | @property |
|
286 | @property | |
280 | def content(self): |
|
287 | def content(self): | |
281 | """ |
|
288 | """ | |
282 | Returns lazily content of the FileNode. If possible, would try to |
|
289 | Returns lazily content of the FileNode. If possible, would try to | |
283 | decode content from UTF-8. |
|
290 | decode content from UTF-8. | |
284 | """ |
|
291 | """ | |
285 | if self.changeset: |
|
292 | content = self._get_content() | |
286 | content = self.changeset.get_file_content(self.path) |
|
|||
287 | else: |
|
|||
288 | content = self._content |
|
|||
289 |
|
293 | |||
290 | if bool(content and '\0' in content): |
|
294 | if bool(content and '\0' in content): | |
291 | return content |
|
295 | return content | |
@@ -406,7 +410,7 b' class FileNode(Node):' | |||||
406 | """ |
|
410 | """ | |
407 | Returns True if file has binary content. |
|
411 | Returns True if file has binary content. | |
408 | """ |
|
412 | """ | |
409 | _bin = '\0' in self.content |
|
413 | _bin = '\0' in self._get_content() | |
410 | return _bin |
|
414 | return _bin | |
411 |
|
415 | |||
412 | @LazyProperty |
|
416 | @LazyProperty |
General Comments 0
You need to be logged in to leave comments.
Login now