[web2py] Problems with custom registration form
I wanted to build the login and register forms by hand, so I modified the default/user.html file like so. Login works fine, but the registration form doesn't ever get processed. Can anyone see what's wrong. default/user.html: {{extend 'layout.html'}} h2{{=T( request.args(0).replace('_',' ').capitalize() )}}/h2 div id=web2py_user_form {{if form.formname == 'login':}} form action= enctype=multipart/form-data method=POST input class=string id=auth_user_username name=username type=textvalue = placeholder=Username input class=password id=auth_user_password name=password type= password value= placeholder=Password div class=input-block label for=auth_user_rememberinput class=checkbox id= auth_user_remember name=remember type=checkbox value=onnbsp;nbsp; Remember me (for 30 days)/label /div input type=submit value=Login {{=form.hidden_fields()}} span class=form-flash{{=response.flash or ''}}/span /form {{elif form.formname == 'register':}} form action= enctype=multipart/form-data method=POST input class=string id=auth_user_username name=username type=text value= placeholder=Username input class=string id=auth_user_first_name name=first_name type= text value= placeholder=First Name input class=string id=auth_user_last_name name=last_name type=text value= placeholder=Last Name input class=string id=auth_user_email name=email type=text value= placeholder=Email input class=password id=auth_user_password name=password type= password value= placeholder=Password input name=password_two type=password placeholder=Re-enter Password input type=submit value=Sign Up {{=form.hidden_fields()}} span class=form-flash{{=response.flash or ''}}/span /form {{else:}} {{=form}} {{pass}} {{#=form}} {{if request.args(0)=='login':}} {{if not 'register' in auth.settings.actions_disabled:}} br/ a href={{=URL(args='register')}}{{=T('Register')}}/a {{pass}} {{if not 'request_reset_password' in auth.settings.actions_disabled:}} br/ a href={{=URL(args='request_reset_password')}}{{=T('Lost Password')}}/a {{pass}} {{pass}} /div script language=javascript!-- jQuery(#web2py_user_form input:visible:enabled:first).focus(); //--/script --
[web2py] Requiring password on registration
The default login form does not require a password to be entered when registering. Is this intentional? Seems a funny default. I can't figure out how to require a password. I added db.auth_user.password.requires = IS_NOT_EMPTY(error_message=auth.messages. is_empty) and removed the default='' from the password fields, but it still lets me register without any password... --
[web2py] Re: MARKMIN change of behavior
Hmm, unless you mention what the 'better behaviour' is, it is difficult to agree as this change does result in broken content. In any case, I also believe that 'better behaviour' should also be to try to retain compatibility with Markdown. There are now two departures from Markdown with regards header tags. The other one is this: Markmin:#Head phead/p Markdown: #Head h1head/h1 Many users started using Markmin as a substitute to Markdown. In fact my company now uses both and the staff have to remember any nit-picking differences like this. Where it doesn't hurt, it would be great to harmonise the behaviour, not introduce more differences. Best regards, David On Wednesday, August 8, 2012 8:23:49 PM UTC+1, Massimo Di Pierro wrote: There is a manor change of behavior in MARKMIN. Before: - markmin # title aaa bbb -- end markmin would render as h1titleh1paaa/pp/p After: the same markmin would render h1title aaa/h1p/p In other words now headers (#, ##, ###) can be continued to the next line and need an empty new line to be separated from the first paragraph. I think the new behavior is better and previous behavior should be considered a bug. Anyway. I just wanted people to know, in case there are major objections. Massimo --
Re: [web2py] Re: Get result set back as list?
On 8/10/2012 3:58 PM, Vasile Ermicioi wrote: for me that works alist = db(db.auth_user).select().as_list() How funny. I was just making up the name as_list(). Great minds think alike I guess. I was looking for a flat list of field values, but the list comprehension solution is ok I guess. Thanks, Tobiah --
[web2py] Janrain fails (yes I did RTFM!) — too many values to unpack
Unfortunately I cannot get Janrain to work. (After Facebook and LinkedIn failed the regular way, I though to try with Janrain) Here is my ticket: http://fiddle.jshell.net/AlecTaylor/xeLg6/show/ Documentation: http://web2py.com/books/default/chapter/29/9 The problem is on the `request` variable: auth.settings.login_form = RPXAccount(request, ... ) Gives: *type 'exceptions.ValueError' too many values to unpack* How do I get Janrain working? Thanks for all suggestions, Alec Taylor --
[web2py] Need Microsoft Dynamics/CRM Consultant
Hi Folks, Hope you are doing great. Please let me know if you have any consultant for the following requirement. Please forward the resumes lok...@sriveninfosys.net Data/Reporting Analyst (Microsoft Dynamics / CRM in an enterprise environment. ) Jacksonville, FL 6 month+ contract The candidate should have 2-4 years experience with development and support of the following CRM skills. Skills Setup and development of SSIS integration packages. Creation of plugins and workflows. Creation of Reports according to customers specs. Performing data migrations and data cleansing. Creating custom entities. .NET framework SSRS development Creation of custom ribbons and views. xml. Strong T-SQL experience. JavaScript, JQuery, and ODATA. MS SQL Server and Reporting Services. SCRIBE data integration. Thanks Regards -- Lokesh IT Recruiter Sriveninfosys Inc (CELEBRATING 11th ANNIVERSARY 2000-2011) Voice: 732-835-0098 Fax: 516-977-0618 E-mail : lok...@sriveninfosys.net || G-mail:lokesh.sriveninfo...@gmail.com || --
[web2py] Need PL/SQL Developers
Hi Folks, Hope you are doing great. Please let me know if you have any consultant for the following requirement. Please forward the resumes lok...@sriveninfosys.net Do you have any strong PL/SQL Developers? Need to be strong in PL/SQL, Production Support, and Analysis. Rate is not to exceed $45/hr! Please let me know if you have anyone available! Title: PL/SQL Software Developer (3 Nos) SKILLS: PL/SQL Oracle Reports Production Support Analysis Healthcare-Plus Business Object-Plus Short Description: Maintain and enhance existing PL/SQL applications. Analyze, troubleshoot, and resolve complex issues with existing systems. Develop new software, implement new features Complete Description: Duties and Responsibilities Maintain and enhance existing PL/SQL applications. Analyze, troubleshoot, and resolve complex issues with existing systems. Develop new software, implement new features. Interact with customers to determine requirements and discover needs. Carry projects from design through to development, testing, and delivery. Minimum requirements: Computer Science degree or equivalent Four or more years of experience in programming in PL/SQL on Oracle and Oracle Reports Demonstrated interpersonal, verbal, and written communications skills Demonstrated analytical, problem-solving, and conceptual skills Experience with Perl, Intersystem's Ensemble, Business Objects Health Care or Insurance background Thanks Regards -- Lokesh IT Recruiter Sriveninfosys Inc (CELEBRATING 11th ANNIVERSARY 2000-2011) Voice: 732-835-0098 Fax: 516-977-0618 E-mail : lok...@sriveninfosys.net || G-mail:lokesh.sriveninfo...@gmail.com || --
[web2py] autoincremente field with a specific first value
Is there a way to add an autoincremente field with a specific first value. Compute won't work with id + number. --
[web2py] Re: NoSQL Question Again!!!
Has there been any update with DAL supporting Mongo? I haven't seen any official mention in w2p docs. Any information would be appreciated. Thanks, gm On Thursday, July 15, 2010 4:07:04 PM UTC-4, Pystar wrote: Hi guys, I am one of the proponents that web2py's DAL should support NoSQL datastores like Couchdb, Mongodb et al but since the DAL rewrite isn't quite completer yet, I would like to know how to use web2py and a NoSQL datastore without DAL and without loosing stuff like auto-gen forms and validation. Thanks Pystar --
[web2py] Sending emails with background queue problem
I want to send emails using a background queue as described in the web2py book: http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task However, the queue only sends emails that have been in the database when I start the script. Database entries added lateron don't get picked up by the script. The only way I can achieve that is to add another db.commit() before the select(). I am sure this is not supposed to be necessary. Does anyone know why this is happening? import time while True: db.commit() # Only works if I add this line rows = db(db.queue.status=='pending').select() for row in rows: if mail.send(to=row.email, subject=row.subject, message=row.message): row.update_record(status='sent') else: row.update_record(status='failed') db.commit() time.sleep(60) # check every minute --
[web2py] Re: Having trouble with computed fields referencing id field.
I have the same problème and in that poste : https://groups.google.com/forum/?fromgroups#!topic/web2py/RmdCe7xp5gM[1-25] it say that it's possible to do so but in my test application it's not. As you say on insertion the id is not avaaillable yet and that is the raison I think. If somme body have a solution, please give as a sample of code. On Monday, August 6, 2012 12:14:52 AM UTC, Rob_McC wrote: . I created a simple app, with only this in it, . I can get computed field to work , but never referencing the id field. I think the trouble is that 'id' is never updated, so it is not available for compute= . I don't think I can do this when the record is first created, since an 'id' has not been assigned. I want to eventually add another field that depends on 'id' that is why I'm doing this. I could use a virtual field I think... Thanks Rob ## after auth = Auth(db) auth.settings.extra_fields['auth_user']= [ Field('address'), Field('city'), Field('zip'), Field('phone'), Field('ref_number', compute=lambda r: r['city'])] # this WORKS # Field('ref_number', compute=lambda r: r['city'])] # this DOES NOT WORK # Field('ref_number', compute=lambda r: r['id'])] # Field('ref_number', 'integer', compute=lambda r: r['id'])] # before auth.define_tables(username=True) ## create all tables needed by auth if not custom tables auth.define_tables() --
[web2py] Sending email from background queue
*My first post somehow didn't make it to the group, I don't know where it got lost. Sorry if I submit this twice, I have never participated in a news group before.* I am trying to set up a background queue for sending email as described in the web2py book. http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task However, emails are only sent when they have been in the database before starting the script. Emails I add to the database when the queue is running do not get picked up for some reason. I got it to work by adding an additional db.commit() before the select() in every loop run. I assume this should not be needed. Does anyone have an idea why this is not working without that additional commit? import time while True: db.commit() # not working without this line rows = db(db.queue.status=='pending').select() for row in rows: if mail.send(to=row.email, subject=row.subject, message=row.message): row.update_record(status='sent') else: row.update_record(status='failed') db.commit() time.sleep(60) # check every minute --
[web2py] Re: Giving a talk promoting web2py over Django
Love to see your slides you presented. Are they available somewhere on line? Thanks, gm On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote: Tonight I'm going to present my little social-network to a user-group. I'm going to show them my code, some slides, the website, the mobile apps and tell them when Django isn't as good as web2py. Are there any particular features of web2py you would recommend I highlight? - Also, are there any major drawbacks in Django that web2py has that is easily advertisable? (I have a slide or two on this, but I'm sure as longtime users/developers of web2py you'd have more to pitch-in) Thanks for all information, Alec Taylor --
[web2py] Re: Sending email from background queue
How are emails added to the database -- does that happen within the application, or also in a script? On Saturday, August 11, 2012 12:55:40 AM UTC-4, Florian Letsch wrote: *My first post somehow didn't make it to the group, I don't know where it got lost. Sorry if I submit this twice, I have never participated in a news group before.* I am trying to set up a background queue for sending email as described in the web2py book. http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task However, emails are only sent when they have been in the database before starting the script. Emails I add to the database when the queue is running do not get picked up for some reason. I got it to work by adding an additional db.commit() before the select() in every loop run. I assume this should not be needed. Does anyone have an idea why this is not working without that additional commit? import time while True: db.commit() # not working without this line rows = db(db.queue.status=='pending').select() for row in rows: if mail.send(to=row.email, subject=row.subject, message=row.message): row.update_record(status='sent') else: row.update_record(status='failed') db.commit() time.sleep(60) # check every minute --
[web2py] Re: Janrain fails (yes I did RTFM!) — too many values to unpack
According to the ticket, the problem is with your janrain.key file. The code does a split on : and expects two values -- if it's complaining about too many values to unpack, you must have more than one colon in the string in that file. The file contents should look like: [domain]:[API key] Note, the domain is the name that comes before rpxnow.com (e.g., if your application domain is mysite.rpxnow.com, then the domain in the file should simply be mysite). Anthony On Saturday, August 11, 2012 1:27:06 PM UTC-4, Alec Taylor wrote: Unfortunately I cannot get Janrain to work. (After Facebook and LinkedIn failed the regular way, I though to try with Janrain) Here is my ticket: http://fiddle.jshell.net/AlecTaylor/xeLg6/show/ Documentation: http://web2py.com/books/default/chapter/29/9 The problem is on the `request` variable: auth.settings.login_form = RPXAccount(request, ... ) Gives: *type 'exceptions.ValueError' too many values to unpack* How do I get Janrain working? Thanks for all suggestions, Alec Taylor --
[web2py] Re: Sending emails with background queue problem
Are you using mysql? On Friday, 10 August 2012 23:11:03 UTC-5, Florian Letsch wrote: I want to send emails using a background queue as described in the web2py book: http://web2py.com/books/default/chapter/29/8#Sending-messages-using-a-background-task However, the queue only sends emails that have been in the database when I start the script. Database entries added lateron don't get picked up by the script. The only way I can achieve that is to add another db.commit() before the select(). I am sure this is not supposed to be necessary. Does anyone know why this is happening? import time while True: db.commit() # Only works if I add this line rows = db(db.queue.status=='pending').select() for row in rows: if mail.send(to=row.email, subject=row.subject, message=row.message): row.update_record(status='sent') else: row.update_record(status='failed') db.commit() time.sleep(60) # check every minute --
[web2py] Re: Requiring password on registration
This was discussed once I people said there should be no default minimum length for password. So technically a zero length password can be inserted. For security reason it will not be accepted for logging anyway. db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) On Saturday, 11 August 2012 10:26:37 UTC-5, Yarin wrote: The default login form does not require a password to be entered when registering. Is this intentional? Seems a funny default. I can't figure out how to require a password. I added db.auth_user.password.requires = IS_NOT_EMPTY(error_message=auth.messages. is_empty) and added required=True to the db password field definition, but it still lets me register without any password... --
[web2py] Re: MARKMIN change of behavior
The #head is now fixed. Please check it. On Saturday, 11 August 2012 11:35:57 UTC-5, villas wrote: Hmm, unless you mention what the 'better behaviour' is, it is difficult to agree as this change does result in broken content. In any case, I also believe that 'better behaviour' should also be to try to retain compatibility with Markdown. There are now two departures from Markdown with regards header tags. The other one is this: Markmin:#Head phead/p Markdown: #Head h1head/h1 Many users started using Markmin as a substitute to Markdown. In fact my company now uses both and the staff have to remember any nit-picking differences like this. Where it doesn't hurt, it would be great to harmonise the behaviour, not introduce more differences. Best regards, David On Wednesday, August 8, 2012 8:23:49 PM UTC+1, Massimo Di Pierro wrote: There is a manor change of behavior in MARKMIN. Before: - markmin # title aaa bbb -- end markmin would render as h1titleh1paaa/pp/p After: the same markmin would render h1title aaa/h1p/p In other words now headers (#, ##, ###) can be continued to the next line and need an empty new line to be separated from the first paragraph. I think the new behavior is better and previous behavior should be considered a bug. Anyway. I just wanted people to know, in case there are major objections. Massimo --
[web2py] Re: Requiring password on registration
According to the code: settings.password_min_length = 4 and table[passfield].requires = [ CRYPT(key=settings.hmac_key, min_length=settings.password_min_length)] So, isn't the minimum password length 4 by default? Anthony On Saturday, August 11, 2012 3:21:06 PM UTC-4, Massimo Di Pierro wrote: This was discussed once I people said there should be no default minimum length for password. So technically a zero length password can be inserted. For security reason it will not be accepted for logging anyway. db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) On Saturday, 11 August 2012 10:26:37 UTC-5, Yarin wrote: The default login form does not require a password to be entered when registering. Is this intentional? Seems a funny default. I can't figure out how to require a password. I added db.auth_user.password.requires = IS_NOT_EMPTY(error_message=auth.messages .is_empty) and added required=True to the db password field definition, but it still lets me register without any password... --
[web2py] Re: Requiring password on registration
Anthony's correct- this is in Auth, but is not being respected: settings.password_min_length = 4 Massimo - For security reason it will not be accepted for logging anyway. - Not sure what you meant but it registered me and logged me in with an empty pass. I also tried inserting: db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) in db.py and it hasn't fixed it. Bug report? . On Saturday, August 11, 2012 4:43:43 PM UTC-4, Anthony wrote: According to the code: settings.password_min_length = 4 and table[passfield].requires = [ CRYPT(key=settings.hmac_key, min_length=settings.password_min_length)] So, isn't the minimum password length 4 by default? Anthony On Saturday, August 11, 2012 3:21:06 PM UTC-4, Massimo Di Pierro wrote: This was discussed once I people said there should be no default minimum length for password. So technically a zero length password can be inserted. For security reason it will not be accepted for logging anyway. db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) On Saturday, 11 August 2012 10:26:37 UTC-5, Yarin wrote: The default login form does not require a password to be entered when registering. Is this intentional? Seems a funny default. I can't figure out how to require a password. I added db.auth_user.password.requires = IS_NOT_EMPTY(error_message=auth. messages.is_empty) and added required=True to the db password field definition, but it still lets me register without any password... On Saturday, August 11, 2012 4:43:43 PM UTC-4, Anthony wrote: According to the code: settings.password_min_length = 4 and table[passfield].requires = [ CRYPT(key=settings.hmac_key, min_length=settings.password_min_length)] So, isn't the minimum password length 4 by default? Anthony On Saturday, August 11, 2012 3:21:06 PM UTC-4, Massimo Di Pierro wrote: This was discussed once I people said there should be no default minimum length for password. So technically a zero length password can be inserted. For security reason it will not be accepted for logging anyway. db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) On Saturday, 11 August 2012 10:26:37 UTC-5, Yarin wrote: The default login form does not require a password to be entered when registering. Is this intentional? Seems a funny default. I can't figure out how to require a password. I added db.auth_user.password.requires = IS_NOT_EMPTY(error_message=auth. messages.is_empty) and added required=True to the db password field definition, but it still lets me register without any password... --
Re: [web2py] Re: web2py 2.0 almost done
Hi Massimo, Mobile browser on mobile phones can work in mobile mode or in desktop mode. If you are in desktop mode, without that line, you cannot see the menu because it's faded away. And you cannot click, so the menu is faded and not clickable! In a desktop instead, when a windowed browser has a resolution less than responsive threshold, the menu is yes visible, but it's resize the page at each mouse hovering and makes the menu unusable. So, if you are in a browser with a sufficient resolution, you can see the standard dropdown, when you are on a mobile browser with a narrow resolution but in desktop mode, you can see a flat menu. This restores the default bootstrap behaviour for colllapsible dropdowns. Hope this helps! 2012/8/10 Massimo Di Pierro massimo.dipie...@gmail.com Can you explain the consequences of this line in your patch? if (jQuery(document).width() = 980) On Friday, 10 August 2012 10:11:39 UTC-5, AngeloC wrote: Hi Massimo, I fixed compatibility with IE and reverted to a non mobile first approach. I reverted because bootstrap is not mobile first (so we add too little) and for the sake of compatibility with IE. Patch is attached to issue http://code.google.com/** p/web2py/issues/detail?id=896http://code.google.com/p/web2py/issues/detail?id=896which I cannot reopen. Hope this helps! Angelo 2012/8/10 Angelo Compagnucci angelo.co...@gmail.com Hi Massimo, I'm writing it right now to fix ie issues! Please be patient until fixed! 2012/8/9 Massimo Di Pierro massimo@gmail.com This may be ok but where do I get bootswatch_ie.css from? On Thursday, 9 August 2012 11:43:28 UTC-5, AngeloC wrote: Hi Massimo, I think I cannot complete the bootstrap/web2py css merging in time for 2.0, it's really a lot of work and I'm a bit busy these days. Btw, i'm fixing the bug I introduced with issue 896 and I want to share a thought with you. Actually, there is no way to maintain a mobile first approach and make it working on IE other than add something like this to the scaffolding: !-- Makes bootswatch working on IE 7/8 -- !--[if (lt IE 9)] link rel=stylesheet href=/responsivekit/static/**cs** s/bootswatch_ie.css ![endif]-- This will make speedier the whole css on not IE browsers because we remove IE specific rules (smaller css), but has the downside to require an extra http get on IE. What do you think? 2012/8/9 Alec Taylor alec.t...@gmail.com It would be good to have OAuth working for web2py 2 Facebook and LinkedIn still have some issues LinkedIn: https://groups.google.com/**foru**m/#!topic/web2py/** SbnQEnXEcOghttps://groups.google.com/forum/#!topic/web2py/SbnQEnXEcOg Facebook: (will add bug report once I've gotten LinkedIn login to work) On Thu, Aug 9, 2012 at 11:25 PM, Massimo Di Pierro massimo@gmail.com wrote: Can you help us fix the CSS? On Thursday, 9 August 2012 00:29:58 UTC-5, Andrew wrote: Just a note on IE7 navbar behaviour: The Menu has taken a turn for the worse: Initially the Welcome App Sub Menus dissapeared in : welcome css pathc, issue 896, thanks Angelo They then returned in fixed issue qith clicking on toplevel menus except all of the submenus are displayed when the menu first appears and they are all on top of each other. The login options are still blue, and the space between the navbar and Welcome isn't there. See screen shot. On Thursday, August 9, 2012 9:17:17 AM UTC+12, Massimo Di Pierro wrote: more issues have been addressed. In order to fix an issue I had to introduce a slight change of behavior and I am not sure what is the best way to handle it. If you login using a third party service (for example janrain using facebook) and the service sends info about you, if web2py has corresponding fields in auth_user, it stores them. If you edit your profile, logout, change your facebook profile, login again using janrain, should web2py keep the current local profile or update it? The bug report suggested that web2oy should always give preference to the local profile. I changed web2py accordingly. In practice this change will probably not affect anybody because none of the services sends any information stored by auth_user. Yet, please check it. Massimo On Monday, 6 August 2012 23:33:48 UTC-5, Massimo Di Pierro wrote: Web2py 2.0 is almost done. Please try the nightly build. Let us know if it breaks anything. massimo -- -- -- Profile: http://it.linkedin.com/in/**comp**agnucciangelohttp://it.linkedin.com/in/compagnucciangelo -- -- Profile: http://it.linkedin.com/in/**compagnucciangelohttp://it.linkedin.com/in/compagnucciangelo -- Profile: http://it.linkedin.com/in/**compagnucciangelohttp://it.linkedin.com/in/compagnucciangelo -- -- Profile: http://it.linkedin.com/in/compagnucciangelo --
[web2py] Re: Requiring password on registration
Anthony's correct- this is in Auth, but is not being respected: settings.password_min_length = 4 I just created a fresh app using trunk, and when I try to register without a password, I get a too short error message on the password field. What version of web2py are you using? Can we see your Auth related code? Or maybe you can pack and attach a simple app that exhibits the behavior. Massimo - For security reason it will not be accepted for logging anyway. - Not sure what you meant but it registered me and logged me in with an empty pass. By default, when you first register, you are automatically logged in upon registration (this can be disabled). I think Massimo meant that subsequently you will not be able to continue to login with an empty password. I also tried inserting: db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) What happens whey you try that -- does it generate an error, or simply allow you to register without a password? Anthony --
[web2py] Re: Strange behavior db( ... and ... and ...) vs. db( ... or ... or ...)
Massimo, could we highlight this issue in the documentation somewhere, and/or show the right way to do a compound query. There's no documentation on this stuff, it's very easy to accidentally do because won't throw a syntax error, and we almost just shipped some production code with 'and' instead of On Thursday, June 18, 2009 11:43:37 AM UTC-4, mdipierro wrote: follow up query1 or query2 IS INVALID SYNTAX query1|query2 IS CORRECT or cannot be overwritten in Python so it is still valid but it does not do what you want. query1 or query2 ALWAYS returns just query1. Massimo On Jun 18, 10:43 am, mdipierro mdipie...@cs.depaul.edu wrote: query1 and query2 IS INVALID SYNTAX query1query2 IS CORRECT and cannot be overwritten in Python so it is still valid but it does not do what you want. query1 and query2 ALWAYS returns just query2. Massimo On Jun 18, 8:58 am, weheh richard_gor...@verizon.net wrote: I'm using web2py 1.64.1. I'm seeing a strange behavior in my query. I'm trying to isolate a record using a compound and clause ... very simple stuff: records = db( (db.x.a == i) and (db.x.b==0) and (db.x.c==None) and ...).select(db.x.ALL) But, it returns a whole bunch of records that have nothing to do with my match criteria. I redid the search with an or clause instead, (don't ask me why I did this 'cause it makes no sense to me): records = db( (db.x.a == i) or (db.x.b==0) or (db.x.c==None) or ...).select(db.x.ALL) and believe it or not, this works fine. I think I'm going nuts! Why should this work? --
[web2py] Re: Requiring password on registration
Looks like a bug in the wizard: db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key) should be: db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key,min_length =4) Actually, maybe the wizard should simply use auth.define_tables() instead of manually creating the auth_user table -- would be easier to keep the wizard consistent with standard apps. Anthony On Saturday, August 11, 2012 8:40:12 PM UTC-4, Yarin wrote: Anthony- I'm on 1.99.7 stable. Just tried it it with a fresh basic app and there the problem doesn't exist. However, if you use the *app wizard*, and just click through accepting all the defaults, it will recreate the issue. Note also that it DOES allow logging in with no password subsequent to the registration. Adding the requires.insert(0,IS_LENGTH(minsize=5)) has no effect. I've attached the app I just generated with the wizard on all default settings. On Saturday, August 11, 2012 7:10:29 PM UTC-4, Anthony wrote: Anthony's correct- this is in Auth, but is not being respected: settings.password_min_length = 4 I just created a fresh app using trunk, and when I try to register without a password, I get a too short error message on the password field. What version of web2py are you using? Can we see your Auth related code? Or maybe you can pack and attach a simple app that exhibits the behavior. Massimo - For security reason it will not be accepted for logging anyway. - Not sure what you meant but it registered me and logged me in with an empty pass. By default, when you first register, you are automatically logged in upon registration (this can be disabled). I think Massimo meant that subsequently you will not be able to continue to login with an empty password. I also tried inserting: db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5)) What happens whey you try that -- does it generate an error, or simply allow you to register without a password? Anthony --
[web2py] Re: Strange behavior db( ... and ... and ...) vs. db( ... or ... or ...)
http://web2py.com/books/default/chapter/29/6#Logical-operators Specifically: Due to Python restrictions in overloading and and or operators, these cannot be used in forming queries. The binary operators and | must be used instead. Note that these operators (unlike and and or) have higher precedence than comparison operators, so the extra parentheses in the above examples are mandatory. Did you have something else in mind? Anthony On Saturday, August 11, 2012 8:57:38 PM UTC-4, Yarin wrote: Massimo, could we highlight this issue in the documentation somewhere, and/or show the right way to do a compound query. There's no documentation on this stuff, it's very easy to accidentally do because won't throw a syntax error, and we almost just shipped some production code with 'and' instead of On Thursday, June 18, 2009 11:43:37 AM UTC-4, mdipierro wrote: follow up query1 or query2 IS INVALID SYNTAX query1|query2 IS CORRECT or cannot be overwritten in Python so it is still valid but it does not do what you want. query1 or query2 ALWAYS returns just query1. Massimo On Jun 18, 10:43 am, mdipierro mdipie...@cs.depaul.edu wrote: query1 and query2 IS INVALID SYNTAX query1query2 IS CORRECT and cannot be overwritten in Python so it is still valid but it does not do what you want. query1 and query2 ALWAYS returns just query2. Massimo On Jun 18, 8:58 am, weheh richard_gor...@verizon.net wrote: I'm using web2py 1.64.1. I'm seeing a strange behavior in my query. I'm trying to isolate a record using a compound and clause ... very simple stuff: records = db( (db.x.a == i) and (db.x.b==0) and (db.x.c==None) and ...).select(db.x.ALL) But, it returns a whole bunch of records that have nothing to do with my match criteria. I redid the search with an or clause instead, (don't ask me why I did this 'cause it makes no sense to me): records = db( (db.x.a == i) or (db.x.b==0) or (db.x.c==None) or ...).select(db.x.ALL) and believe it or not, this works fine. I think I'm going nuts! Why should this work? --
[web2py] Re: Requiring password on registration
Note also that it DOES allow logging in with no password subsequent to the registration. Right, it looks like login will allow no password if password length is enforced only by CRYPT (it actually overrides the CRYPT min_length attribute). I don't think it will override IS_STRONG or IS_LENGTH, though. Adding the requires.insert(0,IS_LENGTH(minsize=5)) has no effect. I'm not able to unpack/install the app you attached (seems to be corrupted), but when I insert IS_LENGTH in my own test app as you have above, it works fine. Would have to see your code to figure out what's wrong. Anthony --
[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.
I never got this to work, as I mentioned above auth.define_tables(username=True) db.auth_user.username.requires.insert(0,IS_MATCH([a-z].*)) I get this error: *Ticket ID* 127.0.0.1.2012-08-11.23-47-00.29b15810-8243-46b8-802f-153225e295fe type 'exceptions.AttributeError' 'tuple' object has no attribute 'insert' I now understand the .insert with lists etc, and why if I don't .insert, it will not fire the web2py validators. But I don't see what is wrong with the example Thanks, Rob Rob On Friday, August 10, 2012 3:09:00 PM UTC-4, Anthony wrote: On Friday, August 10, 2012 2:12:54 PM UTC-4, Rob_McC wrote: Anthony: You're correct about log gin out and back in, but I did gain access to jsmith's account upon registration, and* I could (and did)* * change his password in profile, and now I control his account *- locking smith out. I did assume that the old validator *would still fire,* and not be replaced with just my validator.- but used WITH my validator. db.auth_user.username.requires = [list, of, validators] db.auth_user.username.requires = IS_MATCH(...) The above replaces a list with a single validator. In Python, if you assign a new value to an object that was a list, it does not get appended to the list -- it replaces the list (as it would replace any other type of object). If you want to mutate an existing list, you have to use .insert(), .append(), .extend(), +, etc., which is what Massimo originally instructed. Also, the book section on customizing Auth says the following: If you add a field called username, it will be used in place of email for login. If you do, you will need to add a validator as well: 1. auth_table.username.requires = IS_NOT_IN_DB(db, auth_table.username) I suppose we could add a sterner warning, though. Perhaps we should force an IS_NOT_IN_DB validator on username/email when registration is processed in case there isn't one. Anthony --
Re: [web2py] Re: Strange behavior db( ... and ... and ...) vs. db( ... or ... or ...)
Sorry- I missed that altogether. On Sat, Aug 11, 2012 at 11:25 PM, Anthony abasta...@gmail.com wrote: http://web2py.com/books/default/chapter/29/6#Logical-operators Specifically: Due to Python restrictions in overloading and and or operators, these cannot be used in forming queries. The binary operators and | must be used instead. Note that these operators (unlike and and or) have higher precedence than comparison operators, so the extra parentheses in the above examples are mandatory. Did you have something else in mind? Anthony On Saturday, August 11, 2012 8:57:38 PM UTC-4, Yarin wrote: Massimo, could we highlight this issue in the documentation somewhere, and/or show the right way to do a compound query. There's no documentation on this stuff, it's very easy to accidentally do because won't throw a syntax error, and we almost just shipped some production code with 'and' instead of On Thursday, June 18, 2009 11:43:37 AM UTC-4, mdipierro wrote: follow up query1 or query2 IS INVALID SYNTAX query1|query2 IS CORRECT or cannot be overwritten in Python so it is still valid but it does not do what you want. query1 or query2 ALWAYS returns just query1. Massimo On Jun 18, 10:43 am, mdipierro mdipie...@cs.depaul.edu wrote: query1 and query2 IS INVALID SYNTAX query1query2 IS CORRECT and cannot be overwritten in Python so it is still valid but it does not do what you want. query1 and query2 ALWAYS returns just query2. Massimo On Jun 18, 8:58 am, weheh richard_gor...@verizon.net wrote: I'm using web2py 1.64.1. I'm seeing a strange behavior in my query. I'm trying to isolate a record using a compound and clause ... very simple stuff: records = db( (db.x.a == i) and (db.x.b==0) and (db.x.c==None) and ...).select(db.x.ALL) But, it returns a whole bunch of records that have nothing to do with my match criteria. I redid the search with an or clause instead, (don't ask me why I did this 'cause it makes no sense to me): records = db( (db.x.a == i) or (db.x.b==0) or (db.x.c==None) or ...).select(db.x.ALL) and believe it or not, this works fine. I think I'm going nuts! Why should this work? -- --
Re: [web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.
On 11 Aug 2012, at 8:51 PM, Rob_McC mrmccorm...@gmail.com wrote: I never got this to work, as I mentioned above auth.define_tables(username=True) db.auth_user.username.requires.insert(0,IS_MATCH([a-z].*)) I get this error: Ticket ID 127.0.0.1.2012-08-11.23-47-00.29b15810-8243-46b8-802f-153225e295fe type 'exceptions.AttributeError' 'tuple' object has no attribute 'insert' I now understand the .insert with lists etc, and why if I don't .insert, it will not fire the web2py validators. But I don't see what is wrong with the example Tuples, unlike lists, are immutable, so no insert. I suppose you could write db.auth_user.username.requires = (IS_MATCH([a-z].*),) + db.auth_user.username.requires --
[web2py] Re: Enforcing - like gmail: first character of your username should be a letter (a-z) or number.
I never got this to work, as I mentioned above auth.define_tables(username=True) db.auth_user.username.requires.insert(0,IS_MATCH([a-z].*)) Is that the exact code, with nothing coming between the auth = Auth(...) line (not shown above) and the auth.define_tables() line, and nothing coming between the above two lines? I ask because when auth.define_tables() creates the auth_user table, the username field gets a list of validators, not a tuple. Somewhere in your code, it's getting a tuple of validators. Anthony --
[web2py] Trouble with pickling session
My app doesn't want to pickle my session for some reason. I get: Traceback (most recent call last): File /data-current/programming/python/web2py/gluon/main.py, line 523, in wsgibase session._try_store_on_disk(request, response) File /data-current/programming/python/web2py/gluon/globals.py, line 591, in _try_store_on_disk cPickle.dump(dict(self), response.session_file) TypeError: expected string or Unicode object, NoneType found This occurs on return from a function call. Immediately before the call I check that session_file and session exist. session_file seems to exist and is open: session file: open file '/data-current/programming/python/web2py/applications/testAjax/sessions/127.0.0.1-ac75411a-2223-4ad8-8b0d-fdc84d976fd6', mode 'rb+' at 0x237f0c0 Any ideas what would cause this? There is a class in session with 4 levels of inheritance would that be a problem? Thanks Brendan --