Skip to content

Why eror AttributeError: 'Builder' object has no attribute 'add_route' #1

@bobwatcherx

Description

@bobwatcherx

my code

import Zenith

app = Zenith.WApp()

homePageContent = """
    <Container>
        <Header>Welcome to Zenith</Header>
        <Paragraph>A Python framework for web development</Paragraph>
        <Link to="/two>two</Link>
    </Container>
"""

twoPageContent = """
    <Container>
        <Header>Welcome to twoooo</Header>
        <Paragraph>A Python framework for web development</Paragraph>
    </Container>
"""
# builder = Zenith.Builder({"home": homePageContent})
builder = Zenith.Builder(routes=homePageContent) 

builder.add_route("/", homeComponent) 
builder.add_route("/two", twoPageContent) 
builtRoutes = builder.Build() 
built = builder.Build()

style = Zenith.Stylesheet.new({
    'body': {
        'background-color': '#f8f9fa',
        'font-family': 'Arial, sans-serif',
    },
    'h1': {
        'color': '#007BFF',
        'font-size': '32px',
    },
    'p': {
        'color': '#6c757d',
        'font-size': '16px',
    },
})
style.apply(built, "home")
# app.register_route('/', built['home'])
app.serve()

errorr
root@miop-HP-Convertible-x360-11-ab1XX:/home/miop/belajar/momka# python3 main.py
Traceback (most recent call last):
File "/home/miop/belajar/momka/main.py", line 20, in
builder = Zenith.Builder()
TypeError: Builder.init() missing 1 required positional argument: 'routes'
root@miop-HP-Convertible-x360-11-ab1XX:/home/miop/belajar/momka# python3 main.py
Traceback (most recent call last):
File "/home/miop/belajar/momka/main.py", line 22, in
builder.add_route("/", homeComponent)
AttributeError: 'Builder' object has no attribute 'add_route'

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions