feat: decouple market from shared_lib, add app-owned models
Phase 1-3 of decoupling: - path_setup.py adds project root to sys.path - Market-owned models in market/models/ (market, market_place) - All imports updated: shared.infrastructure, shared.db, shared.browser, etc. - MarketPlace uses container_type/container_id instead of post_id FK Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,7 +10,7 @@ from quart import (
|
||||
make_response,
|
||||
current_app,
|
||||
)
|
||||
from config import config
|
||||
from shared.config import config
|
||||
from .services.nav import category_context, get_nav
|
||||
from .services.blacklist.category import is_category_blocked
|
||||
|
||||
@@ -21,8 +21,8 @@ from .services import (
|
||||
_current_url_without_page,
|
||||
)
|
||||
|
||||
from suma_browser.app.redis_cacher import cache_page
|
||||
from suma_browser.app.utils.htmx import is_htmx_request
|
||||
from shared.browser.app.redis_cacher import cache_page
|
||||
from shared.browser.app.utils.htmx import is_htmx_request
|
||||
|
||||
def register():
|
||||
browse_bp = Blueprint("browse", __name__)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# suma_browser/category_blacklist.py
|
||||
from __future__ import annotations
|
||||
from typing import Optional
|
||||
from config import config
|
||||
from shared.config import config
|
||||
|
||||
def _norm(s: str) -> str:
|
||||
return (s or "").strip().lower().strip("/")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import Set, Optional
|
||||
from ..slugs import canonical_html_slug
|
||||
from config import config
|
||||
from shared.config import config
|
||||
|
||||
_blocked: Set[str] = set()
|
||||
_mtime: Optional[float] = None
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
from config import config
|
||||
from shared.config import config
|
||||
|
||||
def _norm_title_key(t: str) -> str:
|
||||
t = (t or "").strip().lower()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from __future__ import annotations
|
||||
import os, json
|
||||
from typing import List, Optional
|
||||
from config import config
|
||||
from shared.config import config
|
||||
from .blacklist.product import is_product_blocked
|
||||
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import Dict, List, Optional
|
||||
from sqlalchemy import select, and_
|
||||
from sqlalchemy.orm import selectinload
|
||||
|
||||
from config import config # if unused elsewhere, you can remove this import
|
||||
from shared.config import config # if unused elsewhere, you can remove this import
|
||||
|
||||
# ORM models
|
||||
from models.market import (
|
||||
|
||||
@@ -5,7 +5,7 @@ import re
|
||||
from typing import Dict, List, Tuple, Optional
|
||||
from urllib.parse import urlparse, urljoin
|
||||
|
||||
from config import config
|
||||
from shared.config import config
|
||||
from . import db_backend as cb
|
||||
from .blacklist.category import is_category_blocked # Reverse map: slug -> label
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ from quart import (
|
||||
g,
|
||||
request,
|
||||
)
|
||||
from config import config
|
||||
from shared.config import config
|
||||
from .products import products, products_nocounts
|
||||
from .blacklist.product_details import is_blacklisted_heading
|
||||
|
||||
from utils import host_url
|
||||
from shared.utils import host_url
|
||||
|
||||
|
||||
from sqlalchemy import select
|
||||
@@ -163,7 +163,7 @@ def _massage_product(d):
|
||||
|
||||
|
||||
# Re-export from canonical shared location
|
||||
from shared.http_utils import vary as _vary, current_url_without_page as _current_url_without_page
|
||||
from shared.infrastructure.http_utils import vary as _vary, current_url_without_page as _current_url_without_page
|
||||
|
||||
async def _is_liked(user_id: int | None, slug: str) -> bool:
|
||||
"""
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import re
|
||||
from urllib.parse import urljoin, urlparse
|
||||
from config import config
|
||||
from shared.config import config
|
||||
|
||||
def product_slug_from_href(href: str) -> str:
|
||||
p = urlparse(href)
|
||||
|
||||
Reference in New Issue
Block a user