[web2py] Re: github & hg repo

2011-11-23 Thread Gour
On Thu, 24 Nov 2011 02:26:18 +0100
~redShadow~  wrote:

> I started moving all my projects (both personal and company's) from
> svn to git/github, and I'm discovering a new, wonderful world every
> time I use it :)

I did the same from: darcs --> bzr --> mtn --> fossil --> bzr --> hg

> ..and I also see many other big projects moving onto it, so, even if I
> know only a small part of all its features, I guess it's worth it.

I really don't care much about git considering it requires too much
thinking aobut the tool to prevent shooting one's foot.

> So, +1 for web2py on github!

+1 as well since we can use hg-hit.


Sincerely,
Gour


-- 
As the embodied soul continuously passes, in this body, 
from boyhood to youth to old age, the soul similarly passes 
into another body at death. A sober person is not bewildered 
by such a change.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Re: github & hg repo

2011-11-23 Thread Phyo Arkar
I for one , Love hg.
a lot more easier to get things done for me.
And its python!

On Thu, Nov 24, 2011 at 7:56 AM, ~redShadow~  wrote:

> On Wed, 2011-11-23 at 09:34 -0800, Massimo Di Pierro wrote:
> > Yes. I will try keep them in sync. But I already start to see some
> > advantages of github (submodules)
>
> I started moving all my projects (both personal and company's) from svn
> to git/github, and I'm discovering a new, wonderful world every time I
> use it :)
>
> ..and I also see many other big projects moving onto it, so, even if I
> know only a small part of all its features, I guess it's worth it.
>
> So, +1 for web2py on github!
>
> --
> Samuele ~redShadow~ Santi
> 
> redshadow[at]hackzine.org - redshadowhack[at]gmail.com
>
>  Blog: http://hackzine.org
>
>  GPG Key signature:
>   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
> 
> /me recommends:
>Squadra Informatica - http://www.squadrainformatica.com
> 
>  - Proud ThinkPad T-Series owner
>  - Registered Linux-User: #440008
>  * GENTOO User since 1199142000 (2008-01-01)
>  * former DEBIAN SID user
> 
>  "Software is like sex: it's better when it's free!"
>  -- Linus Torvalds
>
>


[web2py] Re: Google Authentication on GAE

2011-11-23 Thread amit
I am stuck with other issues with authentication. auth.is_logged_in()
never
becomes true even when I login via Google Account into my hosted app.
The behavior is the same on my local server deployment as well as
hosted on GAE.
I switched the GAE sdk version back to 1.55 as suggested by howesc.
But no change.
Next I will try switching back the web2py version. Which version
should I use?

On Nov 24, 2:05 am, amit  wrote:
> Thanks. It was aproblemin my controller code. I solved it by
> following the host2py example.
>
> http://code.google.com/p/host2py/source/browse/trunk/controllers/defa...
>
> On Nov 22, 10:35 am, howesc  wrote:
>
>
>
>
>
>
>
> > can't remember the symptions, but when using the bulk load option for
> > appconfig to upload/download data i have had to do the following:
>
> > #/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngi 
> > ne-default.bundle/Contents/Resources/google_appengine/google/appengine/tool 
> > s/dev_appserver_login.py
> > #
> > #line 260 in LoginCGI(), add:
> > #
> > #  #hack for bulk loader
> > #  redirect_url = continue_url
> > #  output_headers.append(SetUserInfoCookie('t...@example.com', True))
>
> > note that the line number about is at least one GAE version out of date
> > because i am behind by at least 1 GAE version due to other bugs with GAE
> > SDK/web2py in the latest.


[web2py] Re: SQLFORM upload type and long file+path names

2011-11-23 Thread Massimo Di Pierro
> 1) Is there an easy way to "overload" the default behavior of the
> SQLFORM so it stores the filename in the database, instead of encoding
> it in the renamed-file? I see the Field class has a custom_store/
> retrieve variable, could I just duplicate the default DAL store/
> retrieve functions and add my extra file name logic? Or is there a
> better way?

One thing you can do it is

Field('name','upload',length=260)

it will truncate the generated filename to 260. That means it will not
be able to reconstruct the full original name but only part of it.
Anyway, give it a try and let us know.

> 2) Is there any way for web2py to better identify this exception? I
> could imagine some people scratching their heads for a quite a while
> on it.

Python raises an IOError. This could have many possible causes. I
changed the code in trunk to re-raise the exception with more info.
Check if this is acceptable.

