[web2py] how to disable field access if not authorized

2010-02-07 Thread weheh
I'm using crud and want to disable access to certain fields if user is not a member of the admin group. For instance, content can only be approved by admin. I want to register the id of the user who approved the content, too. So I'd like to say: if not auth.has_membership(auth.id_group('Admin'),

Re: [web2py] how to disable field access if not authorized

2010-02-07 Thread Thadeus Burgess
It looks as if request.args(2) is empty. -Thadeus On Sun, Feb 7, 2010 at 2:02 AM, weheh wrote: > I'm using crud and want to disable access to certain fields if user is > not a member of the admin group. For instance, content can only be > approved by admin. I want to register the id of the u

[web2py] Re: how to disable field access if not authorized

2010-02-07 Thread weheh
It's possible, but according to MDB, that would result in crud.update turning into crud.create. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send em

[web2py] Re: Login form

2010-02-07 Thread weheh
On item 2, you should be using css. give the "string" class a width in ems or %. Stylize the font by setting font-size: 85%; or you can set it to a certain number of ems or pt. On Feb 5, 12:20 pm, sveinh wrote: > Thanks Massimo > > Your hint pointed me in the right direction.  It had a few topos,

[web2py] for your info

2010-02-07 Thread mdipierro
http://www.reddit.com/r/Python/comments/ayqbu/thoughts_on_web2py/ -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@goo

[web2py] Re: how to disable field access if not authorized

2010-02-07 Thread mdipierro
I am not sure non-writable fields have widgets. I will check. Most likely they do not if they are not writable and not readable. On Feb 7, 2:02 am, weheh wrote: > I'm using crud and want to disable access to certain fields if user is > not a member of the admin group. For instance, content can on

[web2py] calling form through ajax fails even using formname=None

2010-02-07 Thread hamdy.a.farag
Hi I've this particular case : def governorate(): form = crud.create(db.governorate) return dict(governorates=governorates, form=form) def edit_governorate(): form = SQLFORM(db.governorate ,request.vars.gov_id) if form.accepts(request.vars, formname='n

[web2py] Re: immediate web2py job opening

2010-02-07 Thread Mengu
weheh, only for U.S. residences? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options,

[web2py] Re: how to disable field access if not authorized

2010-02-07 Thread weheh
These are readable, but not writable. What I want is for widget to get "grayed-out" and not be usable when user doesn't have permission to fill in the field. On Feb 7, 4:24 am, mdipierro wrote: > I am not sure non-writable fields have widgets. I will check. Most > likely they do not if they are n

[web2py] Re: how to disable field access if not authorized

2010-02-07 Thread weheh
These are readable, but not writable. What I want is for widget to get "grayed-out" and not be usable when user doesn't have permission to fill in the field. Ideally, I think it would make sense to be able to do this as a requirement to a field, something like: requires=HAS_MEMBERSHIP(auth.id_grou

[web2py] Re: Cron errors on Windows

2010-02-07 Thread mr.freeze
Let me know when to test. I'm still getting: Exception in thread Thread-4: Traceback (most recent call last): File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner self.run() File "C:\Users\nathan\workspace\web2py\gluon\contrib\cron.py", line 55, in run s.run() File "C:

[web2py] Re: Plugin

2010-02-07 Thread K.R.Arun
hi, Many many thanks for the bit of info. Why can't make a wiki page about that. It's actually useful. Sorry for late reply. I was preparing for my MBA entrance test. On Feb 1, 10:50 pm, Thadeus Burgess wrote: > Create your models/controllers/views/static files etc everything as > you normally

[web2py] Re: calling form through ajax fails even using formname=None

2010-02-07 Thread mdipierro
Can you describe the symptoms as you go through the interface? Are you using the web2py_ajax.html function "web2py_ajax_page" to load the form and trap it into the page? On Feb 7, 6:37 am, "hamdy.a.farag" wrote: > Hi > > I've this particular case : > > def governorate(): >     form = crud.create

Re: [web2py] Re: how to disable field access if not authorized

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 7:32 AM, weheh wrote: > These are readable, but not writable. What I want is for widget to > get > "grayed-out" and not be usable when user doesn't have permission to > fill in the field. > > Ideally, I think it would make sense to be able to do this as a > requirement to a fie

[web2py] Re: Cron errors on Windows

2010-02-07 Thread mdipierro
please try again. On Feb 7, 10:23 am, "mr.freeze" wrote: > Let me know when to test. I'm still getting: > > Exception in thread Thread-4: > Traceback (most recent call last): >   File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner >     self.run() >   File "C:\Users\nathan\workspa

[web2py] Re: how to disable field access if not authorized

2010-02-07 Thread mdipierro
You can do what you say Field(...,writable = auth.has_permission('whatever')) The problem seems to be that {{=form.custom.widget.field}} fails for you when db.table.field.writable is False. It seems to work for me: >>> db.define_table('test',Field('name')) >>> db.test.name.writable=False >>> f

[web2py] Re: Error with mail sending and T(...)

2010-02-07 Thread aure
Thanks a lot! I am not on my computer now, but I will try that tomorrow. On Feb 5, 10:32 pm, mdipierro wrote: > for now > > message=str(T('mail message')) > > instead of > > message=T('mail message') > > On Feb 5, 3:16 pm, aure wrote: > > > I am using web2py Version 1.74.11 > > > But I upgraded

[web2py] Re: Cron errors on Windows

2010-02-07 Thread mr.freeze
Seems happy now. Thanks. On Feb 7, 11:05 am, mdipierro wrote: > please try again. > > On Feb 7, 10:23 am, "mr.freeze" wrote: > > > Let me know when to test. I'm still getting: > > > Exception in thread Thread-4: > > Traceback (most recent call last): > >   File "C:\Python25\lib\threading.py", li

[web2py] web2py gae presentation

2010-02-07 Thread Thadeus Burgess
I am giving a presentation Wednesday on web2py running on GAE. I'm looking for ideas on a small app I could develop that would display the following web2py features. 1. Data centric, simplicity. 2. Generation of reports 3. Ease of deployment 4. Maintainability Most who are attending are engineers

[web2py] password hash problems

2010-02-07 Thread Jonathan Lundell
I've got this (where the key is a text string): from gluon.tools import * auth=Auth(globals(),db) # authentication/authorization auth.settings.hmac_key = vpepm_hmac_key auth.define_tables() # creates all needed tables # invoke IS_STRONG only for passw

[web2py] crud links to default, not the calling controller

2010-02-07 Thread weheh
I'm building an admin interface of my own, which mostly looks like the web2py admin interface. Therefore, in my admin controller, I have @auth.requires_membership('Admin') def groups(): form=crud.update(db.auth_group,request.args(2),deletable=True) groups=crud.select(db.auth_group) return di

[web2py] Re: crud links to default, not the calling controller

2010-02-07 Thread mr.freeze
I think you need to set crud.settings.controller = 'admin' On Feb 7, 2:01 pm, weheh wrote: > I'm building an admin interface of my own, which mostly looks like the > web2py admin interface. Therefore, in my admin controller, I have > > @auth.requires_membership('Admin') > def groups(): >   form=c

[web2py] Re: password hash problems

2010-02-07 Thread mdipierro
remember that validators are filters. You need to check that a password is strong BEFORE it is hashed. So instead of this: auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, upper=1, lower=1, number=1, special=1)] Do this auth.settings.table_user.password.insert(0,IS_STRONG(m

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mdipierro
I fixed some problem with validators. Can somebody give this a try? I could use a second opinion. Massimo On Feb 7, 1:02 am, mdipierro wrote: > I do not know that. I am still playing with it... > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > I have my current autocomplete but it doesn't do öä

[web2py] Re: crud links to default, not the calling controller [SOLVED]

2010-02-07 Thread weheh
Right on Mr. Freeze. Works. Thx. On Feb 7, 3:05 pm, "mr.freeze" wrote: > I think you need to set crud.settings.controller = 'admin' > > On Feb 7, 2:01 pm, weheh wrote: > > > I'm building an admin interface of my own, which mostly looks like the > > web2py admin interface. Therefore, in my admin

[web2py] Re: password hash problems

2010-02-07 Thread mr.freeze
Looking at CRYPT, if you provide a key but not a digest algorithm, it will try to get the digest alg by splitting the key between a colon. So you could say: auth.settings.hmac_key = 'sha512:%s' % vpepm_hmac_key On Feb 7, 1:44 pm, Jonathan Lundell wrote: > I've got this (where the key is a text s

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mdipierro
How about we change IS_IN_DB so that, if the number of referenced records exceeds a maximum the auto complete widget is on by default? Massimo On Feb 7, 1:02 am, mdipierro wrote: > I do not know that. I am still playing with it... > > On Feb 6, 11:40 pm, Jason Brower wrote: > > > I have my curr

Re: [web2py] Re: password hash problems

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 12:10 PM, mr.freeze wrote: > Looking at CRYPT, if you provide a key but not a digest algorithm, it > will try to get the digest alg by splitting the key between a colon. > So you could say: > > auth.settings.hmac_key = 'sha512:%s' % vpepm_hmac_key That did the trick. Thanks, I

[web2py] Re: web2py gae presentation

2010-02-07 Thread mr.freeze
I have a few things I've written that you are welcome to use as an idea,jumping off point or clone: Mileage tracker - http://www.web2pyslices.com/main/slices/take_slice/15 Art gallery manager - email me web2pyslices - http://www.web2pyslices.com/main/static/share/web2py.app.web2pyslices.w2p Othe

Re: [web2py] Re: password hash problems

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > remember that validators are filters. You need to check that a > password is strong BEFORE it is hashed. > So instead of this: > > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > >

Re: [web2py] Re: password hash problems

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > remember that validators are filters. You need to check that a > password is strong BEFORE it is hashed. > So instead of this: > > auth.settings.table_user.password.requires += [IS_STRONG(min=8, max=0, > upper=1, lower=1, number=1, special=1)] > >

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mr.freeze
Nice! I like this but I think it needs a few more tweaks. Can you modify it to allow the arrow keys to select an item? Also, when you clear the input after typing something, all of the options show. I personally think that javascript should be used more in the framework (with proper attention paid

Re: [web2py] Re: cancel button

2010-02-07 Thread Jonathan Lundell
On Feb 6, 2010, at 9:33 PM, Iceberg wrote: > On Feb7, 8:01am, Jonathan Lundell wrote: >> On Feb 6, 2010, at 12:58 PM, Jonathan Lundell wrote: >> >>> On Feb 6, 2010, at 12:38 PM, mdipierro wrote: >> form[0][-1][1].append(BUTTON(_onclick="")) >> >>> Thanks. >> >>> Ideally, I'd like to

[web2py] Re: cancel button

2010-02-07 Thread mr.freeze
I hate this too: form[0][-1][1]. I have a pending patch that will allow you to grab parent and sibling elements so you can do: >>> form = SQLFORM(db.whatever) >>> submit = form.element(_type='submit') >>> submit.parent.append(INPUT(_type='submit',_value='Cancel')) A little more verbose but human r

Re: [web2py] Re: cancel button

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > I hate this too: form[0][-1][1]. I have a pending patch that will > allow you to grab parent and sibling elements so you can do: form = SQLFORM(db.whatever) submit = form.element(_type='submit') submit.parent.append(INPUT(_type='submit'

[web2py] Re: password hash problems

2010-02-07 Thread mdipierro
oops. yes. On Feb 7, 2:35 pm, Jonathan Lundell wrote: > On Feb 7, 2010, at 12:07 PM, mdipierro wrote: > > > remember that validators are filters. You need to check that a > > password is strong BEFORE it is hashed. > > So instead of this: > > > auth.settings.table_user.password.requires += [IS_ST

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mdipierro
On Feb 7, 3:12 pm, "mr.freeze" wrote: > Nice! I like this but I think it needs a few more tweaks. Can you > modify it to allow the arrow keys to select an item? Also, when you > clear the input after typing something, all of the options show. Yes it can be done. It is on my to do list. > > I p

[web2py] Re: cancel button

2010-02-07 Thread mdipierro
The patch will be in soon. ;-) On Feb 7, 4:18 pm, Jonathan Lundell wrote: > On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > > > I hate this too: form[0][-1][1]. I have a pending patch that will > > allow you to grab parent and sibling elements so you can do: > form = SQLFORM(db.whatever) > >

[web2py] wiki formatting

2010-02-07 Thread Jonathan Lundell
While adding a note to the book errata about hash selection, I noticed that the vertical white space (line to line, graf to graf) on that page appears to be mostly random. Or if there's a method to it, I can't tell what it is. -- You received this message because you are subscribed to the Googl

[web2py] UnicodeDecodeError sending email

2010-02-07 Thread Russell
Hi, Upgraded from 1.71 to 1.74.11. This works on 1.71: message = response.render(email_template, email_fields) if not mail.send(to=[form.vars.email], subject=message_title, message=message): raise RuntimeError('Unable to send email') But I get this on 1.74.11: UnicodeDecodeError: 'utf8' co

[web2py] Soaplib problem.

2010-02-07 Thread Matt
Hi there, I'm trying to install soaplib as per the following: http://www.web2py.com/AlterEgo/default/show/165 I've downloaded soaplib 0.8.1 from http://github.com/jkp/soaplib/downloads Now the one step _crucial_ that is missing from the AlterEgo example is where to place the untared soaplib fi

Re: [web2py] Re: cancel button

2010-02-07 Thread Jonathan Lundell
On Feb 6, 2010, at 9:33 PM, Iceberg wrote: > Yes, but be careful of multiple submit buttons. See this post: > https://groups.google.com/group/web2py/browse_frm/thread/f44b6f95b058df5 I think I've solved the multiple-submit problem, at the cost of a bit of scripting (but not much): form[0][

[web2py] Re: wrong decisions and backward compatibility

2010-02-07 Thread Iceberg
But in this case (provided that we really change IS_UPPER() as Pihentagy suggested), you can rely on the human, because they can not input lower case. Your app still need not to edit a single line. :) Well, sounds like I support changing IS_UPPER() 's behavior. But actually I am neutral to this pr

[web2py] Re: cancel button

2010-02-07 Thread mdipierro
The patch by Mr Freeze is in. On Feb 7, 4:27 pm, mdipierro wrote: > The patch will be in soon. ;-) > > On Feb 7, 4:18 pm, Jonathan Lundell wrote: > > > On Feb 7, 2010, at 2:06 PM, mr.freeze wrote: > > > > I hate this too: form[0][-1][1]. I have a pending patch that will > > > allow you to grab p

[web2py] Re: wrong decisions and backward compatibility

2010-02-07 Thread mdipierro
We could add an option like "strict=False" that if true does what you ask. On Feb 7, 8:22 pm, Iceberg wrote: > But in this case (provided that we really change IS_UPPER() as > Pihentagy suggested), you can rely on the human, because they can not > input lower case. Your app still need not to edit

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mdipierro
Now it is very customizable and works well, including right, up, down arrows. It requires at least two chars to start the ajax calls. just do db.table.field.widget=AutocompleteWidget(request,db.othertable.name,db.othertable.id) it looks up in field "name" for the value of "id". On Feb 7, 3:12

[web2py] Re: Soaplib problem.

2010-02-07 Thread mdipierro
I just tried. wget http:///...soaplib-0.8.1 -o ~/Downloads/soaplib-0.8.1.tar cd ~/Downloads/ tar zxvf soaplib-0.8.1.tar cd ~/web2py cp -r ~/Downloads/soaplib-0.8.1/soaplib site-packages It works but requires import lxml.etree as ElementTree and I think that is a binary package that does not w

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mr.freeze
Looking good but now I can't select an unselected option by clicking. I can only select the currently selected option with a mouse click. On Feb 7, 8:34 pm, mdipierro wrote: > Now it is very customizable and works well, including right, up, down > arrows. It requires at least two chars to start t

[web2py] Re: Soaplib problem.

2010-02-07 Thread Matt
So realistically the soaplib package won't work on GAE due to the lxml dependency. Do you know of any other products that I should consider? I only need to consume web services. Potentially I could hack soaplib but that seems a little extreme. Thanks, Matt On Feb 8, 3:42 pm, mdipierro wrote: >

Re: [web2py] Re: wrong decisions and backward compatibility

2010-02-07 Thread Thadeus Burgess
No, you cannot rely on the user. Users are stupid. The system needs to be as simple as possible for the users to use the system to get their work done. There is no need to bother the user with "Form errors: Value must be uppercase". This wastes the users time to have to remember to input in upper c

Re: [web2py] Re: wrong decisions and backward compatibility

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 6:32 PM, mdipierro wrote: > We could add an option like "strict=False" that if true does what you > ask. What's the use case? I'm having trouble seeing what such an option would do for you. Sure, IS_UPPER() should probably have been named TO_UPPER(). But at this point >

Re: [web2py] Re: cancel button

2010-02-07 Thread Jonathan Lundell
On Feb 7, 2010, at 6:31 PM, mdipierro wrote: > The patch by Mr Freeze is in. Thanks. I'll wait for a stable release, but I'll definitely use it. Some documentary comments would be nice. (BTW, the patch added trailing white space to a few lines. Bogus, I assume.) > > On Feb 7, 4:27 pm, mdipier

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mdipierro
Please give it a try. It seems some time requires double click instead of single click but cannot figure out why. On Feb 7, 8:52 pm, "mr.freeze" wrote: > Looking good but now I can't select an unselected option by clicking. > I can only select the currently selected option with a mouse click. > >

[web2py] Re: Soaplib problem.

2010-02-07 Thread mdipierro
What do you need specifically? client or server? On Feb 7, 9:07 pm, Matt wrote: > So realistically the soaplib package won't work on GAE due to the lxml > dependency. > > Do you know of any other products that I should consider? I only need > to consume web services. > > Potentially I could hack

[web2py] Re: Soaplib problem.

2010-02-07 Thread Matt
client. On Feb 8, 5:35 pm, mdipierro wrote: > What do you need specifically? client or server? > > On Feb 7, 9:07 pm, Matt wrote: > > > So realistically the soaplib package won't work on GAE due to the lxml > > dependency. > > > Do you know of any other products that I should consider? I only ne

[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-07 Thread mr.freeze
It is doing two callbacks, one to get autocomplete options and one when you click an item. It seems like it shouldn't do the second one. Also, it probably shouldn't submit the form if you hit the enter key while selecting an option. You might try breaking that huge js code on attr['_onkeyup'] into

[web2py] Re: Soaplib problem.

2010-02-07 Thread mr.freeze
I've heard good things about SUDS: https://fedorahosted.org/suds/ I've never used it and I don't know if it works on GAE but might be worth a shot. On Feb 7, 9:07 pm, Matt wrote: > So realistically the soaplib package won't work on GAE due to the lxml > dependency. > > Do you know of any other p

[web2py] Re: Soaplib problem.

2010-02-07 Thread mdipierro
It may work. Seems to use only basic libraries. On Feb 7, 11:34 pm, "mr.freeze" wrote: > I've heard good things about SUDS:https://fedorahosted.org/suds/ > > I've never used it and I don't know if it works on GAE but might be > worth a shot. > > On Feb 7, 9:07 pm, Matt wrote: > > > So realistica

[web2py] Re: UnicodeDecodeError sending email

2010-02-07 Thread mdipierro
It looks like your massage contains non utf8 characters. It may have worked before but may have sent garbage to the recipient. Try mail=Mail(encoding='latin1') On Feb 7, 5:58 pm, Russell wrote: > Hi, > > Upgraded from 1.71 to 1.74.11.  This works on 1.71: > > message = response.render(email_

[web2py] Can crud update more than one table at a time?

2010-02-07 Thread weheh
Can I do this? form=crud.update(db.table1,db.table2,db.table3,request.args(2)) or is SQLFORM.factory the only way to do that? -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsu

[web2py] Re: calling form through ajax fails even using formname=None

2010-02-07 Thread hamdy.a.farag
ok 1st of all, I don't use "web2py_ajax_page" functions and the particular code looks like : def governorate(): form = crud.create(db.governorate) query = auth.accessible_query('CAN_VIEW', db.governorate, auth.user.id) governorates=db(query).select(orderby=db.governorate.name) r