[web2py] Re: Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-18 Thread lesssugar
but it will not work on centos 6 due to differences is these two systems. On Tuesday, November 11, 2014 12:29:34 PM UTC+1, lesssugar wrote: Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking for deployment script, as I'm no expert. Apache and MySQL is in place, but I'm

[web2py] Re: web2py deployment: Apache, Nginx and Plesk Panel

2014-11-14 Thread lesssugar
On Thursday, November 13, 2014 12:01:13 AM UTC+1, lesssugar wrote: Does anyone have experience with setting up web2py with Plesk Panel preinstalled on the server? I'm using a VPS with one IP, CentOS 6.6. Initially I wanted to setup Nginx with uWSGI, however Plesk won't work in this configuration

[web2py] web2py deployment: Apache, Nginx and Plesk Panel

2014-11-12 Thread lesssugar
Does anyone have experience with setting up web2py with Plesk Panel preinstalled on the server? I'm using a VPS with one IP. Initially I wanted to setup Nginx with uWSGI, however Plesk won't work in this configuration (it needs Apache). Apache service could be stopped permanently and web2py

[web2py] Deployment script for CentOS: apache + mod_wsgi + msql

2014-11-11 Thread lesssugar
Hi, guys, I would like to setup web2py on my CentOS 6.6 and I'm looking for deployment script, as I'm no expert. Apache and MySQL is in place, but I'm looking for relatively painless way to automatically install web2py, configure mod_wsgi etc. Any help? -- Resources: - http://web2py.com -

[web2py] Re: Restore missing web2py.socket

2014-06-03 Thread lesssugar
, 2014 5:52:33 PM UTC+2, lesssugar wrote: I used the following script for the setup: http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-centos64.sh I tried recreating logs folder under /var/www/web2py/, restarting uwsgi and nginx - unfortunately the error occurs. Do I need to add

[web2py] Re: Restore missing web2py.socket

2014-06-01 Thread lesssugar
that file. The second step would be to review carefully the configuration ^_^ On Saturday, May 31, 2014 2:30:22 PM UTC+2, lesssugar wrote: I'm using web2py's nginx + uwsgi + centos configuration and I accidentally removed web2py/logs folder on my server. Now I get 502 bad gateway whenever I try

[web2py] Restore missing web2py.socket

2014-05-31 Thread lesssugar
I'm using web2py's ngix + uwsgi + centos configuration and I accidentally removed web2py/logs folder on my server. Now I get 502 bad gateway whenever I try to open my page. nginx error log: 2014/05/31 13:16:50 [crit] 762#0: *1052 connect() to unix:///var/www/web2py/logs/web2py.socket failed

[web2py] Check file size before upload process

2014-01-26 Thread lesssugar
I'm using IS_LENGTH in my model to validate file size of uploaded image: IS_LENGTH(2097152, 1, error_message='Max image size: 2MB') However, the size is being checked after the file's been uploaded, which is not very user friendly when it comes to files larger than 2MB. How can I validate the

[web2py] Re: Append reCaptcha after a field

