You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/08/04 02:38:10 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #25509: Possibility to document DAG with a separated markdown file

uranusjr commented on code in PR #25509:
URL: https://github.com/apache/airflow/pull/25509#discussion_r937296010


##########
airflow/models/dag.py:
##########
@@ -522,7 +522,7 @@ def __init__(
         self.has_on_success_callback = self.on_success_callback is not None
         self.has_on_failure_callback = self.on_failure_callback is not None
 
-        self.doc_md = doc_md
+        self.doc_md = pathlib.Path(doc_md).read_text() if pathlib.Path(str(doc_md or '')).is_file() else doc_md

Review Comment:
   Instead of doing heuristics like this, I wonder if it’s easier to simply _require_ the user to pass in a `Path` object, and do this here:
   
   ```python
   if isinstance(doc_md, pathlib.Path):
       self.doc_md = doc_md.read_text("utf-8")
   else:
       self.doc_md = doc_md
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org