File tree Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Expand file tree Collapse file tree 2 files changed +2
-14
lines changed Original file line number Diff line number Diff line change 8
8
import os
9
9
logger = logging .getLogger (__name__ )
10
10
11
- class TestDataJSONEncoder (json .JSONEncoder ):
12
- """Custom JSON encoder that preserves MongoDB extended JSON format for test data"""
13
- def default (self , obj ):
14
- # For test data, we want to preserve the original format
15
- # This encoder will be used specifically for test data responses
16
- return super ().default (obj )
17
-
18
- def encode (self , obj ):
19
- # Override encode to preserve MongoDB extended JSON format
20
- if isinstance (obj , dict ):
21
- # Recursively process dictionaries to preserve $oid and $date
22
- return super ().encode (obj )
23
- return super ().encode (obj )
11
+ # Removed TestDataJSONEncoder as it's not being used and the global MongoJSONEncoder handles MongoDB objects
24
12
25
13
# Define the Blueprint for test_data routes
26
14
def create_test_data_routes ():
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ def handle_exit(signum, frame):
31
31
project_root = os .path .dirname (os .path .dirname (os .path .abspath (__file__ )))
32
32
docs_path = os .path .join (project_root , 'docs' )
33
33
app = Flask (__name__ , static_folder = docs_path , static_url_path = '/docs' )
34
- # app.json = MongoJSONEncoder(app) # Commented out to test if this causes MongoDB object conversion
34
+ app .json = MongoJSONEncoder (app ) # Enable MongoDB object conversion
35
35
36
36
# Auto-processing logic - runs when module is imported (including by Gunicorn)
37
37
if config .AUTO_PROCESS :
You can’t perform that action at this time.
0 commit comments