[web2py:35778] Re: web2py and ajax

2009-11-21 Thread mdipierro
If the ajax is performed by a {{=LOAD('plugin',ajax=True)}} or {{=LOAD('plugin',ajax_trap=True)}} the plugin actions can do: if request.env.http_web2py_component_location: # it was an ajax request On Nov 21, 9:06 pm, "mr.freeze" wrote: > The view is not processed on an ajax request.  If

[web2py:35777] Re: web2py and ajax

2009-11-21 Thread mr.freeze
The view is not processed on an ajax request. If I am sending ajax requests to a controller that also serves a page, then I like to send a variable with the ajax request to let me know: def index(): if request.vars.is_ajax: return DIV('this is an ajax request') ...do normal proce

[web2py:35776] Re: Wiki that uses web2py framework?

2009-11-21 Thread mdipierro
http://wiki.web2py.com/Home On Nov 21, 7:18 pm, waTR wrote: > Yes. The Web2py wiki is made using web2py... > > On Nov 21, 9:38 am, rjeffries wrote: > > > I am reviewing available wikis for (initially) my personal use, but > > hope to > > then go on to something that's more widely available. > >

[web2py:35775] Re: Wiki that uses web2py framework?

2009-11-21 Thread waTR
Yes. The Web2py wiki is made using web2py... On Nov 21, 9:38 am, rjeffries wrote: > I am reviewing available wikis for (initially) my personal use, but > hope to > then go on to something that's more widely available. > > Prefer that wiki be based on Python (although vast majority use PHP) > >

[web2py:35774] Re: Checkboxes display errror on each input, instead of just once for the widget.

2009-11-21 Thread mdipierro
well' This is a bug. I think the proper fix would be to edit html.py and make sure that only checked boxes display the error. On Nov 21, 6:15 pm, "mr.freeze" wrote: > Here's a lame workaround. It's a widget that removes all of the error > divs except the last one: > > def checkboxes_widget(f,v):

[web2py:35773] Re: IS_IN_DB - Label

2009-11-21 Thread mdipierro
No. We have discussed implementing this. The problem is that the only efficient way to do this is via a join. Without a join it would be slow. By using a join it would not work on GAE. To make it efficient on GAE one would have to denormalize or cache them. I think these are important design issue

[web2py:35772] Re: Checkboxes display errror on each input, instead of just once for the widget.

