Wie fügt man mehrzeilige Dateien in Bottle SimpleTemplate .tpl-Dateien ein?Python

Python-Programme
Anonymous
 Wie fügt man mehrzeilige Dateien in Bottle SimpleTemplate .tpl-Dateien ein?

Post by Anonymous »

Ich versuche, mehrzeilige %includes in Bottle (SimpleTemplate) zu verwenden.
Ist das tatsächlich möglich?

Code: Select all



Employees









% include('topbar', title='Employees', logo_url='../static/logo.png', menu_items=menu_items, right_items=right_items)



% include('collapsible_panel',
panel_width='300px',
collapsed=False,
panel_content=template('panel_list',
headers=['ID', 'Name', 'Department', 'Active'],
column_widths='60px 1fr 120px 80px',
items=[
{
'link': '/employees/1',
'active': True,
'cells': [
{'text': '001'},
{'text': 'John Doe'},
{'text': 'Engineering'},
{'type': 'icon', 'checked': True}
]
},
{
'link': '/employees/2',
'cells': [
{'text': '002'},
{'text': 'Jane Smith'},
{'text': 'Marketing'},
{'type': 'icon', 'checked': True}
]
},
{
'link': '/employees/3',
'cells': [
{'text': '003'},
{'text': 'Bob Johnson'},
{'text': 'Sales'},
{'type': 'icon', 'checked': False}
]
}
]
),
main_content='''
Employee Details
Select an employee from the list to view details here.
This area will show detailed information about the selected employee.
'''
)




Wenn Sie das oben Genannte versuchen, erhalten Sie:

Code: Select all

SyntaxError(SyntaxError("'(' was never closed", ('/home/user/test/src/views/employees.tpl', 19, 8, "            % include('collapsible_panel', \n", 19, 0)))

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post