Re: [web2py] Reading a text file after uploading in a form

2012-10-31 Thread Johann Spies
On 31 October 2012 17:45, praveen krishna wrote: > Hi, >For my task I have to upload a text file in form with out zipping it ,I > have prepared the form as: > form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', > id='myfile', > requires=IS_NOT_EMPTY(,TR(TD(INPUT(_typ

[web2py] Re: How to create long running tasks?

2012-10-31 Thread Massimo Di Pierro
Please use the scheduler. On Wednesday, 31 October 2012 21:56:47 UTC-5, Richard Penman wrote: > > Hello, > > I create a new process after each form submission to parse some data: > subprocess.Popen(['python', parser_script], > cwd=os.path.dirname(parser_script)) > (The parser_script is independen

[web2py] Re: Solution for ORA-00932: inconsistent datatypes: expected - got CLOB

2012-10-31 Thread Massimo Di Pierro
Not sure why you get an oracle error. The problem is that format must be a string or a callack: format='%(slug)s' #ok format=lambda row: row.slug.upper() if slug else None # ok format=IS_UPPER()('%(slug)s') # not ok because not a string The syntax is IS_UPPER()(argument) funky but actually makes

[web2py] Re: Best practice for prepopulating regular form

2012-10-31 Thread Matt
You can do: otherSubject = request.post_vars.otherSubject or 'whatever' form = FORM( FIELDSET('Subject: ', INPUT(_name='subject')), FIELDSET('Other subject: ', INPUT(_name='otherSubject', value = otherSubject)), FIELDSET('Recipients: ', INPUT(_name='recips', )), FI

[web2py] How to create long running tasks?

2012-10-31 Thread Richard Penman
Hello, I create a new process after each form submission to parse some data: subprocess.Popen(['python', parser_script], cwd=os.path.dirname(parser_script)) (The parser_script is independent of web2py) This parsing can take days and multiple parsers need to be executed at once. However if the we

Re: [web2py] How to implement multiple filter for grid?

2012-10-31 Thread Lamps902
Hi, Jim. Thank you so much! At a glance, I think I understand the general idea behind it. I'll get into implementing a version for my page pretty soon, and I'll post an update on how it went, or any insights that may pop up in the process of doing this. If any issues come up, I'll let you know.

Re: [web2py] Re: Server file dialog

2012-10-31 Thread Richard Baron Penman
That is correct. current.request.raw_args == '/css' So checking for empty args fixes this. I have submitted a patch for this and some other issues: http://code.google.com/p/web2py/issues/detail?id=1131&thanks=1131&ts=1351737416 I needed to be able to filter files by extension and prevent download

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
Thanks for that. Here's where I'm confused: 1. In your suggested 'else' you say to get the values from the form. Where do I create the form? Do I do it there (as well as in the GET branch)? I'd like to create the form only one time. 2. You say I do a form.process in the GET branch? I

[web2py] Re: Best practice for prepopulating regular form

2012-10-31 Thread MichaelF
Jim, Thanks. I had already tried that, and it doesn't work for me. I wrote a little controller to test it: @auth.requires_login() def test_vars(): form = FORM( FIELDSET('Subject: ', INPUT(_name='subject')), FIELDSET('Other subject: ', INPUT(_name='otherSubject')), FIELDSE

[web2py] Solution for ORA-00932: inconsistent datatypes: expected - got CLOB

2012-10-31 Thread Bill Thayer
This is a tricky error to figure out so I am documenting it here ORA-00932: inconsistent datatypes: expected - got CLOB To get this error I had at the bottom of a table definition... ... auth.signature, format=IS_UPPER()('%(slug)s'), migrate=settings.migrate) Trying to make the slug

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread Niphlod
If you cached the values no distinction between post or get matters. you fetch them one-time only. If you don't want to cache them, it's another story Basic workflow - requesting values - form = FORM() - users press submit (form.process) - re-requesting values (your unfortunate case) - process

[web2py] Unescaped single quotes break my json

2012-10-31 Thread villas
I have a problem with escaping single quotes when I need a JS list in my view. I have a workaround below, but is there a better way? In controller: lst = ["Andy's Barber Shop"] jsonlst = json.dumps(lst) '["Andy\'s Barber Shop"]' In view: {{=XML(jsonlst)}} '["Andy's Barber Shop"]' --- B

[web2py] Re: Best practice for prepopulating regular form

2012-10-31 Thread Jim S
form.vars.fieldname = 'fieldvalue' -Jim On Wednesday, October 31, 2012 6:13:20 PM UTC-5, MichaelF wrote: > > I have a 'regular' form (i.e., FORM, not SQLFORM). I want to prepopulate > some of the fields, but I don't know the values to use for them when I > first create the form. What's the b

[web2py] Re: Bootstrap Typeahead

2012-10-31 Thread villas
Hi Niphod. I am now adding the attributes with jQuery, but I shall look at custom widgets too because that might be better. I wondered though why we don't have kwargs on Field, but maybe Massimo didn't think it would be so useful. Many thanks for clarifying! D On Wednesday, October 31,

[web2py] Best practice for prepopulating regular form

2012-10-31 Thread MichaelF
I have a 'regular' form (i.e., FORM, not SQLFORM). I want to prepopulate some of the fields, but I don't know the values to use for them when I first create the form. What's the best practice for populating field 'subject'? Is it using the 'element' function? For example: form = FORM( FIELD

[web2py] Re: DB filled with data, now what? How to operate with view?

2012-10-31 Thread MJo
On Tuesday, October 23, 2012 7:44:42 AM UTC+3, howesc wrote: > > yes, i would do the query in the controller, and output my custom HTML in > the view that uses CSS to indent the or whichever HTML element that > you use to get your layout. > > Thank you, makes sense going on within that plan!

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
Thanks for the insights. Re. my #2: you suggest caching values or fetch them only on a GET. Ok, so does that mean I create the form up front without the "value=..." clauses, and set the values only when I determine the request is a GET? I'm not sure of the exact sequence here. Thanks again. O

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread Niphlod
On Wednesday, October 31, 2012 10:08:41 PM UTC+1, MichaelF wrote: > > 1. Re. PS2: Thanks for the info on the public functions. Sorry about not > attaching a complete app; I thought that really wouldn't have been > reasonable on my part. Also, it requires db access, etc. I'll try to repro > the p

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
1. Re. PS2: Thanks for the info on the public functions. Sorry about not attaching a complete app; I thought that really wouldn't have been reasonable on my part. Also, it requires db access, etc. I'll try to repro the problem on a smaller scale. 2. Re. PS1: Please forgive my ignorance/incompet

[web2py] Re: clean up session[id]=Storage(id=id)

2012-10-31 Thread Niphlod
save "update_time" on session[id] (or elsewhere) whenever session is "used" and then check... if session[id].creation_time and session[id].creation_time > request.now -datetime .timedelta(seconds=60): ...do the cleanup On Wednesday, October 31, 2012 6:05:13 PM UTC+1, Annet wrote: > > In

[web2py] Re: Bootstrap Typeahead

2012-10-31 Thread Niphlod
no, factory generates your form based on fields. If you don't code your own widget and pass it into the field definition, the the default widget is used. You can hack the form with form.elements notation, but I'll go for a custom widget in your case. On Wednesday, October 31, 2012 9:21:40 PM U

[web2py] Re: session[id]=Storage(id=id) between controllers

2012-10-31 Thread Niphlod
request.args(0,default=0, cast=int, otherwise=URL(...)) PS: if it's recurrent I wonder why you aren't normalizing it already as with try: arg0 = int(request.args(0)) except: redirect() :P On Wednesday, October 31, 2012 6:26:44 PM UTC+1, Annet wrote: > > Hi Massimo, > > Thanks for your reply,

[web2py] Re: Encryption of SSN field

2012-10-31 Thread Niphlod
no validators ready, but a pure-python aes implementation is included in recent web2py, ready to be used as a slip-in if aes is not found on python path (faster because uses the underlying C implementation of the crypto library available). Look at gluon.utils.secure_dumps and gluon.utils.secure

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread Niphlod
on my pc the session files are not recreated. session values are saved even if you redirect (just to test it out) @auth.requires_login() def send_info(): setupMeetInSession() form = dict() session.customvar = True redirect(URL('send_info2')) return dict(form=form) @auth.requires_l

[web2py] Bootstrap Typeahead

2012-10-31 Thread villas
Using SQLFORM.factory can I easily produce an input field like this? I thought it must be possible to create extra attributes for Fields, but couldn't figure it out... In this example it is for using Bootstrap Typeahead. If not possible, no prob because I shall work around it in this case

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
As expected, every time the problem appears (that is, I submit a form and get challenged to login again), there's an additional/new session file in the session dir. The only usages of 'session' are reading/writing, such as session.meetInfo.currAssgmts = False attachments = session.meetInfo.attach

[web2py] Encryption of SSN field

2012-10-31 Thread Jim S
Hi - Starting a new HR tracking app and I need to encrypt my SSN field in the db. I found this post ( https://groups.google.com/d/topic/web2py/oBNEHYYKgW0/discussion ) from some time ago and wondering if there has been anything added since then related to validators for encryption.I haven't wo

[web2py] Re: session[id]=Storage(id=id) between controllers

2012-10-31 Thread Annet
Hi Massimo, Thanks for your reply, the cause of the problem is that in the router function session[id] is based on request.args(0), whereas in id=get_ID(auth,session) if session[id]: it is based on nodeID which is of type int. Since my whole app is node driven, the issue of request.args(0) bei

[web2py] Re: form=crud.update and hidden field

2012-10-31 Thread Annet
Hi Massimo, Fixed in trunk. Please check it. > Thanks for fixing this issue so fast. Kind regards, Annet. --

[web2py] clean up session[id]=Storage(id=id)

2012-10-31 Thread Annet
In a router function I create a Storage object: session[id]=Storage(id=id) session[id] stores data and menus session[id].node session[id].sitenav etc. Is there a way to empty session[id] if session[id] hasn't been used for some time? Kind regards, Annet --

[web2py] Re: session[id]=Storage(id=id) between controllers

2012-10-31 Thread Annet
Hi Massimo, Thanks for your reply. Somewhere else in your logic you are changing this. > I've gone through my applications logic, session[id] is being created in a router function: def router(): if not len(request.args): redirect(URL('addressbook','index')) else: id=req

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread Niphlod
inspect the session/ folder and clean it. Then try again with your preferred browser and see if a file is created. Then make sure that another file doesn't get created as long as you don't clear the cache/open the page with another browser Then make sure that for every time you store something in

[web2py] Re: session and/or auth-login problems

2012-10-31 Thread MichaelF
Any pointers on how I can debug this? Should I insert a debug trace and step through the controller and the view? Should I enable logging and insert various log statements? Thanks. On Monday, October 8, 2012 4:19:59 PM UTC-6, MichaelF wrote: > > I've seen this before but I cannot remember what'

[web2py] Reading a text file after uploading in a form

2012-10-31 Thread praveen krishna
Hi, For my task I have to upload a text file in form with out zipping it ,I have prepared the form as: form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', id='myfile', requires=IS_NOT_EMPTY(,TR(TD(INPUT(_type='submit',_value='Submit') But I unable to read the

[web2py] Re: left / right side bars odd behaviors

2012-10-31 Thread Stephen Ekoka
Makes much sense. Thanks Massimo. S. On Tuesday, October 30, 2012 9:19:16 AM UTC-4, Massimo Di Pierro wrote: > > You should read this > > {{left_sidebar_enabled,right_sidebar_enabled=False,('message' in > globals())}} > > as in > > {{ > left_sidebar_enabled = False > right_sidebar_enabled = ('m

Re: [web2py] Re: Server file dialog

2012-10-31 Thread Massimo Di Pierro
It is there to do exactly what you asked. ;-) On Wednesday, 31 October 2012 07:19:42 UTC-5, Richard Penman wrote: > > Nice! I will modify this for my own use. > What is this included in gluon for? > > I noticed a double slash is shown for sub-folders: > base//css/ (<- when in static/css) > > >

[web2py] Re: session[id]=Storage(id=id) between controllers

2012-10-31 Thread Massimo Di Pierro
Somewhere else in your logic you are changing this. On Wednesday, 31 October 2012 05:53:46 UTC-5, Annet wrote: > > In my node based app I create the following object > session[id]=Storage(id=id) in which I store some data and menus the first > time the index page of a site is loaded. After that

[web2py] Re: Dynamic form with hidden fields

2012-10-31 Thread Massimo Di Pierro
It is you really want I can delete it but I'd rather not. lyn2py is right. This will help others. On Wednesday, 31 October 2012 02:38:35 UTC-5, Viliam Oršula wrote: > > Hmm... It doesn't work this way. I just deleted my question, not whole > conversation. If someone has permission for deleting c

[web2py] Re: form=crud.update and hidden field

2012-10-31 Thread Massimo Di Pierro
Fixed in trunk. Please check it. On Wednesday, 31 October 2012 02:51:48 UTC-5, Annet wrote: > > I defined the following form: > > > form=crud.update(table=db.nodeNav,hidden=dict(nodeID=id),record=row,next=URL('functions'),onaccept=onaccept_functions,deletable=False) > > I need the hidden field for

[web2py] Re: SQLFORM.grid export missing computed fields

2012-10-31 Thread Massimo Di Pierro
Here http://code.google.com/p/web2py/issues/list anyway, the proper way to do this should be to have Virtual fields. Links will never be included in the csv because they are links, not data. On Tuesday, 30 October 2012 22:23:16 UTC-5, k0aun9 wrote: > > Okay. By the way, where do I open a ticket

Re: [web2py] How to implement multiple filter for grid?

2012-10-31 Thread Lamps902
Hi, Jim. It would be great if you could provide more details and some code illustrating how you went about doing it. Thanks! -Lamps On Wednesday, October 31, 2012 9:39:24 AM UTC-4, Jim S wrote: > > Using .smartgrid, I override the default filtering capabilities and > provide my own. See attach

Re: [web2py] How to implement multiple filter for grid?

2012-10-31 Thread Jim S
Using .smartgrid, I override the default filtering capabilities and provide my own. See attached screenshot. Let me know if you want more details. I think I uploaded a small example app to the list some time ago and should be able to find it or recreate it if you like. -Jim On Wednesday, Oc

Re: [web2py] How to implement multiple filter for grid?

2012-10-31 Thread Lamps902
Hi, Johann - I know you can build a complex query using the search box, but that is far from intuitive for most users. I'd like to implement the same look/feel/usability as was available in webgrid, and as is shown in the image. Is there a reasonable way to do this? Thanks. -Lamps On Wednesday

Re: [web2py] Re: Server file dialog

2012-10-31 Thread Niphlod
patches are welcome, if you want to contribute. For the double slash, I assume that there's a problem parsing args ['static', 'css', '']. Expose should probably check for empty values into args before re-rendering the thing as a url (something/static/css// vs something/static/css/) Open an

[web2py] Re: db.define_tabl('mytable', Field('call-limit')) error when use simbol "-" minus in Field name

2012-10-31 Thread Niphlod
the problem is that you then try to access the field as db.cdr.call-limit you hit a python limit: that string is "rendered" as db.cdr.call 'minus' limit. So in web2py table names and field names containing dashes (or any other operator) is forbidden. On Wednesday, October 31, 2012 1:21:53 P

[web2py] db.define_tabl('mytable', Field('call-limit')) error when use simbol "-" minus in Field name

2012-10-31 Thread Emilius Omeen
Hello thanks Massimo for web2py models/db.py db.define_table('cdr', Field('call-limit', 'integer', notnull=True, default='3')) Error invalid table or field name: call-limit raise SyntaxError, 'invalid table or field name: %s' % text SyntaxError: invalid table or field name: call-limit 9. 10.

Re: [web2py] Re: Server file dialog

2012-10-31 Thread Richard Baron Penman
Nice! I will modify this for my own use. What is this included in gluon for? I noticed a double slash is shown for sub-folders: base//css/ (<- when in static/css) On Wed, Oct 31, 2012 at 8:09 PM, Niphlod wrote: > there's something, not really tested, that you can definitely try: > from gluon.to

[web2py] session[id]=Storage(id=id) between controllers

2012-10-31 Thread Annet
In my node based app I create the following object session[id]=Storage(id=id) in which I store some data and menus the first time the index page of a site is loaded. After that session[id].node, session[id].navbar etc. evaluate to True and the data and menus are not set again. When the user edi

[web2py] Re: Server file dialog

2012-10-31 Thread Niphlod
there's something, not really tested, that you can definitely try: from gluon.tools import Expose myfolders = Expose() return dict(myfolders=myfolders) On Wednesday, October 31, 2012 3:04:14 AM UTC+1, Richard Penman wrote: > > Is there an existing app / plugin that supports selecting a file from

[web2py] Re: Dynamic form with hidden fields

2012-10-31 Thread lyn2py
Your question will help others who are new to web2py :) On Wednesday, October 31, 2012 3:38:35 PM UTC+8, Viliam Oršula wrote: > > Hmm... It doesn't work this way. I just deleted my question, not whole > conversation. If someone has permission for deleting conversation, please > do so. > I'm sorr

[web2py] form=crud.update and hidden field

2012-10-31 Thread Annet
I defined the following form: form=crud.update(table=db.nodeNav,hidden=dict(nodeID=id),record=row,next=URL('functions'),onaccept=onaccept_functions,deletable=False) I need the hidden field for the validators in db.py to work (nodeID is readable and writable False). However, the form above gives

[web2py] Re: Dynamic form with hidden fields

2012-10-31 Thread Viliam Oršula
Hmm... It doesn't work this way. I just deleted my question, not whole conversation. If someone has permission for deleting conversation, please do so. I'm sorry for my noobishness. I'm new here. Dňa streda, 31. októbra 2012 8:34:45 UTC+1 Viliam Oršula napísal(-a): > > I'm sorry to take your ti

[web2py] Re: Dynamic form with hidden fields

2012-10-31 Thread Viliam Oršula
I'm sorry to take your time. I found out, that field were not only hidden, but disabled too. That coused them not to send. Thank you for your suggestions anyway. I will delete this question, since it is useless. Dňa streda, 31. októbra 2012 4:10:46 UTC+1 lyn2py napísal(-a): > > Yes, the fields ar