UPDATE
I changed the deliminator of web2py as response.delimiters = ('<?','?>')
The layout.html looks like http://pastebin.com/PqrcBtTm . It has condition
to include sidebar-nav and menu-bar, and include the form. The
/views/default/user.html looks like this:
<?if request.args(0) == "login":?>
<?sidenav_enabled=True?>
<?menu_enabled=True?>
<?extend "layout.html"?>
<?include "angular_module.html"?>
<?include "../static/angular/controllers/AppCtrl.html"?>
<?include "../static/angular/controllers/LoginCtrl.html"?>
<?block main_body?>
<?=form?>
<?end main_body?>
<?pass?>
<?block page_js?>
<script>
jQuery("#web2py_user_form input:visible:enabled:first").focus();
<?if request.args(0)=='register':?>
web2py_validate_entropy(jQuery('#auth_user_password'),100);
<?elif request.args(0)=='change_password':?>
web2py_validate_entropy(jQuery('#no_table_new_password'),100);
<?pass?>
</script>
<?end page_js?>
The user function in controllers/default.py is
def user():
if request.args(0) == "login":
response.title = T("Login")
auth.messages.submit_button = T("Login")
return dict(form=auth())
When trying to load /default/user/login, web2py complains me saying I am
missing pass in view, which I don't think I have.
The full traceback looks like:
Ticket ID
127.0.0.1.2016-12-23.12-28-19.b04c11e7-91f1-491b-94f2-8ab7aa934741
missing "pass" in viewVersion
web2py™ Version 2.14.6-stable+timestamp.2016.05.09.19.18.48
Python Python 2.7.5: C:\Python27\python.exe (prefix: C:\Python27)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
Traceback (most recent call last):
File "C:\Eden\web2py\gluon\rocket.py", line 1320, in run
self.run_app(conn)
File "C:\Eden\web2py\gluon\rocket.py", line 1813, in run_app
self.environ = environ = self.build_environ(sock_file, conn)
File "C:\Eden\web2py\gluon\rocket.py", line 1633, in build_environ
request = self.read_request_line(sock_file)
File "C:\Eden\web2py\gluon\rocket.py", line 1384, in read_request_line
raise SocketTimeout('Socket timed out before request.')
SocketTimeout: Socket timed out before request.
Then if I change my views/default/user.html to this
<?if request.args(0) == "login":?>
<?include 'auth/_login.html'?>
<?pass?>
<?block page_js?>
<script>
jQuery("#web2py_user_form input:visible:enabled:first").focus();
<?if request.args(0)=='register':?>
web2py_validate_entropy(jQuery('#auth_user_password'),100);
<?elif request.args(0)=='change_password':?>
web2py_validate_entropy(jQuery('#no_table_new_password'),100);
<?pass?>
</script>
<?end page_js?>
The views/auth/_login.html looks like this:
<?sidenav_enabled=True?>
<?menu_enabled=True?>
<?extend "layout.html"?>
<?include "angular_module.html"?>
<?include "../static/angular/controllers/AppCtrl.html"?>
<?include "../static/angular/controllers/LoginCtrl.html"?>
<?include "../static/angular/services/menu.service.html"?>
<?block main_body?>
<?=form?>
<?end?>
The error is gone, but the form is not loaded yet.
[image: 7uFaXjH.png (1674×1023)]
I stepped through gluon/template.py, the block main_body is contained but
is blank.
What am I missing here? How do I include the form?
Oh and the formstyle is custom one, which looks like:
def formstyle_angular_material(form, fields, *args, **kwargs):
def render_row(row_id, label, widget, comment, hidden=False):
input_container = TAG["md-input-container"](_class="md-block")
_class = "form-row row hide" if hidden else "form-row row"
if isinstance(label, LABEL):
label.attributes["_style"] = "color:green"
input_container.append(label)
if isinstance(widget, INPUT):
if "_type" in widget.attributes and \
widget.attributes["_type"] == "checkbox":
# Checkbox
# Label contained here
widget = TAG["md-checkbox"](label.components[0])
return DIV(widget, _class=_class, _id=row_id)
else:
# Normal Input
# Label contained above
input_container.append(widget)
if hasattr(widget, "element"):
submit = widget.element("input", _type="submit")
if submit:
widget = TAG["md-button"](widget.attributes["_value"],
_class="md-raised md-primary",
_type="submit")
return DIV(widget, _class=_class, _id=row_id)
return DIV(input_container, _class=_class, _id=row_id)
parent = TAG[""]()
for row_id, label, widget, comment in fields:
parent.append(render_row(row_id, label, widget, comment))
return parent
Please help me move forward. Really appreciate any help on this regard.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.