2013-11-30 Thread lesssugar
Boths ways work great. Thanks a lot. On Saturday, November 30, 2013 7:40:42 AM UTC+1, Massimo Di Pierro wrote: Or register_form.element('table').append(TR(...)) On Friday, 29 November 2013 18:34:38 UTC-6, 黄祥 wrote: please try (not tested) : register_form[0].insert(-1,TR('',

[web2py] Append reCaptcha after a field

2013-11-29 Thread lesssugar
I use auth.register() to create my registration form. I managed to add reCaptcha to it, however it's appended after my submit button. The current code: register_form[0].append(Recaptcha(request, '', '', options=theme:'white',

[web2py] Basic routes.py question

2013-11-20 Thread lesssugar
Just let my understand it. I created a basic routes.py file in my web2py/ folder. The whole content is: default_application = 'myapp'# ordinarily set in base routes.py default_controller = 'default' # ordinarily set in app-specific routes.py default_function = 'index' # ordinarily set

[web2py] Re: Basic routes.py question

2013-11-20 Thread lesssugar
Very useul post, Jonathan. And the router works great, thanks. On Wednesday, November 20, 2013 3:20:22 PM UTC+1, lesssugar wrote: Just let my understand it. I created a basic routes.py file in my web2py/ folder. The whole content is: default_application = 'myapp'# ordinarily set

[web2py] web2py and PIL: The _imaging C module is not installed

2013-10-20 Thread lesssugar
I'm trying to use web2py slice to make images thumbnails: http://www.web2pyslices.com/slice/show/1522/generate-a-thumbnail-that-fits-in-a-box The script worked fine with web2py 2.4.7. When upgraded to 2.7.4, when I;m uploading an image, I get this: * File [path]/PIL/Image.py, line 37, in

[web2py] Re: Simple routes.py and no access to Admin

2013-10-18 Thread lesssugar
: http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-centos64.sh so Nginx 1.4.1 + uWSGI + Web2py. Am I missing something? I'mkeep getting Ticket issued: unrecoverable in my admin page. On Thursday, October 17, 2013 7:11:16 PM UTC+2, lesssugar wrote: Hi. I put dummy routes.py file

[web2py] Re: Change target of edit profile link permanently

2013-10-18 Thread lesssugar
What do you mean? On Friday, October 18, 2013 1:57:13 PM UTC+2, Andreas Wienes wrote: What is the best way to change the target of the edit profile link permanently? Thanks for your help! Andreas -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Simple routes.py and no access to Admin

2013-10-17 Thread lesssugar
Hi. I put dummy routes.py file in my web2py/ folder. All there is in this: routers = dict( # base router BASE=dict( default_application='my_app_name', ), ) I reload web2py with *touch /etc/uwsgi/web2py.ini *on my server. The default application route works but when I go to

[web2py] LOAD() not working after upgrading to 2.7.4

2013-10-16 Thread lesssugar
Just upgraded to 2.7.4. My LOAD() based component is not displaying, although it worked in the older version of web2py (2.4.7). I copied web2py.js from the newest welcome application to my app/static/js/ folder. What can be wrong? -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: LOAD() not working after upgrading to 2.7.4

2013-10-16 Thread lesssugar
cached version working. Make sure that your page fetches the correct web2py.js, then post a simple app to reproduce the issue if the problem isn't solved. On Wednesday, October 16, 2013 9:11:14 PM UTC+2, lesssugar wrote: Just upgraded to 2.7.4. My LOAD() based component is not displaying

[web2py] Re: LOAD() not working after upgrading to 2.7.4

2013-10-16 Thread lesssugar
On Wednesday, October 16, 2013 9:24:40 PM UTC+2, lesssugar wrote: Sh*t, it was the cache indeed Sorry guys. And thanks Niphlod. On Wednesday, October 16, 2013 9:19:01 PM UTC+2, Niphlod wrote: to make it short, it should work, and usually peoples reporting this bug quickly realize

[web2py] web2py - one step deployment - now what? :)

2013-10-14 Thread lesssugar
Hi, I'm planning to bring my app to life. So far, I have followed one-step-production deployment guides and used this script: http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-centos64.sh All the setup has been completed on my server, now I would like to upload my application

[web2py] Re: web2py - one step deployment - now what? :)

2013-10-14 Thread lesssugar
. On Monday, October 14, 2013 10:06:53 PM UTC+2, Anthony wrote: One option is to upload it through the admin interface. On Monday, October 14, 2013 3:53:43 PM UTC-4, lesssugar wrote: Hi, I'm planning to bring my app to life. So far, I have followed one-step-production deployment guides

[web2py] Re: web2py - one step deployment - now what? :)

2013-10-14 Thread lesssugar
away). Anthony On Monday, October 14, 2013 4:19:03 PM UTC-4, lesssugar wrote: Sure, I understand. That's the main question: how do I get to admin or any other application now? Let's say I want to display the welcome application. When I run web2py.py on the server I still get the information

[web2py] Re: web2py - one step deployment - now what? :)

2013-10-14 Thread lesssugar
Now, however, I can't get to admin. The password was set during the one step deployment but I cannot get to admin panel with the pass. Any way to retrieve it? On Monday, October 14, 2013 10:56:57 PM UTC+2, lesssugar wrote: OK, I had apache running and blocking the port. Stopped apache

[web2py] Re: web2py - one step deployment - now what? :)