Massimo


[web2py] SQLFORM upload type and long file+path names

2011-11-23 Thread David Braun
I unexpectedly ran into this problem, and it took me a while to figure
out what was going on. I'm wondering if anyone has any suggestions on
how to handle it.

I'm using the 'upload' field type with SQLFORMs to upload files to the
server. However, for certain files with longer names, I get this
exception:

([Errno 2] No such file or directory: 'C:\
\Users\\---\\Documents\\--\\---\
\--\\web2py\\applications\\webcollection\
\databases\\..\\uploads\\usermodel_file_store.file.9dbf56ec79482a5b.
68616c6f6c7a2d646f742d636f6d2d6e36342d736e65732d796f756d696768746265747279696e67746f686172642e6a7067.jpg')

(Dashes are hiding my personal folder names, they don't actually
appear like that)

I couldn't for the life of me figure out what was going on, until I
luckily tried uploading a file with a short name, which worked
perfectly.

Doing some digging, it looks like Windows has a maximum length of 260
characters for a file's combined path and name (http://
windows.microsoft.com/en-US/windows-vista/File-names-and-file-name-
extensions-frequently-asked-questions). Doing some experimenting in
windows explorer, this appears accurate.

So, between my long base path and the long encoded file names, I'm
hitting that limit.

All that out of the way, I guess I have two questions:
1) Is there an easy way to "overload" the default behavior of the
SQLFORM so it stores the filename in the database, instead of encoding
it in the renamed-file? I see the Field class has a custom_store/
retrieve variable, could I just duplicate the default DAL store/
retrieve functions and add my extra file name logic? Or is there a
better way?
2) Is there any way for web2py to better identify this exception? I
could imagine some people scratching their heads for a quite a while
on it.


[web2py] Re: table inheritance and defined requires

2011-11-23 Thread Massimo Di Pierro
this is what I tried:

> python web2py.py -S welcome -M -N

>>> countries = {'ti': 'Timor Leste', 'vn': 'Vietnam','in': 'India','kr': 
>>> 'Korea','cn': 'China'}
>>> db.define_table('address', Field('country'), 
>>> Field('state'),Field('street_address'))
>>> db.address.country.requires=IS_IN_SET(countries, zero=None)
>>> db.define_table('personal_address', db.auth_user, db.address)
>>> print db.address.country.requires is db.personal_address.country.requires
True

Look to me the requires is inherited. Perhaps I am missing something


Re: [web2py] Re: github & hg repo

2011-11-23 Thread ~redShadow~
On Wed, 2011-11-23 at 09:34 -0800, Massimo Di Pierro wrote: 
> Yes. I will try keep them in sync. But I already start to see some
> advantages of github (submodules)

I started moving all my projects (both personal and company's) from svn
to git/github, and I'm discovering a new, wonderful world every time I
use it :)

..and I also see many other big projects moving onto it, so, even if I
know only a small part of all its features, I guess it's worth it.

So, +1 for web2py on github!

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] table inheritance and defined requires

2011-11-23 Thread Nik Go
countries = {'ti': 'Timor Leste', 'vn': 'Vietnam','in': 'India','kr':
'Korea','cn': 'China'}

db.define_table('address', Field('country'), Field('state'),
Field('street_address'))
db.address.country.requires=IS_IN_SET(countries, zero=None)

db.define_table('personal_address', db.person, db.address)
db.define_table('business_address, db.client, db.address)

#must define requires to work:
db.personal_address.country.requires=IS_IN_SET(countries, zero=None)
db.business_address.country.requires=IS_IN_SET(countries, zero=None)

I thought table inheritance would mean 'personal_address' and
'business_address' inherits the requires definition in the address table.
Assigned default values are inherited, widgets are inherited, and so are
labels. Just wondering if the requires definition should also be inherited?


[web2py] Re: Checkboxes in SQLFORMs don't show updated values in 1.99.2

2011-11-23 Thread Pepe Araya
some news?

Thank you!




Re: [web2py] Re: PAM users added to auth_user

2011-11-23 Thread Matt Broadstone

On Nov 23, 2011, at 12:33 PM, Massimo Di Pierro  
wrote:

> Please open a ticket and we can get this done

Done, it's located here: 
http://code.google.com/p/web2py/issues/detail?id=535&thanks=535&ts=1322086748

I've been perusing the code for this and it seems to be this way by design 
though I'm not sure why. The offending code seems to be tools.py:1685. 
Obviously this PAM solution is not complete because if system credentials 
change for that user, web2py will still use the old stored info (I believe). 
I'll work on a patch

Matt


> On Nov 23, 8:50 am, Matt Broadstone  wrote:
>> Hopefully this is the last in my thread of auth related emails ;)
>> I was wondering if there is an easy way to stop web2py adding users to
>> its own auth_user database when the users are PAM users. I imagine
>> this is probably an issue for all alternative login methods, not just
>> PAM, but that's the only one we're using right now.
>> 
>> Mat


