Đang chuẩn bị liên kết để tải về tài liệu:
Web to py enterprise web framework - p 9

Không đóng trình duyệt đến khi xuất hiện nút TẢI XUỐNG

AN IMAGE BLOG 65 The first thing to notice is that a view is pure HTML with special {{.}} tags. The code embedded in {{.}} is pure Python code with one caveat: indentation is irrelevant. Blocks of code start with lines ending in colon (:) and end in lines beginning with the keyword pass. In some cases the end of a block is obvious from context and the use of pass is not required. Lines 5-7 loop over the image rows and for each row image display: 1 LI(A(image.title, _href=URL(r=request, f='show', args=image.id)) This is a . tag that contains an . tag which contains the. | AN IMAGE BLOG 65 The first thing to notice is that a view is pure HTML with special . tags. The code embedded in . is pure Python code with one caveat indentation is irrelevant. Blocks of code start with lines ending in colon and end in lines beginning with the keyword pass. In some cases the end of a block is obvious from context and the use of pass is not required. Lines 5-7 loop over the image rows and for each row image display 1 LI A image.title _href URL r request f show args image.id This is a ii . ii tag that contains an a href . . a tag which contains the image.title. The value of the hypertext reference href attribute is 1 URL r request f show args image.id i.e. the URL within the same application and controller as the current request r request calling the function called show f show and passing a single argument to the function args image.id. li a etc. are WEB2py helpers that map to the corresponding HTML tags. Their unnamed arguments are interpreted as objects to be serialized and inserted in the tag s innei HTML. Named arguments t rt ing with an underscore for example _href are interpreted as tag attributes but without the underscore. For example _href is the href attribute .class is the class attribute etc. As an example the following statement 1 LI A something _href URL r request f show args 123 is rendered as 1 li a href images default show 123 something a li A handful of helpers input textarea option and select also support some special named attributes not starting with underscore value and requires . They are important for building custom forms and will be discussed later. Go back to the EDIT page. It now indicates that default.py exposes index . By clicking on index you can visit the newly created page 1 http 127.0.0.1 8000 images default index which looks like 66 OVERVIEW 1 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 If you click on the image name link you are directed to http 127.0.0.1 8000 images default show 1 and this results in an error since .

Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.