Re: [web2py] Re: How to start a thread upon starting of webserver?

2012-07-18 Thread Cédric Mayer
Can't you use in a model. cache.ram('parallel_thread_name', , None) so that you have the thread created at first connection. I don't know how to close it afterwards though. Maybe using a cron job ? Le jeudi 19 juillet 2012 05:24:03 UTC+2, Amit a écrit : > > Hi Massimo, > could you please provide

[web2py] Re: w2b2py book command-line examples

2012-04-07 Thread Cédric Mayer
Personnaly, I created a shortcut (in Windows) in order to test the model of my application: \web2py.exe -M -S Le samedi 7 avril 2012 19:04:09 UTC+2, Jonathan Lundell a écrit : > > In Chapter 6 (DAL), there are a lot of command-line examples (with >>> > prompts) (side note: a lot of them aren't

Re: [web2py] Re: What would be the best way to generate a summary of the 'count(*) 'of all my database table columns?

2012-04-22 Thread Cédric Mayer
I suppose you have somewhere my_legacy_db = DAL(...) In the "db()" part, you need a query (unless in the select, you have the list of fields (not tables) to retrieve), like: my_legacy_db(my_legacy_db.users.id > 0) or my_legacy_db(my_legacy_db.users.name.contains('foo')) or (selectgin fields) :

[web2py] Re: attachment;filename=%s.ics

2012-04-25 Thread Cédric Mayer
You do not give your context so I don't know whether you have access to row, but if you have: {{response.headers['Content-Disposition'] = "attachment;filename=%s_%s.ics" % ( IS_SLUG()(organization.name)[0], row.id)}} It's straight python I think. Le mercredi 25 avril 2012 10:47:57 UTC+2, Annet

[web2py] Re: default/user.html and custom form

2012-05-04 Thread Cédric Mayer
As I needed to build my own submit buttons, or add my own widgets, I use the following function to split a SQLFORM: import re def expurgate_form(web2py_form): ''' Deletes surrounding tag, and submit row. ''' regexp_opening_tag = re.compile("^<[^><]*>") regexp_closing_tag = re

[web2py] Re: default/user.html and custom form

2012-05-06 Thread Cédric Mayer
#x27;table']}} > {{#}} > {{=DIV(form.custom.end[1] # hidden field}} > {{#}} > {{=INPUT('extra button'}} > {{=form.custom.end[0] # }} > > > Notice there is also a form.add_button(....) in trunk. > > On Saturday, 5 May 2012 00:49:38 UTC-5, Cédric Mayer wrote

[web2py] Windows binaries version of Python

2012-05-17 Thread Cédric Mayer
Hello all, I'm developping over web2py source (1.99.7) using Eclipse, with Python (I used to use the version 2.7.2, but now because of my problem I use version 2.5.4 but...). When I think my application is worth it, I zip its folder and I give it to someone else in order to test it. This person

[web2py] Re: Form field deactivate

2012-05-22 Thread Cédric Mayer
SQLFORM.factory( Field('EN','string',requires=IS_IN_DB(db, 'language.id', '%(EN)s', zero= T('choose one')), Field('SP','string',requires=IS_IN_DB(db, 'language.id', '%(SP)s', zero= T('choose one')), table_name="language_link") (replace "language" by your won table name) Then in your

[web2py] apostrophe in db and text area

2012-05-25 Thread Cédric Mayer
Hello ! I have a table with "text" fields: Field('f_comments', type='text', label=T('Comment')), or even: Field('f_form', type='text', label=T('Form'), comment=T('Please write HTML here')), Using appadmin interface, if I use an apostrophe " ' " inside the textarea field

[web2py] Re: apostrophe in db and text area

2012-05-25 Thread Cédric Mayer
x27;ll have a > cross-site scripting vulnerability ( > http://en.wikipedia.org/wiki/Cross-site_scripting). > > Anthony > > On Friday, May 25, 2012 4:35:30 AM UTC-4, Cédric Mayer wrote: >> >> Hello ! >> I have a table with "text" fields: >> Fiel

[web2py] Re: apostrophe in db and text area

2012-05-25 Thread Cédric Mayer
your question. Le vendredi 25 mai 2012 16:09:44 UTC+2, Massimo Di Pierro a écrit : > > If you export the db from appadmin in csv, is the character there? > > On Friday, 25 May 2012 08:53:51 UTC-5, Cédric Mayer wrote: >> >> I tryed to simpllfy my code to post it here,

[web2py] Re: apostrophe in db and text area

2012-05-25 Thread Cédric Mayer
e that will write HTML code using my application will not use unicode characters >>>> On Friday, May 25, 2012 4:35:30 AM UTC-4, Cédric Mayer wrote: >>>>> >>>>> Hello ! >>>>> I have a table with "text" fields: >>>>> F

[web2py] Re: apostrophe in db and text area

2012-05-25 Thread Cédric Mayer
be right that handle_charref contains a bug. Actually more > then the one you report. It is now fixed in trunk. No need to submit a > ticket. > > On Friday, 25 May 2012 09:40:33 UTC-5, Cédric Mayer wrote: >> >> I think I found something ! >> " ' " can

[web2py] Re: Validator for self reference field not referring to itself

2012-05-30 Thread Cédric Mayer
1) You may have problems if you open your application in another language: Field('gender', requires= IS_IN_SET([T('Male'), T('Female')], zero=T('choose one'))), should be Field('gender', requires= IS_IN_SET([('Male',T('Male')), ('Female',T('Female'))], zero=T('choose one'))), 2) The requirement

[web2py] Re: tutorial code: recipes modifying it without success

2012-05-30 Thread Cédric Mayer
In the above controller, you refers to the variable request.vars.category, which refers to a POST or GET variable named "category" So in your link you should have the same variable: {{=A("recipes",_href=URL('recipes',vars=dict(*category*= )))}} You then replace with a known ca

[web2py] Re: Pointing labels to input elements

2012-05-30 Thread Cédric Mayer
http://www.web2py.com/books/default/chapter/29/7#CSS-conventions should answer your request. Le mercredi 30 mai 2012 03:32:16 UTC+2, James O'Neill a écrit : > > How do I get the generated ID for an input element when using > form.custom.widget.fieldname? I need to populate the FOR attribute on t

[web2py] Re: Regex problem in custom validator

2012-06-02 Thread Cédric Mayer
Can you give us some examples ? Le vendredi 1 juin 2012 17:49:02 UTC+2, monotasker a écrit : > > I have a db field that holds a regular expression (one unique regex for > each row in the table). Another row in the table > (db.steps.readable_response) lists sample strings that should satisfy the

[web2py] Re: Empty "db stats" and "db tables" in response.toolbar() despite database connection - MySQL

2012-11-16 Thread Cédric Mayer
I confirm the bug using 2.2.1 (I am not using trunk...) It is because in gluon/globals THREAD_LOCAL.instances do not exist and the replacement THREAD_LOCAL.db_instances has a different architecture. To correct (I hope it's in the trunk already): dbstats = [TABLE(*[TR(PRE(row[0]), '%.2fms' % (ro

[web2py] global name 'T' / 'auth' / 'request' is not defined, but i'm in a model file...

2012-11-19 Thread Cédric Mayer
Hello everyone! I developped an application using web2py 1.99.xx some months ago, and I passed it to web2py 2.2.1 in order to be up to date :-) (And I prefer the new layout...) Thanks again for this beautiful version ! Nevertheless, I since encountered several strange problems (request.vars['no

Re: [web2py] global name 'T' / 'auth' / 'request' is not defined, but i'm in a model file...

2012-11-21 Thread Cédric Mayer
n Spies a écrit : > > On 19 November 2012 15:53, Cédric Mayer >wrote: > >> >> File >> "C:/Users/cedric/projets/LACT/eclipse/Lactw221/web2py/applications/lact/models/a34_lact_running_modes.py" >> >> <http://127.0.0.1:8000/admin/defau

[web2py] Re: Securité Blog

2012-11-26 Thread Cédric Mayer
Dans un controleur tu peux accéder à l'adresse IP avec request.env.remote_host Tu peux alors la comparer avec un début particulier: if request.env.remote_host.startswith("132.10."):#mettre le début de l'IP à bloquer ici raise HTTP(403,"Not authorized") Sinon tu peux programmer un module qu

[web2py] Re: Modify T() function

2012-03-22 Thread Cédric Mayer
Just a simpler idea : as the language file is a python dictionary, why not put the comment in a python comment? "source string": "target string", #comment Cedric On 22 mar, 15:53, Anthony wrote: > > I am working on a translation enhancement project on sahana-eden[1]. > > sahana-eden uses the tr

[web2py] "ValueError: unsupported format character" in login

2012-04-03 Thread Cédric Mayer
Hello everyone, I'm developping an application over web2py, and I stumbled on a problem when I simply log in, using the normal auth() mechanism. It has previously always been fine, as I logged in normally before doing anything. But today: - I awoke my computer (from hibernate mode) ; - I accessed