[web2py] Re: github & hg repo

2011-11-23 Thread Gour
On Wed, 23 Nov 2011 09:34:19 -0800 (PST)
Massimo Di Pierro
 wrote:

> Yes. I will try keep them in sync. But I already start to see some
> advantages of github (submodules)

Is it a feature of github since I know about hg's subrepos.


Sincerely,
Gour



-- 
Those who are on this path are resolute in purpose, 
and their aim is one. O beloved child of the Kurus, 
the intelligence of those who are irresolute is many-branched.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


[web2py] Re: Google Authentication on GAE

2011-11-23 Thread amit
Thanks. It was a problem in my controller code. I solved it by
following the host2py example.

http://code.google.com/p/host2py/source/browse/trunk/controllers/default.py

On Nov 22, 10:35 am, howesc  wrote:
> can't remember the symptions, but when using the bulk load option for
> appconfig to upload/download data i have had to do the following:
>
> #/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/dev_appserver_login.py
> #
> #line 260 in LoginCGI(), add:
> #
> #  #hack for bulk loader
> #  redirect_url = continue_url
> #  output_headers.append(SetUserInfoCookie('t...@example.com', True))
>
> note that the line number about is at least one GAE version out of date
> because i am behind by at least 1 GAE version due to other bugs with GAE
> SDK/web2py in the latest.


[web2py] Re: github & hg repo

2011-11-23 Thread Massimo Di Pierro
Yes. I will try keep them in sync. But I already start to see some
advantages of github (submodules)

On Nov 23, 10:19 am, Bruno Rocha  wrote:
> I Guess the 3 repos bzr & hg & git will be sync
>
>
>
>
>
>
>
>
>
> On Wed, Nov 23, 2011 at 2:05 PM, Gour  wrote:
> > Hello!
>
> > I see that web2py is on the github now. Does it mean end of hg repo?
>
> > Sincerely,
> > Gour
>
> > --
> > As the embodied soul continuously passes, in this body,
> > from boyhood to youth to old age, the soul similarly passes
> > into another body at death. A sober person is not bewildered
> > by such a change.
>
> >http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: PAM users added to auth_user

2011-11-23 Thread Massimo Di Pierro
Please open a ticket and we can get this done.

On Nov 23, 8:50 am, Matt Broadstone  wrote:
> Hopefully this is the last in my thread of auth related emails ;)
> I was wondering if there is an easy way to stop web2py adding users to
> its own auth_user database when the users are PAM users. I imagine
> this is probably an issue for all alternative login methods, not just
> PAM, but that's the only one we're using right now.
>
> Mat


[web2py] Re: starting web2py with uwsgi problem.

2011-11-23 Thread Massimo Di Pierro
I should remove/clarify that sentence. The Rocket server is very
solid.

On Nov 23, 6:48 am, Kenneth Lundström 
wrote:
> Well I think it is said in the book that the rocket server is only for
> development. It is usually not recommended to run anything as root but
> no big problem.
>
> Kenneth
>
>
>
>
>
>
>
> > Thanks for your replies. I eventually mangaged to find out the group
> > and owner of the process that runs web2py. It is uwsgi:uwsgi. Chowning
> > as suggested did work.
>
> > presumably the rocket server version of web2py does run as root. If
> > this is unadvisable as Kenneth suggests should something be mentioned
> > in the book on deploying rocket.
>
> > On Nov 23, 3:54 am, pbreit  wrote:
> >> Why not set ownership of web2py files to whatever uwsgi is expecting?


[web2py] Re: Print output when using Apache

2011-11-23 Thread Cliff
Thanks, Bruno.

My acceptance test box was not acting the same as my development box.

