diff --git a/frontmatter/__init__.py b/frontmatter/__init__.py
index 0cb7e4d..92f7c97 100644
--- a/frontmatter/__init__.py
+++ b/frontmatter/__init__.py
@@ -180,7 +180,7 @@ def dumps(post, handler=None, **kwargs):
 
     """
     if handler is None:
-        handler = post.handler or YAMLHandler()
+        handler = getattr(post, 'handler', None) or YAMLHandler()
 
     start_delimiter = kwargs.pop('start_delimiter', handler.START_DELIMITER)
     end_delimiter = kwargs.pop('end_delimiter', handler.END_DELIMITER)

Deal with no handler on post object
This bug: https://github.com/datadesk/django-bigbuild/issues/38

In cases where there's no `post.handler` (not just `None`) fall back to `YAMLHandler`.
diff --git a/test.py b/test.py
index 92a1a38..21d3976 100644
--- a/test.py
+++ b/test.py
@@ -139,6 +139,15 @@ class HandlerTest(unittest.TestCase):
                 format = frontmatter.detect_format(f.read(), frontmatter.handlers)
                 self.assertIsInstance(format, Handler)
 
+    def test_no_handler(self):
+        "default to YAMLHandler when no handler is attached"
+        post = frontmatter.load('tests/hello-world.markdown')
+        del post.handler
+
+        text = frontmatter.dumps(post)
+        self.assertIsInstance(
+            frontmatter.detect_format(text, frontmatter.handlers), 
+            YAMLHandler)
 
     def test_custom_handler(self):
         "allow caller to specify a custom delimiter/handler"

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
importlib-metadata==4.8.3
iniconfig==1.1.1
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
-e git+https://github.com/eyeseast/python-frontmatter.git@d9b7df7bb3902530f37d9ac5ccaf04e4f3f36f87#egg=python_frontmatter
PyYAML==6.0.1
six==1.17.0
toml==0.10.2
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: python-frontmatter
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pyyaml==6.0.1
      - six==1.17.0
      - toml==0.10.2
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/python-frontmatter

test.py::HandlerTest::test_no_handler
test.py::FrontmatterTest::test_all_the_tests test.py::FrontmatterTest::test_dumping_with_custom_delimiters test.py::FrontmatterTest::test_empty_frontmatter test.py::FrontmatterTest::test_no_frontmatter test.py::FrontmatterTest::test_pretty_dumping test.py::FrontmatterTest::test_to_dict test.py::FrontmatterTest::test_to_string test.py::FrontmatterTest::test_unicode_post test.py::FrontmatterTest::test_with_crlf_string test.py::FrontmatterTest::test_with_markdown_content test.py::HandlerTest::test_custom_handler test.py::HandlerTest::test_detect_format test.py::HandlerTest::test_json test.py::HandlerTest::test_toml
frontmatter/__init__.py
frontmatter/__init__.py