2009-11-21 Thread mr.freeze
Here's a lame workaround. It's a widget that removes all of the error divs except the last one: def checkboxes_widget(f,v): wrapper = DIV(_id="%s_wrapper" % f.name) inp = SQLFORM.widgets.checkboxes.widget(f,v) scr = SCRIPT('jQuery("div[id=\'%s__error\']").slice(0,-1).remove ();' %

[web2py:35771] Re: Internationalization

2009-11-21 Thread Yarko Tymciurak
On Sat, Nov 21, 2009 at 5:55 PM, mdipierro wrote: > > Yarko please stop it until we get other opinions. > I have answered this question two times already. > You can say it again and again it will not change my opinion. > > Yes. The PyCon registration code (not web2py) had a bug. It was > missing

[web2py:35770] Re: web2py and python 2.4

2009-11-21 Thread pepe_eloy
Returning to the theme about install hashlib in python 2.4,, excuse my ignorance, but is it possible to install these packages in a shared environment? (assuming I do not have root access) Regards Jose Eloy Torres --~--~-~--~~~---~--~~ You received this message be

[web2py:35769] Re: DAL: decoding/encoding problem when talking to legacy DBs that are not utf-8 encoded

2009-11-21 Thread mdipierro
Hans you have clearly thought this through. I already have two patches pending from you. May I ask you to consolidate your patches with this one and send it to me? Thank you. Massimo On Nov 21, 3:27 pm, Hans Murx wrote: > Maybe we can give DAL() an optional extra argument 'db_codec' with > defa

[web2py:35768] Re: Internationalization

2009-11-21 Thread mdipierro
Yarko please stop it until we get other opinions. I have answered this question two times already. You can say it again and again it will not change my opinion. Yes. The PyCon registration code (not web2py) had a bug. It was missing T.current_languages=['en','en-us'] T.force(T.http_accep

[web2py:35767] Re: IS_NOT_IN_DB validator raises exception with legacy tables and does not work with informix://

2009-11-21 Thread mdipierro
I will test it. can you please email it to me. Thanks. On Nov 21, 12:49 pm, Hans Murx wrote: > my suggested patch for this issue (self.record_id is a dict with > keyedTables): > > suse101:~/web2py-1436/gluon # diff validators.py.ori validators.py > 404,405c404,410 > <         if len(rows) > 0 an

[web2py:35766] Re: Recaptcha in SQLFORM

2009-11-21 Thread mdipierro
Although you may be able to do this, captcha is not a widget because as pointed out it is not a field. This is the best way. form[0].append(TR('',captcha, '')) Massimo On Nov 21, 12:39 pm, Thadeus Burgess wrote: > I will do this in functions, so resources only get allocated if needed. > > def

[web2py:35765] Wiki that uses web2py framework?

2009-11-21 Thread rjeffries
I am reviewing available wikis for (initially) my personal use, but hope to then go on to something that's more widely available. Prefer that wiki be based on Python (although vast majority use PHP) MoinMoin looks like a good choice so far. Has anyone crafted a wiki that uses wb2py? Thanks --~

[web2py:35764] IS_IN_DB - Label

2009-11-21 Thread Alex
It is possible to use several items in IS_IN_DB label, but how to use column name from refrence table? For example 3 tables: type_class (type_class_name) type (type_class_id, type_name) detail (type_id, detail_name) I can do for "requires" in detail table this: requires=IS_IN_DB(db, 'type.id',

[web2py:35763] Re: Checkboxes display errror on each input, instead of just once for the widget.

2009-11-21 Thread Thadeus Burgess
form = SQLFORM.factory(Field('multiple_options', requires=IS_IN_SET(('Hi', 'Milk', 'Mom', 'Love', 'Santa')), widget=SQLFORM.widgets.checkboxes.widget)) Submit the form without selecting anything, and it displays the error message on each INPUT() helper. You can also change widget to SQLFORM.widge

[web2py:35762] Re: Checkboxes display errror on each input, instead of just once for the widget.

2009-11-21 Thread mr.freeze
Can you post some example code that produces the effect? Just want to make sure I'm understanding the problem correctly. On Nov 21, 1:55 pm, Thadeus Burgess wrote: > http://static.thadeusb.com/web2py_checkboxes_fail.png > > Pleeaze fix!!! > > I have a patch, but it is not backwards-compatibl

[web2py:35761] Re: DAL: decoding/encoding problem when talking to legacy DBs that are not utf-8 encoded

2009-11-21 Thread Hans Murx
Maybe we can give DAL() an optional extra argument 'db_codec' with default 'utf-8'. >> db = DAL('informix://oli:x...@suse101/stammdat', db_codec='latin-1')# >> 'latin-1' instead of 'utf-8' here whenever we retrieve string values as type str from a table we convert them to unicode with code

[web2py:35760] Re: Internationalization

2009-11-21 Thread Yarko Tymciurak
On Sat, Nov 21, 2009 at 9:17 AM, mdipierro wrote: > > If a user requests "en, fr, sp, pl" and the app only has a translation > file for "pl" and the app does not tell web2py that "en" does not need > a translation file, choosing "pl" is the correct behavior. > You have your head down in the code

[web2py:35759] Checkboxes display errror on each input, instead of just once for the widget.

2009-11-21 Thread Thadeus Burgess
http://static.thadeusb.com/web2py_checkboxes_fail.png Pleeaze fix!!! I have a patch, but it is not backwards-compatible. Is this an area where it is a bug, or a feature to have multiple error messages for checkboxes/radio widgets? -Thadeus --~--~-~--~~~---~--~--

[web2py:35758] Re: IS_NOT_IN_DB validator raises exception with legacy tables and does not work with informix://

2009-11-21 Thread Hans Murx
my suggested patch for this issue (self.record_id is a dict with keyedTables): suse101:~/web2py-1436/gluon # diff validators.py.ori validators.py 404,405c404,410 < if len(rows) > 0 and str(rows[0].id) != str(self.record_id): < return (value, self.error_message) --- > i

[web2py:35757] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
I will do this in functions, so resources only get allocated if needed. def captcha_form(): return SQLFORM.factory(db.table.field1, db.table.field2, Field("anti_spam", widget=captcha, default='') def normal_form(): return SQLFORM(db.table) if docaptcha: form = captcha_form() else form

[web2py:35756] Re: Recaptcha in SQLFORM

2009-11-21 Thread mr.freeze
I know what you mean. I don't think it's possible as the form is built SQLFORM's __init__ function. You might have some luck dynamically building a collection of fields then passing them like so: form = SQLFORM.factory(*fields) On Nov 21, 11:56 am, Thadeus Burgess wrote: > Mainly because I re

[web2py:35755] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
The form submits to the server, and the data ends up getting posted. However when the page refreshes, it goes blank and freezes with the message "reading api-secure.recaptcha.net" -Thadeus On Sat, Nov 21, 2009 at 12:20 PM, Thadeus Burgess wrote: > And unfortunately, it seems that using Recap

[web2py:35754] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
And unfortunately, it seems that using Recaptcha in a plugin will not work. ajax_trap seems to be keeping anything from happening. Works fine outside of the plugin It also does not work for the following LOAD(... ajax=True) LOAD(... ajax_trap=True) LOAD(... ajax=False, ajax_trap=False) -Thadeus

[web2py:35753] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
Mainly because I really get agitated when I have to do silly things such as if do_captcha: form = SQLFORM.factory(db.table.field1, db.table.field2, db.table.field3, Field('anti_spam', widget=captcha, default='')) else: form = SQLFORM(db.table) -Thadeus On Sat, Nov 21, 2009 at 11:49 AM

[web2py:35752] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
How do you append a Field() to SQLFORM? Does not look like it is possible. -Thadeus On Sat, Nov 21, 2009 at 11:47 AM, Thadeus Burgess wrote: > I believe it is the way that SQLFORM looks for data in request.vars. > > It will look for a var with the name of the field... > > so > > Field('recapt

[web2py:35751] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
I believe it is the way that SQLFORM looks for data in request.vars. It will look for a var with the name of the field... so Field('recaptcha', widget=captcha) It is expecting a request.vars.recaptcha, which does not exist. You're right, setting default does fix it, sounds like a bug... So it

[web2py:35750] Re: Recaptcha in SQLFORM

2009-11-21 Thread mr.freeze
It seems that setting a default on the field fixes it: form = SQLFORM.factory(Field('test',requires=IS_NOT_EMPTY()), Field('test2',widget=captcha,default='') ) On Nov 21, 11:34 am, "mr.freeze" wrote: > The strange thing is that the captcha v

[web2py:35749] Re: Recaptcha in SQLFORM

2009-11-21 Thread mr.freeze
The strange thing is that the captcha validation actually succeeds (you can test by putting an incorrect value in the captcha form and see if fail properly). I'm not sure why form.accepts is putting no_data into form.errors. Perhaps a bug? On Nov 21, 10:49 am, Thadeus Burgess wrote: > Ideally I

[web2py:35748] Re: IS_NOT_IN_DB validator raises exception with legacy tables and does not work with informix://

2009-11-21 Thread Thadeus Burgess
IS_NOT_IN_DB(legacy=True)? -Thadeus On Sat, Nov 21, 2009 at 9:33 AM, mdipierro wrote: > > Hi Hans, I have your patch and I will be applying it tomorrow. > > Unfortunately the added experimental support for legacy databases > opens issues like this. If we assume less about the table structure

[web2py:35747] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
Ideally I would be able to create a form using SQLFORM(db.table) and then insert the recaptcha field after the fact. I need to be able to display the field in form.custom. But I may just be dreaming here :) Using your example, it gives a no_data error -Thadeus On Sat, Nov 21, 2009 at 9:25 AM,

[web2py:35746] Re: DAL: decoding/encoding problem when talking to legacy DBs that are not utf-8 encoded

2009-11-21 Thread mdipierro
Currently you cannot. Support for legacy databases is not on the same foot as support for databases created by web2py. In particular as you point out the encoding is an issue. One way around is use a custom field type. On Nov 21, 8:58 am, Hans Murx wrote: > example: > > In [1]: db = DAL('inform

[web2py:35745] Re: IS_NOT_IN_DB validator raises exception with legacy tables and does not work with informix://

2009-11-21 Thread mdipierro
Hi Hans, I have your patch and I will be applying it tomorrow. Unfortunately the added experimental support for legacy databases opens issues like this. If we assume less about the table structure then more checks are required which may result in more complex and slower code. Let's all think abou

[web2py:35744] Re: Recaptcha in SQLFORM

2009-11-21 Thread mr.freeze
Something like this?: def index(): use_recaptcha = True recaptcha_public = "..." recaptcha_private = "..." captcha = lambda f,v: Recaptcha(request, recaptcha_public,recaptcha_private) if use_recaptcha else '' form = SQLFORM.factory(Field('test',requires=IS_NOT_EMPTY()),

[web2py:35743] Re: Internationalization

2009-11-21 Thread mdipierro
Calm down please. Speaking louder does not help make your point any better. If a user requests "en, fr, sp, pl" and the app only has a translation file for "pl" and the app does not tell web2py that "en" does not need a translation file, choosing "pl" is the correct behavior. I think there is no

[web2py:35742] DAL: decoding/encoding problem when talking to legacy DBs that are not utf-8 encoded

2009-11-21 Thread Hans Murx
example: In [1]: db = DAL('informix://oli:x...@suse101/stammdat') In [2]: db.define_table("personen", ...: Field("name", length=80), ...: Field("anz", "integer"), ...: primarykey=["name"], ...: migrate=False ...: ) In [3]: a = db().select(db.personen.name)[0].name I

[web2py:35741] Re: Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
And access it through custom form with.. {{=form.custom.widget.recaptcha}} -Thadeus On Sat, Nov 21, 2009 at 8:11 AM, Thadeus Burgess wrote: > Is it possible to append Recaptcha to a SQLFORM, or SQLFORM.factory. > > This would be ideal. > > form = SQLFORM(db.table) > > if somesettings.recaptc

[web2py:35740] Recaptcha in SQLFORM

2009-11-21 Thread Thadeus Burgess
Is it possible to append Recaptcha to a SQLFORM, or SQLFORM.factory. This would be ideal. form = SQLFORM(db.table) if somesettings.recaptcha=True form.append(Recaptcha()) -Thadeus --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[web2py:35739] Re: new on web2pyslices.com: concurrent RPX and web2py auth

2009-11-21 Thread murray3
scratch that!!! I had the full url to auth.settings.rpx_login_domain='http://localhost: 8000'/init/default/index', should have been just 'http://localhost: 8000' Thanks again guy's for this code:) On Nov 21, 12:41 pm, murray3 wrote: > I have tried the rpxAuth module and it allowed me to login us

[web2py:35738] Re: new on web2pyslices.com: concurrent RPX and web2py auth

2009-11-21 Thread murray3
I have tried the rpxAuth module and it allowed me to login using a google account. Did not get auth.user when calling from web2py. I decided to try the original prxAuth module which does not allow for local login and I have the same problem. I have been looking at this for a few hours and not s

[web2py:35737] Re: StackOverflow clone

2009-11-21 Thread Richard
have sent you an email. On Nov 21, 2:25 am, Julio wrote: > Hey Richard, > > I am working on a similar interface 100% web2py, what really would > help me is some sort of technical workflow, or documentation regarding > the handling of the posts, up/down pointing system, notification/ > subscript

[web2py:35736] IS_NOT_IN_DB validator raises exception with legacy tables and does not work with informix://

2009-11-21 Thread Hans Murx
gluon/validators.py lines 403-405: rows = self.dbset(field == value).select(limitby=(0, 1)) if len(rows) > 0 and str(rows[0].id) != str(self.record_id): return (value, self.error_message) - line 404: a field with name 'id' is required, but legacy tables may not have a