On Nov 23, 10:17 am, Bruno Rocha  wrote:
> nowhere, you are not encouraged to use print statement in production
> (mod_python breaks with this)
>
> if you want output you have to use some Logging or response.write to some
> view
>
> On Wed, Nov 23, 2011 at 11:04 AM, Cliff  wrote:
> > Where does the output from print go when using Apache?
>
> > Running on Ubuntu 10.04 with wsgi.  Installed using the one step
> > install script, no changes.
>
> --
>
> Bruno Rocha
> [http://rochacbruno.com.br]


[web2py] Re: transfer auth_group data with the app

2011-11-23 Thread Cliff
Not tested yet, but it is what I intend to do. It will be a couple of
weeks before
I test this mechanism.

# In db.py before the first table def

# keep current_version current
current version = '0.95'
needs_groups = False
import os
f = open('version.txt')
try:
version = f.read()
f.truncate(0)
f.write(current_version)
f.flush
os.fsync(f.fileno())
f.close()
if version != current_version:
#do stuff
pass
except IOError:
# assume file wasn't there
# so this must be the first time this script has run
needs_groups = True
# define tables, signatures, etc.
.
.
.
if needs_groups:
db.auth_group.insert(

On Nov 22, 9:03 pm, Anthony  wrote:
> Though that will do an unnecessary db query on every request after the
> install. Anyway, you can do:
>
> if db.auth_group.isempty():
>
> Anthony
>
>
>
>
>
>
>
> On Tuesday, November 22, 2011 6:59:58 PM UTC-5, Limedrop wrote:
>
> > Massimo's solution sure is cunning, but you might something like this
> > a bit more maintainable:
>
> > def install():
> >     if db(db.auth_group.id > 0).count() == 0:
> >         db.auth_group.insert(role = 'edit')
> >         db.auth_group.insert(role = 'moderate')
> >         db.auth_group.insert(role = 'comment')
> >     return
>
> > install()
>
> > On Nov 23, 11:28 am, Massimo Di Pierro 
> > wrote:
> > > yes because the file gets moved in a different folder after execution.
> > > It is a bit of a hack.
> > > We should think of a better way
>
> > > On Nov 22, 2:41 pm, petrasadi  wrote:
>
> > > > thank you for this, but I have one more question: is this guarantied to
> > > > execute only once (upon installation).- Hide quoted text -
>
> > > - Show quoted text -


Re: [web2py] github & hg repo

2011-11-23 Thread Bruno Rocha
I Guess the 3 repos bzr & hg & git will be sync

On Wed, Nov 23, 2011 at 2:05 PM, Gour  wrote:

> Hello!
>
> I see that web2py is on the github now. Does it mean end of hg repo?
>
>
> Sincerely,
> Gour
>
>
> --
> As the embodied soul continuously passes, in this body,
> from boyhood to youth to old age, the soul similarly passes
> into another body at death. A sober person is not bewildered
> by such a change.
>
> http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] github & hg repo

2011-11-23 Thread Gour
Hello!

I see that web2py is on the github now. Does it mean end of hg repo?


Sincerely,
Gour


-- 
As the embodied soul continuously passes, in this body, 
from boyhood to youth to old age, the soul similarly passes 
into another body at death. A sober person is not bewildered 
by such a change.

http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


signature.asc
Description: PGP signature


Re: [web2py] Print output when using Apache

2011-11-23 Thread Bruno Rocha
nowhere, you are not encouraged to use print statement in production
(mod_python breaks with this)

if you want output you have to use some Logging or response.write to some
view

On Wed, Nov 23, 2011 at 11:04 AM, Cliff  wrote:

> Where does the output from print go when using Apache?
>
> Running on Ubuntu 10.04 with wsgi.  Installed using the one step
> install script, no changes.
>



-- 

Bruno Rocha
[http://rochacbruno.com.br]


[web2py] PAM users added to auth_user

2011-11-23 Thread Matt Broadstone
Hopefully this is the last in my thread of auth related emails ;)
I was wondering if there is an easy way to stop web2py adding users to
its own auth_user database when the users are PAM users. I imagine
this is probably an issue for all alternative login methods, not just
PAM, but that's the only one we're using right now.

Mat


[web2py] Re: Using web2py with a non-managed Oracle database

2011-11-23 Thread DenesL

You are welcome. Keep us posted.

On Nov 23, 7:05 am, Tim Korb  wrote:
> Denes,
>
> Thanks for your responses--we're making progress.
>
> Tim


[web2py] Re: Formatting numbers in SQLFORM grid

2011-11-23 Thread DenesL
Hi, to get the field to show correctly you have to set your locale
appropriately (see the Python manual) otherwise %f will use the
default (dot for decimal point).

Also keep in mind that widgets (validators have default ones) control
the presentation during input (the C&U in CRUD) while represent is
used for output (the R in CRUD).


On Nov 23, 7:44 am, Freerk Kalsbeek  wrote:
>  Hi Massimo,   Digged into it a little further, and found out that this only 
> happens when represent is used.   ##models.py db.define_table('all_values',   
>   
> Field('price','decimal(5,2)',requires=IS_DECIMAL_IN_RANGE(0,10,dot=','),represent
>  = lambda price,row: '€ %.2f' % price)     )   ## Controller: 
> @auth.requires_login() def index():     grid=SQLFORM.grid(db.all_values.id>0) 
>     form=grid.element('form')     if form and form.accepted:     
> response.flash='Verwerkt'     return dict(grid=grid)   ##view {{extend 
> 'layout.html'}} {{=grid}}   Screenshot 
> at:http://dl.dropbox.com/u/31865598/Schermafdruk.png  But maybe represent is 
> not the best approach to get units being displayed??   Grtz,   Freerk
>
>
>
> -Oorspronkelijk bericht-
> Aan:web2py-users ;
> Van:Massimo Di Pierro 
> Verzonden:di 22-11-2011 15:21
> Onderwerp:[web2py] Re: Formatting numbers in SQLFORM grid
> Can you provide an example? Wat do you mean in list view?
>
> On Nov 22, 6:41 am, Freerk Kalsbeek  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > I'm trying to format numbers according to the dutch standard (decimal
> > comma separator).
>
> > It is working on view/edit views by adding:
> > requires=IS_DECIMAL_IN_RANGE(0,100,dot=',') to the numeric field.
> > But in list views the numbers are displayed with a decimal dot.
>
> > How can I change that?
>
> > Regards,
> > Freerk