2013-10-14 Thread lesssugar
Nevermind, figured it out. On Monday, October 14, 2013 11:09:31 PM UTC+2, lesssugar wrote: Now, however, I can't get to admin. The password was set during the one step deployment but I cannot get to admin panel with the pass. Any way to retrieve it? On Monday, October 14, 2013 10:56:57 PM

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
UTC-4, lesssugar wrote: OK, I removed next from auth.change_password(). Now, after submitting, I'm being redirected to default/index and the default flash message appears. The thing is I would like to stay on Settings page after changing the password - hence I tried next. Is there a way

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
:44 UTC-5, lesssugar wrote: I'm using auth.change_password() in my profile Settings section. The code responsible for the form: change_password = auth.change_password(next=URL('profile', 'settings')) change_password.update(_class='formstyle', _name='change_password') return dict

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
Anthony, it worked. I was staring at this code and didn't see it. Thanks a lot. On Sunday, October 13, 2013 3:44:39 PM UTC+2, Anthony wrote: change_password = auth.change_password(next=URL('profile', 'settings')) When the password change form is submitted, the above sets session.flash to

[web2py] Re: auth.change_password() - no flash message

2013-10-13 Thread lesssugar
there is something that sets session.flash=None before redirection or response.flash=None after redirection. Double redirection may also cause the flash to disappear. On Sunday, 13 October 2013 08:42:49 UTC-5, lesssugar wrote: You're right. When I changed the page to redirect after password change

[web2py] auth.change_password() - no flash message

2013-10-12 Thread lesssugar
I'm using auth_change_password() in my profile Settings section. The code responsible for the form: change_password = auth.change_password(next=URL('seafarer', 'settings')) change_password.update(_class='formstyle', _name='change_password') return dict(change_password=change_password) The

[web2py] Re: auth.change_password() - no flash message

2013-10-12 Thread lesssugar
, there is already a default message set (Password changed.), so if you're not seeing it, something is going wrong. Do you get other flash messages? Maybe confirm that session.flash is being set. Anthony On Saturday, October 12, 2013 5:23:44 PM UTC-4, lesssugar wrote: I'm using

[web2py] Re: auth, redirect after login