RE: [web2py] Re: Formatting numbers in SQLFORM grid

2011-11-23 Thread Freerk Kalsbeek
 Hi Massimo,   Digged into it a little further, and found out that this only 
happens when represent is used.   ##models.py db.define_table('all_values',     
Field('price','decimal(5,2)',requires=IS_DECIMAL_IN_RANGE(0,10,dot=','),represent
 = lambda price,row: '€ %.2f' % price)     )   ## Controller: 
@auth.requires_login() def index():     grid=SQLFORM.grid(db.all_values.id>0)   
  form=grid.element('form')     if form and form.accepted:     
response.flash='Verwerkt'     return dict(grid=grid)   ##view {{extend 
'layout.html'}} {{=grid}}   Screenshot at: 
http://dl.dropbox.com/u/31865598/Schermafdruk.png   But maybe represent is not 
the best approach to get units being displayed??   Grtz,   Freerk

 
 
-Oorspronkelijk bericht-
Aan:web2py-users ; 
Van:Massimo Di Pierro 
Verzonden:di 22-11-2011 15:21
Onderwerp:[web2py] Re: Formatting numbers in SQLFORM grid
Can you provide an example? Wat do you mean in list view?

On Nov 22, 6:41 am, Freerk Kalsbeek  wrote:
> Hi,
>
> I'm trying to format numbers according to the dutch standard (decimal
> comma separator).
>
> It is working on view/edit views by adding:
> requires=IS_DECIMAL_IN_RANGE(0,100,dot=',') to the numeric field.
> But in list views the numbers are displayed with a decimal dot.
>
> How can I change that?
>
> Regards,
> Freerk


[web2py] Print output when using Apache

2011-11-23 Thread Cliff
Where does the output from print go when using Apache?

Running on Ubuntu 10.04 with wsgi.  Installed using the one step
install script, no changes.


Re: [web2py] Re: starting web2py with uwsgi problem.

2011-11-23 Thread Kenneth Lundström
Well I think it is said in the book that the rocket server is only for 
development. It is usually not recommended to run anything as root but 
no big problem.



Kenneth


Thanks for your replies. I eventually mangaged to find out the group
and owner of the process that runs web2py. It is uwsgi:uwsgi. Chowning
as suggested did work.

presumably the rocket server version of web2py does run as root. If
this is unadvisable as Kenneth suggests should something be mentioned
in the book on deploying rocket.

On Nov 23, 3:54 am, pbreit  wrote:

Why not set ownership of web2py files to whatever uwsgi is expecting?




[web2py] Re: starting web2py with uwsgi problem.

2011-11-23 Thread peter
Thanks for your replies. I eventually mangaged to find out the group
and owner of the process that runs web2py. It is uwsgi:uwsgi. Chowning
as suggested did work.

presumably the rocket server version of web2py does run as root. If
this is unadvisable as Kenneth suggests should something be mentioned
in the book on deploying rocket.

On Nov 23, 3:54 am, pbreit  wrote:
> Why not set ownership of web2py files to whatever uwsgi is expecting?


[web2py] Re: Using web2py with a non-managed Oracle database

2011-11-23 Thread Tim Korb
Denes,

Thanks for your responses--we're making progress.

Tim


[web2py] Re: Register user programmatic way

2011-11-23 Thread Christopher Steel
That is pretty sweet Bruno.

Would it make sense calling it _ensure_x rather than new_x or create_x as 
in if the user, group or permission already exists then we do not (try) and 
create again

Here is more complete example using Bruno my_crypt example to illustrate.

# coding: utf8
from gluon.storage import Storage
settings = Storage()
...

##
# debug user group and membership
#
settings.debug_ensure_first_user= False
settings.debug_ensure_users = False
settings.debug_ensure_group_role= False
settings.debug_ensure_membership= False
settings.debug_ensure_permissions   = False

def __ensure_first_user(first_name,last_name,email,password):
users = db(db.auth_user.email==email).select()
if users:
user_id = users[0].id
created = False
if settings.debug_ensure_first_user == True:
print ('found user_id so created equals %s') % created
return (user_id,created)
else:
my_crypt = CRYPT(key=auth.settings.hmac_key)
crypt_pass = my_crypt(password)[0]
id_user= db.auth_user.insert(
   first_name=first_name,
   last_name=last_name,
   email = email,
   password = crypt_pass
   )
created = True
if settings.debug_ensure_first_user == True:
print ('creating user_id')
return (id_user,created)

def __ensure_users():
user_id, created = 
_ensure_user('first','last','em...@address.com','UserPassword12345')
if settings.debug_ensure_users == True:
print ('user id %i') % user_id
print ('created %s') % created

def __ensure_group_role(role,description):
if not auth.id_group(role=role):
auth.add_group(role=role,description=description)
if settings.debug_ensure_group_role == True:
print ('created role %s') %(role)

def __ensure_membership(group_id, user_id):
return_group_id = auth.add_membership(role=role, user_id=user_id)
if settings.debug_ensure_membership == True:
print ('made user_id member of %s') %(role)
return return_group_id
 
def __ensure_permissions(role, description, user_id):
__ensure_group_role(role,description)
return_group_id = __ensure_membership(group_id, user_id)
if settings.debug_ensure_permissions == True:
print return_group_id




Re: [web2py] Re: Web2py on pypy 1.7

2011-11-23 Thread Phyo Arkar
Hows web2py performance on pypy 1.7?

It was worst in previous version..

On Wed, Nov 23, 2011 at 10:47 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

>
> I missed yor response. I will remove the line.
>
> On Nov 22, 10:00 pm, Bruno Rocha  wrote:
> > There is a ticket about thishttp://
> code.google.com/p/web2py/issues/detail?id=464
> >
> > You can remove this line and everything still works normally.
> >
> > On Tue, Nov 22, 2011 at 6:34 PM, Angelo Compagnucci <
> >
> >
> >
> >
> >
> > angelo.compagnu...@gmail.com> wrote:
> > > It give this error:
> >
> > > Traceback (most recent call last):
> > >  File "/home/angelo/DEV/web2py-dev/gluon/main.py", line 493, in
> wsgibase
> > >serve_controller(request, response, session)
> > >  File "/home/angelo/DEV/web2py-dev/gluon/main.py", line 187, in
> > > serve_controller
> > >environment = build_environment(request, response, session)
> > >  File "/home/angelo/DEV/web2py-dev/gluon/compileapp.py", line 269, in
> > > build_environment
> > >__builtins__['__import__'] = __builtin__.__import__ ### WHY?
> > > TypeError: 'module' object does not support item assignment
> >
> > > I'm digging on it!
> >
> > > --
> > > Profile:http://www.gild.com/compagnucciangelo
> > > Register on Gild:http://www.gild.com/referral/compagnucciangelo
> >
> > --
> >
> > Bruno Rocha
> > [http://rochacbruno.com.br]
>