2013-10-11 Thread lesssugar
Did you try using *next* in your login function? user_auth = auth.login(next=URL('controller_name', 'function_name') On Friday, October 11, 2013 2:34:35 PM UTC+2, LightOfMooN wrote: In v 2.7.2 don't work redirects after login and logout. How to fix it? четверг, 27 июня 2013 г., 19:36:27

[web2py] Re: auth, redirect after login

2013-10-11 Thread lesssugar
tried. It works with login, but not with logout. пятница, 11 октября 2013 г., 22:37:20 UTC+6 пользователь lesssugar написал: Did you try using *next* in your login function? user_auth = auth.login(next=URL('controller_name', 'function_name') On Friday, October 11, 2013 2:34:35 PM UTC+2

[web2py] Re: auth, redirect after login

2013-10-11 Thread lesssugar
login. If i go to url /default/user/logout?_next=blablabla, I stay at /default/user/logout after logout. Redirect doesn't work there. пятница, 11 октября 2013 г., 23:04:36 UTC+6 пользователь lesssugar написал: What do you mean it doesn't wok with logout? Linking your logout to /default/user

[web2py] Re: auth, redirect after login

2013-10-11 Thread lesssugar
on /default/user/logout page. It's terrible. пятница, 11 октября 2013 г., 23:18:19 UTC+6 пользователь lesssugar написал: How about a simple logout-link: a href={{=URL('default', 'user', args='logout')}}Logout/a This also does not redirect to default/index when clicked? On Friday, October 11, 2013 7

[web2py] Re: grid layout problem

2013-10-08 Thread lesssugar
web2py's default layout is not responsive. If you're facing problems with displaying the tables, you should overwrite the CSS to adapt the columns behaviour. On Tuesday, October 8, 2013 2:06:13 PM UTC+2, stefaan wrote: Hello all, I noticed the following when using a grid with some links

[web2py] Re: Unsuccessful password reset

2013-10-07 Thread lesssugar
. On Sunday, 6 October 2013 11:53:27 UTC-5, lesssugar wrote: Massimo (or anyone willing to help), all I'm trying to achieve is use my own email template to send a password-reset message to user. How do I do this properly? Currently, I have this *db.py* auth.messages.reset_password

[web2py] Re: Unsuccessful password reset

2013-10-07 Thread lesssugar
must be in mailing/pass_reset.html. Can you show us that file? On Monday, 7 October 2013 04:17:53 UTC-5, lesssugar wrote: Your problem does not come from the code you show us When I comment this piece of code *(A)*: auth.messages.reset_password = response.render( 'mailing

[web2py] Re: Unsuccessful password reset

2013-10-07 Thread lesssugar
October 2013 09:04:07 UTC-5, lesssugar wrote: Here's the code of mailing/pass_reset.html: {{extend 'mailing/template.html'}} tr td bgcolor=#ff style=padding: 40px 30px 40px 30px; table border=0 cellpadding=0 cellspacing=0 width=100% tbody tr

[web2py] Re: 'SQLFORM' object has no attribute 'error'

2013-10-07 Thread lesssugar
Shouldn't it be *form.errors*? On Monday, October 7, 2013 11:20:32 PM UTC+2, raferbop wrote: # Model/db.py db = DAL('sqlite://storage.sqlite') db.define_table( 'person', Field('name', requires=IS_NOT_EMPTY(error_message=auth.messages. is_empty)), Field('email',

[web2py] Re: DAL query for this SQL

2013-10-07 Thread lesssugar
In general: db(your_condition).select(db.table_name.ALL, orderby=~db.table_name.logtime) As for your_condition, Python's timedelta should be useful: http://docs.python.org/2/library/datetime.html#datetime.timedelta On Tuesday, October 8, 2013 3:56:33 AM UTC+2, Dave S wrote: On Monday,

[web2py] Re: Unsuccessful password reset

2013-10-06 Thread lesssugar
:14:17 UTC-5, lesssugar wrote: Sorry, Massimo, but I really don't get it. Is the slash causing the problem? I use '[controller_name]/[view_name.html]' to render other emails and it's all ok. I even tried to do it this way in the mailing view: a href={{=URL('default','user', args

[web2py] Re: Unsuccessful password reset

2013-10-02 Thread lesssugar
2013 13:26:46 UTC-5, lesssugar wrote: I'm trying to send a custom email template to user when they perform password reset: *db.py:* auth.messages.reset_password = response.render( 'mailing/pass_reset.html', dict(subject=Password reset, link=URL('default','user', args

[web2py] Re: How to program a form for one to many relations?

2013-10-02 Thread lesssugar
Or you could store all the things as a string and split it nicely in the view, when displaying ;) On Wednesday, October 2, 2013 5:16:18 PM UTC+2, Andreas Wienes wrote: Hey guys, in the web2py-book is an example for a one-to-many relation.

[web2py] Unsuccessful password reset

2013-10-01 Thread lesssugar
I'm trying to send a custom email template to user when they perform password reset: *db.py:* auth.messages.reset_password = response.render( 'mailing/pass_reset.html', dict(subject=Password reset, link=URL('default','user', args='reset_password'))) and in

[web2py] Re: Performance: number of queries vs. script run time

2013-09-30 Thread lesssugar
parsing a specific feed and inserts results into the db. I guess I'll really start to worry when there's actually something to worry (e.g. high server load). On Monday, September 30, 2013 1:58:32 PM UTC+2, LightDot wrote: @lesssugar Define efficient. :) Are you after a shorter overall execution

[web2py] Performance: sleep vs. queries

2013-09-29 Thread lesssugar
In my app I have a script running in the background 3 times a day. The script generates lots of inserts into the db. In terms of performance, which one of the two below is better? 1) Leaving the script as it is = many insert actions at one time / script runs shorter 2) Using time.sleep() after

[web2py] Re: Performance: number of queries vs. script run time

2013-09-29 Thread lesssugar
That was a theoretical question. I'm asking because I don't know which approach is better. There's no specific issue I'm trying to address. I just want to find out which way is more efficient. -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Parsing only first items with Python's feedparser

2013-09-28 Thread lesssugar
In the RSS aggregator section, the web2py's book shows an example taht uses Python's feedparser (http://pythonhosted.org/feedparser/): d = feedparser.parse(url) - this way all the items in the feed get parsed. However, some of external RSS feeds may take lots of time to parse. Does anyone

[web2py] RSS - storing news in database

2013-09-27 Thread lesssugar
I'm planning to implement RSS aggregator in my app, using instruction from the book: http://web2py.com/books/default/chapter/29/10/services?search=rss#RSS The twist is to firstly store the news in my database, and display the feed using the stored data. My questions: 1) Does anyone know

[web2py] Re: feed not updating on the page

2013-08-24 Thread lesssugar
Can I ask, what would be the best way to cache the feed action? I'm currently working on my own feed as well but I'm not experienced in implementing caching. On Saturday, August 24, 2013 8:18:13 PM UTC+2, Alan Etkin wrote: I'm trying to display a feed on my page that needs to update about

[web2py] Re: urlify - no char mapping

2013-08-18 Thread lesssugar
/gluon/validators.py#L2525 If you can suggest improvements I will happy to include them. I guess the problem is here: https://github.com/web2py/web2py/blob/master/gluon/validators.py#L2534 Massimo On Friday, 16 August 2013 07:39:50 UTC-5, lesssugar wrote: I'm using the following module

[web2py] Re: urlify - no char mapping

2013-08-17 Thread lesssugar
, lesssugar wrote: Oh, I wasn't aware that IS_SLUG.urlify() is a part of our great framework :) I thought urlify is an external Python module. Anyway, found docs here: http://www.web2py.com.ar/examples/global/vars/IS_SLUG/urlify Thanks! On Saturday, August 17, 2013 12:00:52 AM UTC+2, Massimo

[web2py] urlify - no char mapping

2013-08-16 Thread lesssugar
I'm using the following module to convert my urls: http://pydoc.net/Python/redsolutioncms.django-hex-storage/0.1.1/pinyin.urlify/ I have urlify.py (main function) and maps.py (chars mapping) in my /modules. I test it in one of my views, simply trying to print the urlify-ed value in the

[web2py] Re: urlify - no char mapping

2013-08-16 Thread lesssugar
: There is a IS_SLUG.urlify() which is probably better than Django's. ;-) On Friday, 16 August 2013 07:39:50 UTC-5, lesssugar wrote: I'm using the following module to convert my urls: http://pydoc.net/Python/redsolutioncms.django-hex-storage/0.1.1/pinyin.urlify/ I have urlify.py

[web2py] Re: LOAD() not working

2013-08-14 Thread lesssugar
that demonstrates the problem? Anthony On Tuesday, August 13, 2013 5:48:27 AM UTC-4, lesssugar wrote: Thanks, Joe, I'm getting some progress... When changed to ajax=False, the feedback form displays correctly on all the pages. However, with ajax set to False, the feedback is not being sent to my

[web2py] Re: LOAD() not working

2013-08-14 Thread lesssugar
UTC-4, lesssugar wrote: If you view the network requests in the browser developer tools and refresh the page, do you see a request to suggestions.load (...)? Yes, there is the request to suggestions.load in the Network tab on the pages where LOAD works. None suggestions.load in the same

[web2py] Re: LOAD() not working

2013-08-14 Thread lesssugar
Yep, the calendar WAS the issue here I commented the calendar function in web2py.js and all works great. Didn't expect it to be the problem at all. Thank you for the hint :) On Wednesday, August 14, 2013 3:16:17 PM UTC+2, lesssugar wrote: I get this in console: Uncaught ReferenceError

[web2py] Re: LOAD() not working

2013-08-13 Thread lesssugar
? If you can separate those and test them one at a time, you can make progress on the problem. -- Joe On Sunday, August 11, 2013 7:04:36 AM UTC-7, lesssugar wrote: Both web2py.js and jquery.js are loaded and accessible. There are no JS errors shown in console, all looks normal - but there's

[web2py] 404 not found on registration

2013-08-13 Thread lesssugar
I'm getting *404 not found* error when I submit my registration form. After submitting the registration form user should be redirected to his or her profile. That's it. 1. I haven't changed a thing in the registration function 2. Registration worked fine until now 3. All I did today was add an

[web2py] Re: 404 not found on registration

2013-08-13 Thread lesssugar
I'm not sure what to show, I mean, what would be useful as I don't know what's going on totally. Let's say I want to register as a seafarer registration function (default/register): def register(): response.view = 'default/join.html' auth.settings.formstyle = 'divs' if not

[web2py] Re: 404 not found on registration

2013-08-13 Thread lesssugar
You're right! I probably copied the piece of code from something else I wrote. Thanks. On Tuesday, August 13, 2013 2:54:49 PM UTC+2, Anthony wrote: def add_group_and_permissions(form): group_id = auth.id_group(role=request.args(0, cast=int)) If registration was working previously,

[web2py] LOAD() not working

2013-08-11 Thread lesssugar
I'm using LOAD() for displaying a feedback form available on every page. I placed the form in layout.html: {{=LOAD('default','suggestions.load',ajax=True)}} The form loads correctly on most of the pages. However there some where the LOAD component does not work (no suggestions.load request is

[web2py] Re: LOAD() not working

2013-08-11 Thread lesssugar
Both web2py.js and jquery.js are loaded and accessible. There are no JS errors shown in console, all looks normal - but there's none .load request sent at all. The few pages where LOAD doesn't work include a respective form and other javascript. Commenting the javascript doesn't solve the

[web2py] Friendly URLs and routes.py

2013-08-11 Thread lesssugar
I need to create user profile URL based on user's name and last name, replacing all special characters with the allowed ones. How do I achieve this with routes.py? Can't find a straight answer on this subject in the book nor on the forum. -- --- You received this message because you are

[web2py] Re: Clarification needed: Multiple forms

2013-08-02 Thread lesssugar
form1 and form2 are just variables' names - they store the same HTML helper code. Notice that *_name='name' *is just a general example. Maybe it would be a little bit clearer if the _name values in the book were different: form_one, form_two. But that's basically it. You need to distinguish the

[web2py] Re: How write subquery of LEFT JOIN using DAL?

2013-07-29 Thread lesssugar
Probably the most comfortable way to do it is to use *executesql:* http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#executesql * * On Monday, July 29, 2013 12:00:20 PM UTC+2, Denis Rykov wrote: Please help me to write the following SQL query using DAL: SELECT

[web2py] Re: Setting hidden fields with custom SQLFORMs

2013-07-29 Thread lesssugar
Take a look at the book: http://web2py.com/books/default/chapter/29/07/forms-and-validators?search=hidden+fields#Hidden-fields So try defining your hidden field with *hidden *attribute: SQLFORM(..., hidden=dict(hidden_field_name=hidden_field_value)) It should work. On Monday, July 29, 2013

[web2py] Re: Password reset forms - no validation

2013-07-27 Thread lesssugar
. This is not the case for the reset_password form, hence the problem. Anthony On Friday, July 26, 2013 7:09:02 PM UTC-4, lesssugar wrote: OK, I figured it out. I have a hidden feedback form on every page (generated with LOAD), which appears onclick. So basically when I go to default/user/reset_password I

[web2py] Re: Password reset forms - no validation

2013-07-27 Thread lesssugar
app? On Saturday, July 27, 2013 6:27:51 AM UTC-4, lesssugar wrote: I was too quick with the No action needed marker. It apperars that the new password I create in reset_password is not saved in the DB. 1. I type new password 2 times in the form 2. I submit the form. Password changed flash

[web2py] Re: Password reset forms - no validation

2013-07-26 Thread lesssugar
didn't pass (the _formkey is stored in the session, so often this is due to an issue with the session or cookies). Anthony On Thursday, July 25, 2013 1:50:09 PM UTC-4, lesssugar wrote: No. Cookies are on. I'm not clearing the session explicitly anywhere in the code neither. Just created dummy

[web2py] Re: Password reset forms - no validation

2013-07-26 Thread lesssugar
if there is a _formkey[no_table/create] key in the session and confirm the value stored there is the same as the value in the hidden _formkey field in the form on the HTML page. Anthony On Friday, July 26, 2013 10:51:39 AM UTC-4, lesssugar wrote: It could be something with the session

[web2py] Re: how to iterate over a db.select in default.html

2013-07-26 Thread lesssugar
You could first create the list of links in the controller and then pass it to views via LOAD. Take a look at this (didn't test it but the idea should be clear): def getTags(): #get row object tags = db().select(db.entry.tag,distinct=True) #incialize taglist variable, start with ul

[web2py] Re: Password reset forms - no validation

2013-07-26 Thread lesssugar
: Hmm, hard to say what's going on then, especially given that you can't replicate the problem in a fresh app. On Friday, July 26, 2013 11:23:01 AM UTC-4, lesssugar wrote: Checked it. After the form loads, session['_formkey[no_table/create]'] is the same as the _formkey value in the form

[web2py] Password reset forms - no validation

2013-07-25 Thread lesssugar
I'm using default/user/*request_reset_password* and default/user/* reset_password* in my app. Neither request_reset_password, nor reset_password form performs validation on user's input. Seems strange, as the form is a clear auth(). Code: default/user: def user(): auth.settings.formstyle =

[web2py] Re: Password reset forms - no validation

2013-07-25 Thread lesssugar
Thanks, Anthony, I remofed the if statement and it worked for request_reset_password. However, after I click the link sent to e-mail address, the reset_password form still doesn't process New password and Verify password fields. The inputs can be empty, the passwords can be different - no

[web2py] Re: Password reset forms - no validation

2013-07-25 Thread lesssugar
? On Thursday, July 25, 2013 11:14:21 AM UTC-4, lesssugar wrote: Thanks, Anthony, I removed the if statement and it worked for request_reset_password. However, after I click the link sent to e-mail address, the reset_password form still doesn't process New password and Verify password fields

[web2py] Re: Password reset forms - no validation

2013-07-25 Thread lesssugar
, July 25, 2013 11:49:54 AM UTC-4, lesssugar wrote: When submitting the form with different passwords - the page reloads and that's it. No validation, no error response.flash, nothig. The same issue occurs with the same passwords and with empty inputs. web2py version: 2.4.7-stable On Thursday

[web2py] Re: Prevent specific field from update

2013-07-22 Thread lesssugar
== 'B': del newfieldvalues['field_X'] record.update_record(**newfieldvalues) if db.table[id].field_X == A: #perform full update elif db.table[id].field_X == B: #update all fields except field_X On Sunday, 21 July 2013 08:11:44 UTC-5, lesssugar wrote: When going to update page I would

[web2py] Re: Prevent specific field from update

2013-07-22 Thread lesssugar
) On Monday, 22 July 2013 05:26:41 UTC-5, lesssugar wrote: Hi, Massimo, thanks for the solution, it looks totally fine but I just wasn't clear enough on this - my bad. The thing is I'm using crud.update() to generate the form I described earlier. How would I adapt your code to crud? In my

[web2py] Prevent specific field from update

2013-07-21 Thread lesssugar
When going to update page I would like to check the value of field_X. Then, depending on its current value, field_X should be updated along with the other ones OR be excluded from upload: if db.table[id].field_X == A: #perform full update elif db.table[id].field_X == B: #update all fields

[web2py] web2py_component() and no request being sent

2013-07-20 Thread lesssugar
I'm using *the same* web2py_component() function in 3 different forms in my application. In 2 cases the function gets the job done. In the third form web2py_component() doesn't work - no request is being sent. Do you guys know any reason why web2py_component() wouldn't get triggered? CODE

[web2py] crud - update only one field

2013-07-18 Thread lesssugar
I have a table with 8 fields. I need to create crud.update form only for one of them. There are at least two ways to do it: 1. setting readable / writable attributes of the rest 7 fields to False (rather tedious) 2. or something like this: for f in db.tablename.fields: if f != 'myfield':

[web2py] Re: crud - update only one field

2013-07-18 Thread lesssugar
= record.fieldname) On Thursday, 18 July 2013 09:19:17 UTC-5, lesssugar wrote: I have a table with 8 fields. I need to create crud.update form only for one of them. There are at least two ways to do it: 1. setting readable / writable attributes of the rest 7 fields to False (rather tedious) 2

[web2py] Re: crud - update only one field

2013-07-18 Thread lesssugar
= SQLFORM.factory(Field('fieldname',default = record.fieldname)) if form.process().accepted: record.update_record(fieldname = record.fieldname) On Thursday, 18 July 2013 09:19:17 UTC-5, lesssugar wrote: I have a table with 8 fields. I need to create crud.update form only for one of them

[web2py] Function for downloading files

2013-07-17 Thread lesssugar
There's default/download function, usually used like this on files that were uploaded: a href={{=URL('default', 'download', args=[filename])}}Download/a In this case, I do not want to keep the full download path in my a tag. Instead, when the link is clicked, I would like to redirect to

[web2py] Re: Function for downloading files

2013-07-17 Thread lesssugar
Thanks Alan! On Wednesday, July 17, 2013 10:05:14 PM UTC+2, Alan Etkin wrote: def download_file(): file = db(db.files.user_id == int(request.args(0))).select() for f in file: name = f.name return response.download(name,db) I think that the call to download should be

[web2py] Re: File not stored in uploadfolder

2013-07-16 Thread lesssugar
thing is that if it's available on appadmin and no 'blob' field is involved, it MUST be somewhere in your pc. On Monday, July 15, 2013 6:51:28 PM UTC+2, lesssugar wrote: I have the following upload field definition: ... Field('application', 'upload', uploadfolder=request.application

[web2py] File not stored in uploadfolder

2013-07-15 Thread lesssugar
I have the following upload field definition: ... Field('application', 'upload', uploadfolder=request.application + '/uploads/applications', autodelete=True) ... db.mytable.application.requires = IS_UPLOAD_FILENAME(extension= '(doc|DOC|docx|DOCX|pdf|PDF|odt|ODT|rtf|RTF)', error_message='Use

[web2py] Re: Use Custom Fonts

2013-07-07 Thread lesssugar
Not really a web2py thing. Check the liks below. CSS3 font-face (general usage): http://www.css3.info/preview/web-fonts-with-font-face/ Webfont generator (for the font you downloaded): http://www.fontsquirrel.com/tools/webfont-generator On Sunday, July 7, 2013 9:56:15 PM UTC+2, Hugo Costa

[web2py] Re: dabase connection

2013-07-06 Thread lesssugar
Here's what you look for: http://web2py.com/books/default/chapter/29/06#Connection-strings On Saturday, July 6, 2013 9:09:14 AM UTC+2, balpre...@gmail.com wrote: i have install MySQL and now after creating a table ad its contents , I want to connect it to sever through web2py. so what I need

[web2py] Combining WHERE clauses in DAL

2013-07-01 Thread lesssugar
Quick question: what's the proper way to combine *where *clauses in DAL? 1. When I use , I get doubled select results: db((db.auth_user.registration_key == 'pending') (db.auth_membership.group_id == 2)).select(db.auth_user.id, db.auth_user.email) I get 3, examp...@example.com 3,

[web2py] Re: Combining WHERE clauses in DAL

2013-07-01 Thread lesssugar
Suddenly, after another test registration, works fine. Not sure what's changed... Anyway, should I use or and to combine the clauses? On Monday, July 1, 2013 3:41:51 PM UTC+2, lesssugar wrote: Quick question: what's the proper way to combine *where *clauses in DAL? 1. When I use , I get

[web2py] Combining where clauses in DAL

2013-07-01 Thread lesssugar
1. What's the proper way to use [AND, OR] in DAL's where clauses? Do I use [and / ], [or / ||] ? 2. Does using commas is the equivalent of AND? Like in: row = db(db.table.field_1 == X, db.table.field_2 == Y, db.table.field_3 == Z ).select() -- --- You received this message because you are

[web2py] Re: Combining where clauses in DAL

2013-07-01 Thread lesssugar
an inner joinhttp://web2py.com/books/default/chapter/29/06#Inner-joinswhere you needed one. Anthony On Monday, July 1, 2013 10:34:44 AM UTC-4, lesssugar wrote: 1. What's the proper way to use [AND, OR] in DAL's where clauses? Do I use [and / ], [or / ||] ? 2. Does using commas

[web2py] Re: Validating document extension on upload

2013-06-29 Thread lesssugar
Really, no one? :] Could IS_MATCH help with checking the uploaded file extension? On Saturday, June 29, 2013 1:01:29 AM UTC+2, lesssugar wrote: I need to validate extension of documents being uploaded in my app: doc, pdf, odt, ... . Image upload has its IS_IMAGE validator, which takes

[web2py] Re: Validating document extension on upload

2013-06-29 Thread lesssugar
:45:10 PM UTC+2, lesssugar wrote: Really, no one? :] Could IS_MATCH help with checking the uploaded file extension? On Saturday, June 29, 2013 1:01:29 AM UTC+2, lesssugar wrote: I need to validate extension of documents being uploaded in my app: doc, pdf, odt, ... . Image upload has its

[web2py] Validating document extension on upload

2013-06-28 Thread lesssugar
I need to validate extension of documents being uploaded in my app: doc, pdf, odt, ... . Image upload has its IS_IMAGE validator, which takes extensions argument, so list of accepted extensions can be provided. The only validator I see for non-image uploads is IS_UPLOAD_FILENAME, which takes

[web2py] Re: Encrypting/decrypting db values

2013-06-26 Thread lesssugar
@Niphlod, Thanks very much for your solution. Implemented it, it works -- no errors when inserting/updating data. However, one thing I don't fully get: the data I store using the encryption are displayed as normal strings in the database. I'm not very familiar with encryption specifics but

[web2py] Re: Encrypting/decrypting db values

2013-06-26 Thread lesssugar
, being transparent. Try to inspect your database with an external tool instead. On Wednesday, June 26, 2013 12:19:24 PM UTC+2, lesssugar wrote: @Niphlod, Thanks very much for your solution. Implemented it, it works -- no errors when inserting/updating data. However, one thing I don't fully

[web2py] Encrypting/decrypting db values

2013-06-25 Thread lesssugar
I have values I would like to store encrypted in my db after user inserts them. When displayed, the data should get decrypted. All I know about encryption in web2py is that it uses HMAC+SHA512 by default to store password in auth_user table. The algorithm is of course reversible but how do I

  1   2   >