[web2py] Crud.read help

2011-08-30 Thread Anaconda
I am using Crud to create a group and read the group, but i get the
following error below. The Crud.read for the profile function works
fine but not for the group function.

type 'exceptions.AttributeError'('Auth' object has no attribute
'group_id')


My code is:

def profile():
user = auth.user_id
form = crud.read(db.auth_user,user)

return dict(form=form, user=user)


def create_group():
form = crud.create(db.auth_group, next=URL('group'),
message=T(group created)) if auth.user else None
return dict(form=form)

def group():
group = auth.group_id
form = crud.read(db.auth_group,group)
return dict(form=form, group=group)


[web2py] Re: Drop box and populating text area.

2011-08-30 Thread annet
Hi Anthony and Cliff,

Thank you both for your replies. I apologize for not replying earlier
something urgently needed my attention.

At first glance your solutions solve my problem.


Kind regards,

Annet.


Re: [web2py] Re: Mobile detector

2011-08-30 Thread Bruno Rocha
On Tue, Aug 30, 2011 at 2:05 AM, Anthony abasta...@gmail.com wrote:

 Good point. Couldn't you also do something like index.mobi.html or
 index.html.mobi? I don't think these view names would necessarily have to
 be exposed as URLs -- they just need to be used server side to render the
 page appropriately.


It is only a semantic issue, because the pattern for any API is terminating
with the extension format. .json, .xml, .csv . it is more elegant IMO than
x.json.mobi


Re: [web2py] Crud.read help

2011-08-30 Thread Bruno Rocha
That is id_group not group_id

Look all the auth keys()

'accessible_query',
 'add_group',
 'add_membership',
 'add_permission',
 'archive',
 'basic',
 'cas_login',
 'cas_validate',
 'change_password',
 'db',
 'define_tables',
 'del_group',
 'del_membership',
 'del_permission',
 'environment',
 'get_or_create_key',
 'get_or_create_user',
 'groups',
 'has_membership',
 'has_permission',
 'id_group',
 'impersonate',
 'is_impersonating',
 'is_logged_in',
 'log_event',
 'login',
 'login_bare',
 'logout',
 'messages',
 'navbar',
 'not_authorized',
 'profile',
 'random_password',
 'register',
 'request_reset_password',
 'requires',
 'requires_login',
 'requires_membership',
 'requires_permission',
 'requires_signature',
 'reset_password',
 'reset_password_deprecated',
 'retrieve_password',
 'retrieve_username',
 'settings',
 'signature',
 'url',
 'user',
 'user_group',
 'user_id',
 'verify_email']


On Tue, Aug 30, 2011 at 3:30 AM, Anaconda kerwinfra...@gmail.com wrote:

 I am using Crud to create a group and read the group, but i get the
 following error below. The Crud.read for the profile function works
 fine but not for the group function.

 type 'exceptions.AttributeError'('Auth' object has no attribute
 'group_id')


 My code is:

 def profile():
user = auth.user_id
form = crud.read(db.auth_user,user)

return dict(form=form, user=user)


 def create_group():
form = crud.create(db.auth_group, next=URL('group'),
 message=T(group created)) if auth.user else None
return dict(form=form)

 def group():
group = auth.group_id
form = crud.read(db.auth_group,group)
return dict(form=form, group=group)




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


[web2py] Re: Sample code for new scheduler

2011-08-30 Thread Andrew
Hi Massimo,
I watched your video tutorial on the scheduler.  Very helpful and
thanks for a great job.  I haven't quite got your example working, but
I haven't yet spent the time to investigate.

If I understand correctly, the full functioning scheduler with task
dependencies will be coming as some sort of interface to Celery,
correct ?

In your example, you built some functions in the Model.  Can you
please clarify where is the correct place to put such batch style
scripts - in the model or controller.  One could argue that they don't
quite fit into either, (neither data or logic for a view) but I'm not
very experienced with the MVC architecture.   On a similar note, when
building functions called by other functions, are there any guidelines
for where they go.  I don't think there were any examples in the book.

Much thanks
Andrew


[web2py] Re: Published my collection of plugins

2011-08-30 Thread kenji4569
Hi, Tom.

Thank you for reporting the bug.
I just fixed it.
Please check: http://dev.s-cubism.com/plugin_elrte_widget
(you might need to clear the browser cache)

[modification detail]
I upgraded the elrte version from 1.2 to 1.3.
Additionally, since the version 1.3 had a serious IE problem, I
applied some patches for it.
I also slightly modified the plugin css not to conflict with the site
css.
(https://github.com/kenji4569/sqlabs/issues/39)

Kenji

On 8月30日, 午前11:38, tomt tom_tren...@yahoo.com wrote:
 Hi,

 Thanks for the great contributions to web2py.  I'm looking forward to
 trying them.

 I implemented web2py.plugin.elrte_widget.w2p and while it worked great
 with firefox, I had some problems using internet explorer.
 Specifically, the dropdown boxes, such as the colorpicker, disappear
 before I can make a selection.

 This happened with IE7 and IE8.  I used the same IE browser to go to
 thehttp://elrte.org/demoand the problem didn't exist there. Does
 anyone else see this problem?

 - Tom


[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread Cliff
The rest of the insert is working.

As a workaround I'm doing a table update right after the
form.accepts() and just before the redirect.

On Aug 29, 3:45 pm, Anthony abasta...@gmail.com wrote:
 Does it insert the non-hidden fields, or is no record getting inserted at
 all?







 On Friday, August 26, 2011 5:43:15 AM UTC-4, Cliff wrote:

  I use SQLFORM something like this:

  fields = 'dog_name dog_weight dog_birtdate'.split(' ')
  hidden = {'dog_owner' : some_known_value} # We already know who the
  owner is
  SQLFORM(db.dogs, fields=fields, hidden=hidden)

  The hidden fields are on the form.  When I submit the form, they are
  in request.vars, but SQLFORM does not insert them in the database.

  Is this the way it's supposed to work or do I have a bug?

  Thanks,
  Cliff Kachinske


[web2py] request_tenant oddity

2011-08-30 Thread Cliff
Is request_tenant supposed to work this way?

In my model I have a tenants table, which I define before I add the
request_tenant field.  In that table I have one tenant.

In my auth_user table I have one user.  His request_tenant field is
set to the id of the one tenant in the tenant table.

Okay so far.

I log in as that one user and open the appadmin database page.  The
appadmin will show me records that belong to the tenant.  If I create
a record with a bogus request_tenant id, I can't see it in the
appadmin database index pages.

If I log out and use appadmin I can see all the rows on the index
pages BUT the signature fields and the request_tenant field are
invisible.

Are request_tenant and appadmin supposed to interact this way?  It
seems like appadmin should be able to see all records in a table,
regardless of the request_tenant setting.

Thanks,
Cliff Kachinske


[web2py] Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
heres my call :

http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

Resulting in :
htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html

All other .json calls which are not with json RPC fails horribly ,
breaking all my applications.

is that a bug or Feature ?

This will be the last time i updating web2py blindly :(


Re: [web2py] Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Bruno Rocha
Do you have response.generic_patterns  = [*]

??

http://zerp.ly/rochacbruno
Em 30/08/2011 08:46, Phyo Arkar phyo.arkarl...@gmail.com escreveu:
 heres my call :


http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(


[web2py] Re: Ldap and user gruops (Require ldap-group)

2011-08-30 Thread Jose de Soto
You can check this link: 
http://stackoverflow.com/questions/6661674/ldap-and-user-groups-require-ldap-group

For now, I have created the group structure inside my database, so:

1- I login in Ldap
2- (if yes) I check the group in my database



On Jul 12, 3:18 pm, Jose de Soto josedes...@gmail.com wrote:
 Hello,

 I am developing a APP  and I would like to use this APP with our LDAP
 and filter the users by groups. I have this code in APACHE:

                 AuthLDAPURL ldap://localhost/ou=users,dc=comain,dc=com?uid
                 AuthLDAPGroupAttribute memberUid
                 AuthLDAPGroupAttributeIsDN off
                 AuthzLDAPAuthoritative on
                 Require ldap-group
 cn=developer,cn=testers,cn=groups,dc=domain,dc=com

 It works fine. Only people from the list developer and tester can get
 inside this area. I am trying to do the same in Web2py, but I can not
 make a filter from the groups

 I have this code and is working ok without groups:

 auth.settings.login_methods=[ldap_auth(mode='uid_r',server='localhost',port='389',
 base_dn='ou=users,dc=domain,dc=com', filterstr='objectClass=*')]

 I not sure how to use: Require ldap-group in web2py.

 Anyone can help me?

 In advance many thanks


[web2py] Issues with mssql

2011-08-30 Thread nonni
Hi,

I've been using web2py for a bit but haven't delved into the dal
before. I decided to give it a try with a new project and I'm
encountering some difficulty.

I am using MS SQL Server 2008 and pyodbc for database connectivity
btw.

Okay, so I have three problems, any of which could be due to my
ignorance so please bear with me :-)

1)
I need my database text fields to be nvarchar and wanted to use the
mssql2 driver to achieve this since it defines strings as nvarchar
rather than varchar.

I put this into my db.py:

db = SQLDB('mssql2://[user]:[pass]@(local)\\[DB INSTANCE]/[DB NAME]',
check_reserved=['mssql'])

db.define_table(games,
Field(name, string, length=50),
Field(description, string, length=4000),
Field(categoryID, integer),
)

But when I execute the page I get ProgrammingError: ('The SQL
contains 0 parameter markers, but 1 parameters were supplied',
'HY000')

If I remove the utf8 parameter from MSSQL2Adapter's log_execute
statement (execute is not overwritten in MSSQLAdapter) then it goes
through fine. Does anyone know what's up with this?

2)
I also want my description field to be nvarchar(MAX) and I see no
way to do this. Defining length as MAX puts it at INFINITY which
mssql doesn't like and the TEXT field type does not suit my unicode
needs.

3)
When I'm altering my tables there appears to be some problem with
casing with my case-sensitive DB. In the example above, if I change
db.py to remove the categoryID column I get the following error:
ProgrammingError: ('42S22', [42S22] [Microsoft][ODBC SQL Server
Driver][SQL Server]ALTER TABLE DROP COLUMN failed because column
'categoryid' does not exist in table 'games2'. (4924)
(SQLExecDirectW))

Which indicates that web2py attempts to drop categoryid even though I
defined the column name as categoryID.

Lastly, I would like to have more freedom in defining db datatypes and
I'm wondering whether that's possible to do without changing dal.py.
For example, I would like to use mssql's datetime2 type as well as
tinyint and smallint.

Thanks in advance


[web2py] Admin interface slow when static dir has a lot of files

2011-08-30 Thread HarryE
Hello group!
I've been developing a web2py application and I require having a
subfolder in my app's static dir. This subfolder has a file/dir tree
containing around 1000 files.
While the application serves those files ok, the admin interface
becomes unusable, as it tries to refresh itself with the content of my
subfolder each time I make a modification.
While this is not a bug, maybe a manual refresh button may be
implemented for static files.

Unfortunately, I'm not up to this task...

Thank you for your time


Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Phyo Arkar
I having the same problem , with all my json calls , which are not with jsonrpc.
I found this post and  i tried adding

response.generic_patterns = ['*']

and it worked! Thanks alot rammi you save a life.I will never updating
 web2py unless something major improved.

On 8/30/11, Omi Chiba ochib...@gmail.com wrote:
 Rami,

 I'm using the same version and just follow the chapter but It works
 fine.
 It runs under Rocket WSGI web server comming with web2py. If you are
 using another web server, then you should check the configuration. Or
 it could be a typo somewhere. I will send you my app to your mail
 address.

 On Aug 29, 2:29 pm, rami beatrisr...@gmail.com wrote:
 I recently decided to try web2py and so I am going through the
 tutorials in Chapter 3.
 I have Version 1.98.2. When I got to the Say My Name Example, I
 followed the steps, but I found out that I have to add
 response.generic_patterns = ['*']  because I kept getting Invalid
 View.
 Ok, so in my default controller I did this:

 def first():
     response.generic_patterns = ['*']
     return dict()

 def second():
     response.generic_patterns = ['*']
     return dict()

 Then under views, I created first.html and second html:
 first.html
 {{extend 'layout.html'}}
 What is your name?
 form action=second
     input name=visitor_name /
     input type=submit /
 /form

 second.html
 {{extend 'layout.html'}}
 h1 Hello {{=request.vars.visitor_name}}/h1

 Now when I try to see first.html, it just displays First as a title,
 but no form is present.

 Any ideas why this is happening??

 Thank you!


Re: [web2py] Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
Thanks man , i added and now works finally!

So that is a requirement now ?

On 8/30/11, Bruno Rocha rochacbr...@gmail.com wrote:
 Do you have response.generic_patterns  = [*]

 ??

 http://zerp.ly/rochacbruno
 Em 30/08/2011 08:46, Phyo Arkar phyo.arkarl...@gmail.com escreveu:
 heres my call :


 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(



[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Massimo Di Pierro
This is a security measure.
Just add this to your db.py

response.generic_patters = ['*']

Massimo

On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:

 heres my call :
 
 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000
 
 Resulting in :
 htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html
 
 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.
 
 is that a bug or Feature ?
 
 This will be the last time i updating web2py blindly :(



[web2py] Re: Mobile detector

2011-08-30 Thread Massimo Di Pierro
Unless there is a strong objection I will modify the code in trunk to
use index.mobile.html

view = '.'.join(view.split().insert(-1,'mobile'))

On Aug 30, 2:13 am, Bruno Rocha rochacbr...@gmail.com wrote:
 On Tue, Aug 30, 2011 at 2:05 AM, Anthony abasta...@gmail.com wrote:
  Good point. Couldn't you also do something like index.mobi.html or
  index.html.mobi? I don't think these view names would necessarily have to
  be exposed as URLs -- they just need to be used server side to render the
  page appropriately.

 It is only a semantic issue, because the pattern for any API is terminating
 with the extension format. .json, .xml, .csv . it is more elegant IMO than
 x.json.mobi


[web2py] Re: Sample code for new scheduler

2011-08-30 Thread Massimo Di Pierro


On Aug 30, 3:47 am, Andrew awillima...@gmail.com wrote:
 Hi Massimo,
 I watched your video tutorial on the scheduler.  Very helpful and
 thanks for a great job.  I haven't quite got your example working, but
 I haven't yet spent the time to investigate.

 If I understand correctly, the full functioning scheduler with task
 dependencies will be coming as some sort of interface to Celery,
 correct ?

Not quite. There are two schedulers (different and incompatible):
- gluon.scheduler.py (in the video)
- web2py-celery
They can both run the same functions but they use different db models.

 In your example, you built some functions in the Model.  Can you
 please clarify where is the correct place to put such batch style
 scripts - in the model or controller.  One could argue that they don't
 quite fit into either, (neither data or logic for a view) but I'm not
 very experienced with the MVC architecture.   On a similar note, when
 building functions called by other functions, are there any guidelines
 for where they go.  I don't think there were any examples in the book.

I would put them into modules in a file called, for example, tasks.py.
I will post more examples.

 Much thanks
 Andrew


[web2py] Re: request_tenant oddity

2011-08-30 Thread Massimo Di Pierro
Currently, even appadmin is tenant dependent.

On Aug 30, 6:03 am, Cliff cjk...@gmail.com wrote:
 Is request_tenant supposed to work this way?

 In my model I have a tenants table, which I define before I add the
 request_tenant field.  In that table I have one tenant.

 In my auth_user table I have one user.  His request_tenant field is
 set to the id of the one tenant in the tenant table.

 Okay so far.

 I log in as that one user and open the appadmin database page.  The
 appadmin will show me records that belong to the tenant.  If I create
 a record with a bogus request_tenant id, I can't see it in the
 appadmin database index pages.

 If I log out and use appadmin I can see all the rows on the index
 pages BUT the signature fields and the request_tenant field are
 invisible.

 Are request_tenant and appadmin supposed to interact this way?  It
 seems like appadmin should be able to see all records in a table,
 regardless of the request_tenant setting.

 Thanks,
 Cliff Kachinske


[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Massimo Di Pierro
We did. Over and over. We announced this starting... 1.95 ;-)

On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:

 Ok thats good .
 
 But please announce somewhere that 1.98.2 will break compatbility to
 existing views those are without
 response.generic_patters = ['*']
 
 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py
 
response.generic_patters = ['*']
 
 Massimo
 
 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:
 
 heres my call :
 
 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000
 
 Resulting in :
 htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html
 
 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.
 
 is that a bug or Feature ?
 
 This will be the last time i updating web2py blindly :(
 
 



[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
Ok thats good .

But please announce somewhere that 1.98.2 will break compatbility to
existing views those are without
response.generic_patters = ['*']

On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py

 response.generic_patters = ['*']

 Massimo

 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:

 heres my call :

 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(




[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
On the mailing list?

One problem with mailing list is it is not a forum and it can't have a
Sticky feature. Information of last month is totally lost. Most busy
people on tight schedule wont have time to dig into pile of posts.

So a good place to put it is on the web2py.com home page , make a
Notice  section . Also in Download page showing that notice.

I update from 1.96 tho .

On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 We did. Over and over. We announced this starting... 1.95 ;-)

 On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:

 Ok thats good .

 But please announce somewhere that 1.98.2 will break compatbility to
 existing views those are without
 response.generic_patters = ['*']

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py

response.generic_patters = ['*']

 Massimo

 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:

 heres my call :

 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view
 (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(






[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread DenesL
SQLFORM with hidden fields works fine in 1.98.2:

# model
db.define_table('dog',
  Field('name'),
  Field('age', 'integer')
  )

# controller
def newdog():
  form = SQLFORM(db.dog, fields=['name'], hidden={'age': 1})
  if form.accepts(request, session):
response.flash = 'ok'
  elif form.errors:
response.flash = 'not ok'
  return dict(form = form)

Any new entry in the dog table will have the age field set to 1.



Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 8:05:59 AM UTC-4, Phyo Arkar wrote:

 I having the same problem , with all my json calls , which are not with 
 jsonrpc.
 I found this post and  i tried adding

 response.generic_patterns = ['*']

 and it worked! Thanks alot rammi you save a life.I will never updating
  web2py unless something major improved.

Note, changes in web2py only cause breaks like this when they are fixing 
bugs or resolving a security vulnerability. In this case, there was a 
security vulnerability, and it might be good that it broke your application, 
because it could prompt you to discover and fix a vulnerability. In fact, 
you probably should not simply set response.generic_patterns = ['*'], as 
that will completely restore the old behavior and therefore leave you open 
to the vulnerability. Instead, you should be more specific with 
response.generic_patterns.

If you enable generic.json for all requests (which is what you have done), 
then a malicious user can go to _any_ function in _any_ controller in you 
app (even functions that you do not intend to serve via JSON) and get a JSON 
view of whatever is returned by that function. If your function returns any 
variables that you do not want exposed to all users or returns a database 
select that includes some fields you do not want to expose to all users, 
those variables and fields will be exposed via JSON. For example, if you 
return some user records to a view (e.g., a list of users/members), all 
fields will be exposed (including the password field).

To be safest, it is best to conditionally set response.generic_patterns = 
['json'] only when needed. You could set it inside the functions that need 
to serve JSON, or set it conditionally in a model depending on the incoming 
request. Note, generic_patterns can be a list of globs that match the 
incoming controller/function.extension.

Anthony



Re: [web2py] Re: Mobile detector

2011-08-30 Thread Angelo Compagnucci
I think that the extension should match the content, it's more clear.

For a json object I'm expecting a .json, an xml should have an xml
extension and so on. So for the mobile view I think the best is to
have a .mobi extension, but this is IMHO.

Also using the .mobile.html could be viable, because a mobile view is
substantially an html file.

For me it's ok to have .mobile.html extension

2011/8/30 Massimo Di Pierro massimo.dipie...@gmail.com:
 Unless there is a strong objection I will modify the code in trunk to
 use index.mobile.html

 view = '.'.join(view.split().insert(-1,'mobile'))

 On Aug 30, 2:13 am, Bruno Rocha rochacbr...@gmail.com wrote:
 On Tue, Aug 30, 2011 at 2:05 AM, Anthony abasta...@gmail.com wrote:
  Good point. Couldn't you also do something like index.mobi.html or
  index.html.mobi? I don't think these view names would necessarily have to
  be exposed as URLs -- they just need to be used server side to render the
  page appropriately.

 It is only a semantic issue, because the pattern for any API is terminating
 with the extension format. .json, .xml, .csv . it is more elegant IMO than
 x.json.mobi


[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Massimo Di Pierro
Good idea. Will do that.

On Aug 30, 2011, at 7:38 AM, Phyo Arkar wrote:

 On the mailing list?
 
 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.
 
 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.
 
 I update from 1.96 tho .
 
 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 We did. Over and over. We announced this starting... 1.95 ;-)
 
 On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:
 
 Ok thats good .
 
 But please announce somewhere that 1.98.2 will break compatbility to
 existing views those are without
 response.generic_patters = ['*']
 
 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py
 
   response.generic_patters = ['*']
 
 Massimo
 
 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:
 
 heres my call :
 
 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000
 
 Resulting in :
 htmlbodyh1invalid view
 (extraction/listMIME.json)/h1/body/html
 
 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.
 
 is that a bug or Feature ?
 
 This will be the last time i updating web2py blindly :(
 
 
 
 



[web2py] Re: Mobile detector

2011-08-30 Thread Massimo Di Pierro
index.mobile.html is in trunk

On Aug 30, 8:19 am, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 I think that the extension should match the content, it's more clear.

 For a json object I'm expecting a .json, an xml should have an xml
 extension and so on. So for the mobile view I think the best is to
 have a .mobi extension, but this is IMHO.

 Also using the .mobile.html could be viable, because a mobile view is
 substantially an html file.

 For me it's ok to have .mobile.html extension

 2011/8/30 Massimo Di Pierro massimo.dipie...@gmail.com:







  Unless there is a strong objection I will modify the code in trunk to
  use index.mobile.html

  view = '.'.join(view.split().insert(-1,'mobile'))

  On Aug 30, 2:13 am, Bruno Rocha rochacbr...@gmail.com wrote:
  On Tue, Aug 30, 2011 at 2:05 AM, Anthony abasta...@gmail.com wrote:
   Good point. Couldn't you also do something like index.mobi.html or
   index.html.mobi? I don't think these view names would necessarily have to
   be exposed as URLs -- they just need to be used server side to render the
   page appropriately.

  It is only a semantic issue, because the pattern for any API is terminating
  with the extension format. .json, .xml, .csv . it is more elegant IMO than
  x.json.mobi


[web2py] Parameter-Based System routers errors

2011-08-30 Thread Francisco Costa
On the Parameter-Based System 
http://web2py.com/book/default/chapter/04#Parameter-Based-System
is there a way we can redirect to an error page when the controller or
the function are invalid or a ticket is generated?


[web2py] Re: Parameter-Based System routers errors

2011-08-30 Thread Anthony
I believe routes_onerror can be used with the parameter-based system as well 
as the pattern-based system. 
See http://web2py.com/book/default/chapter/04#Routes-on-Error.

Anthony


[web2py] Re: Published my collection of plugins

2011-08-30 Thread Daniel Aguayo
fantastic kenji! nice job


Re: [web2py] Re: Parameter-Based System routers errors

2011-08-30 Thread Jonathan Lundell
On Aug 30, 2011, at 7:47 AM, Anthony wrote:

 I believe routes_onerror can be used with the parameter-based system as well 
 as the pattern-based system. See 
 http://web2py.com/book/default/chapter/04#Routes-on-Error.

Right. Error handling is identical under both routers.

[web2py] Re: Published my collection of plugins

2011-08-30 Thread tomt
Hi,

I tried your update, and I can now successfully modify text color and
background color with IE7 and IE8. Unfortunately I still see the same
problem with 'Format', 'Font size' and 'Font' dropdown selections.
That is,
the dropdown selection is erased before I can select an option.

- Tom

On Aug 30, 4:05 am, kenji4569 hos...@s-cubism.jp wrote:
 Hi, Tom.

 Thank you for reporting the bug.
 I just fixed it.
 Please check:http://dev.s-cubism.com/plugin_elrte_widget
 (you might need to clear the browser cache)

 [modification detail]
 I upgraded theelrteversion from 1.2 to 1.3.
 Additionally, since the version 1.3 had a serious IE problem, I
 applied some patches for it.
 I also slightly modified the plugin css not to conflict with the site
 css.
 (https://github.com/kenji4569/sqlabs/issues/39)

 Kenji

 On 8月30日, 午前11:38, tomt tom_tren...@yahoo.com wrote:



  Hi,

  Thanks for the great contributions to web2py.  I'm looking forward to
  trying them.

  I implemented web2py.plugin.elrte_widget.w2p and while it worked great
  with firefox, I had some problems using internet explorer.
  Specifically, the dropdown boxes, such as the colorpicker, disappear
  before I can make a selection.

  This happened with IE7 and IE8.  I used the same IE browser to go to
  thehttp://elrte.org/demoandthe problem didn't exist there. Does
  anyone else see this problem?

  - Tom- Hide quoted text -

 - Show quoted text -


Re: [web2py] Re: Published my collection of plugins

2011-08-30 Thread Richard Vézina
Just wonderful!

Richard

On Tue, Aug 30, 2011 at 11:14 AM, tomt tom_tren...@yahoo.com wrote:

 Hi,

 I tried your update, and I can now successfully modify text color and
 background color with IE7 and IE8. Unfortunately I still see the same
 problem with 'Format', 'Font size' and 'Font' dropdown selections.
 That is,
 the dropdown selection is erased before I can select an option.

 - Tom

 On Aug 30, 4:05 am, kenji4569 hos...@s-cubism.jp wrote:
  Hi, Tom.
 
  Thank you for reporting the bug.
  I just fixed it.
  Please check:http://dev.s-cubism.com/plugin_elrte_widget
  (you might need to clear the browser cache)
 
  [modification detail]
  I upgraded theelrteversion from 1.2 to 1.3.
  Additionally, since the version 1.3 had a serious IE problem, I
  applied some patches for it.
  I also slightly modified the plugin css not to conflict with the site
  css.
  (https://github.com/kenji4569/sqlabs/issues/39)
 
  Kenji
 
  On 8月30日, 午前11:38, tomt tom_tren...@yahoo.com wrote:
 
 
 
   Hi,
 
   Thanks for the great contributions to web2py.  I'm looking forward to
   trying them.
 
   I implemented web2py.plugin.elrte_widget.w2p and while it worked great
   with firefox, I had some problems using internet explorer.
   Specifically, the dropdown boxes, such as the colorpicker, disappear
   before I can make a selection.
 
   This happened with IE7 and IE8.  I used the same IE browser to go to
   thehttp://elrte.org/demoandthe problem didn't exist there. Does
   anyone else see this problem?
 
   - Tom- Hide quoted text -
 
  - Show quoted text -


[web2py] cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread larry
Dear All, i am new to web2py and this forum, so please pardon me if
this subject has already been addressed. Here's the problem:

i have python 2.7 installed on windows 7.
i have downloaded web2py for windows from this site:
http://web2py.com/examples/default/download.
According to the site: The source code version (of web2py) works on
all supported platforms, including Linux, but it requires Python 2.4,
2.5, 2.6, or 2.7. It runs on Windows and most Unix systems...
After downloading the file, ii am then instructed to ...unzip it and
click on web2py.exe (windows)...
After clicking on web2py.exe, i get the following message on the
command line:
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.98.2 (2011-08-04 00:47:09)
Database drivers available: SQLite3. pymysql
Starting hardcron...

Another window pops up with the following information:
Server IP: 127.0.0.1
Server Port: 8000
Choose Password:

When i enter a password and either press enter or click the start
server button, i get the following command line error message:
ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other
process and it won't share.
Please visit: http://127.0.0.1:8000
starting browser...
WARNING: Rocket.Errors.Port8000: Listener started when not ready.

Can anyone help a newbie? Otherwise it seems my adventure with web2py
ended before it even started!


[web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread Alan Etkin
I am not sure, but it seems that another application is blocking the
access to port 8000. Did you check if the windows firewall is not
blocking the port?. Otherwise try specifying another port than 8000
(higher) in the development server arguments

On Aug 30, 12:09 pm, larry solarh...@gmail.com wrote:
 Dear All, i am new to web2py and this forum, so please pardon me if
 this subject has already been addressed. Here's the problem:

 i have python 2.7 installed on windows 7.
 i have downloaded web2py for windows from this 
 site:http://web2py.com/examples/default/download.
 According to the site: The source code version (of web2py) works on
 all supported platforms, including Linux, but it requires Python 2.4,
 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems...
 After downloading the file, ii am then instructed to ...unzip it and
 click on web2py.exe (windows)...
 After clicking on web2py.exe, i get the following message on the
 command line:
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2011
 Version 1.98.2 (2011-08-04 00:47:09)
 Database drivers available: SQLite3. pymysql
 Starting hardcron...

 Another window pops up with the following information:
 Server IP: 127.0.0.1
 Server Port: 8000
 Choose Password:

 When i enter a password and either press enter or click the start
 server button, i get the following command line error message:
 ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other
 process and it won't share.
 Please visit:http://127.0.0.1:8000
 starting browser...
 WARNING: Rocket.Errors.Port8000: Listener started when not ready.

 Can anyone help a newbie? Otherwise it seems my adventure with web2py
 ended before it even started!


Re: [web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread Jonathan Lundell
On Aug 30, 2011, at 8:37 AM, Alan Etkin wrote:

 I am not sure, but it seems that another application is blocking the
 access to port 8000. Did you check if the windows firewall is not
 blocking the port?. Otherwise try specifying another port than 8000
 (higher) in the development server arguments

This also happens if you have web2py still running from an earlier try, and 
didn't shut it down completely.

 
 On Aug 30, 12:09 pm, larry solarh...@gmail.com wrote:
 Dear All, i am new to web2py and this forum, so please pardon me if
 this subject has already been addressed. Here's the problem:
 
 i have python 2.7 installed on windows 7.
 i have downloaded web2py for windows from this 
 site:http://web2py.com/examples/default/download.
 According to the site: The source code version (of web2py) works on
 all supported platforms, including Linux, but it requires Python 2.4,
 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems...
 After downloading the file, ii am then instructed to ...unzip it and
 click on web2py.exe (windows)...
 After clicking on web2py.exe, i get the following message on the
 command line:
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2011
 Version 1.98.2 (2011-08-04 00:47:09)
 Database drivers available: SQLite3. pymysql
 Starting hardcron...
 
 Another window pops up with the following information:
 Server IP: 127.0.0.1
 Server Port: 8000
 Choose Password:
 
 When i enter a password and either press enter or click the start
 server button, i get the following command line error message:
 ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other
 process and it won't share.
 Please visit:http://127.0.0.1:8000
 starting browser...
 WARNING: Rocket.Errors.Port8000: Listener started when not ready.
 
 Can anyone help a newbie? Otherwise it seems my adventure with web2py
 ended before it even started!




[web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread Anthony
If you have Python 2.7 installed on your system and you want web2py to use 
it, then you should download the web2py Source version (not the Windows 
version). To run the source version, click the web2py.py file in the /web2py 
folder (there's no web2py.exe file). The Windows version of web2py includes 
its own Python 2.5 interpreter and will not use the Python version installed 
on your system.

Do you have another process running that is using port 8000? If so, then 
maybe try running web2py on a different port (i.e., just enter a different 
port number in the dialog -- maybe 8080).

Anthony

On Tuesday, August 30, 2011 11:09:34 AM UTC-4, larry wrote:

 Dear All, i am new to web2py and this forum, so please pardon me if 
 this subject has already been addressed. Here's the problem: 

 i have python 2.7 installed on windows 7. 
 i have downloaded web2py for windows from this site: 
 http://web2py.com/examples/default/download. 
 According to the site: The source code version (of web2py) works on 
 all supported platforms, including Linux, but it requires Python 2.4, 
 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems... 
 After downloading the file, ii am then instructed to ...unzip it and 
 click on web2py.exe (windows)... 
 After clicking on web2py.exe, i get the following message on the 
 command line: 
 web2py Web Framework 
 Created by Massimo Di Pierro, Copyright 2007-2011 
 Version 1.98.2 (2011-08-04 00:47:09) 
 Database drivers available: SQLite3. pymysql 
 Starting hardcron... 

 Another window pops up with the following information: 
 Server IP: 127.0.0.1 
 Server Port: 8000 
 Choose Password: 

 When i enter a password and either press enter or click the start 
 server button, i get the following command line error message: 
 ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other 
 process and it won't share. 
 Please visit: http://127.0.0.1:8000 
 starting browser... 
 WARNING: Rocket.Errors.Port8000: Listener started when not ready. 

 Can anyone help a newbie? Otherwise it seems my adventure with web2py 
 ended before it even started!



Re: [web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread Lawrence Agbemabiese
Dear All, thanks for your prompt responses! This is a great community.  i
was just coming back to report that i somehow got it working by installing
python 2.5 (win) and trying again -- and it works! Except i don't like the
idea of having two versions of python installed on my machine, but ok for
now. Maybe later, i'll uninstall the 2.5 and try Anthony's suggestion, being
careful also not to have another process running -- as was indeed the case
correctly diagnosed by Alan and Jonathan. Thanks again, everyone!

On Tue, Aug 30, 2011 at 5:45 PM, Anthony abasta...@gmail.com wrote:

 If you have Python 2.7 installed on your system and you want web2py to use
 it, then you should download the web2py Source version (not the Windows
 version). To run the source version, click the web2py.py file in the /web2py
 folder (there's no web2py.exe file). The Windows version of web2py includes
 its own Python 2.5 interpreter and will not use the Python version installed
 on your system.

 Do you have another process running that is using port 8000? If so, then
 maybe try running web2py on a different port (i.e., just enter a different
 port number in the dialog -- maybe 8080).

 Anthony


 On Tuesday, August 30, 2011 11:09:34 AM UTC-4, larry wrote:

 Dear All, i am new to web2py and this forum, so please pardon me if
 this subject has already been addressed. Here's the problem:

 i have python 2.7 installed on windows 7.
 i have downloaded web2py for windows from this site:
 http://web2py.com/examples/**default/downloadhttp://web2py.com/examples/default/download.

 According to the site: The source code version (of web2py) works on
 all supported platforms, including Linux, but it requires Python 2.4,
 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems...
 After downloading the file, ii am then instructed to ...unzip it and
 click on web2py.exe (windows)...
 After clicking on web2py.exe, i get the following message on the
 command line:
 web2py Web Framework
 Created by Massimo Di Pierro, Copyright 2007-2011
 Version 1.98.2 (2011-08-04 00:47:09)
 Database drivers available: SQLite3. pymysql
 Starting hardcron...

 Another window pops up with the following information:
 Server IP: 127.0.0.1
 Server Port: 8000
 Choose Password:

 When i enter a password and either press enter or click the start
 server button, i get the following command line error message:
 ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other
 process and it won't share.
 Please visit: http://127.0.0.1:8000
 starting browser...
 WARNING: Rocket.Errors.Port8000: Listener started when not ready.

 Can anyone help a newbie? Otherwise it seems my adventure with web2py
 ended before it even started!




-- 
Fate is a future you didn't work to change -- Joe Konrath


[web2py] Re: request_tenant oddity

2011-08-30 Thread Cliff
Massimo,

Thanks for the quick response.

This is actually a good thing as it will force me to get my Postgresql
chops together now rather than later.

Cliff Kachinske

On Aug 30, 8:20 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Currently, even appadmin is tenant dependent.

 On Aug 30, 6:03 am, Cliff cjk...@gmail.com wrote:







  Is request_tenant supposed to work this way?

  In my model I have a tenants table, which I define before I add the
  request_tenant field.  In that table I have one tenant.

  In my auth_user table I have one user.  His request_tenant field is
  set to the id of the one tenant in the tenant table.

  Okay so far.

  I log in as that one user and open the appadmin database page.  The
  appadmin will show me records that belong to the tenant.  If I create
  a record with a bogus request_tenant id, I can't see it in the
  appadmin database index pages.

  If I log out and use appadmin I can see all the rows on the index
  pages BUT the signature fields and the request_tenant field are
  invisible.

  Are request_tenant and appadmin supposed to interact this way?  It
  seems like appadmin should be able to see all records in a table,
  regardless of the request_tenant setting.

  Thanks,
  Cliff Kachinske


[web2py] Re: request_tenant oddity

2011-08-30 Thread Massimo Di Pierro
I think you can disable this although I have not tried. In your model:

if request.controller=='appadmin': db._request_tenant=None

If this does what you want, please let me know.

On Aug 30, 7:20 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Currently, even appadmin is tenant dependent.

 On Aug 30, 6:03 am, Cliff cjk...@gmail.com wrote:







  Is request_tenant supposed to work this way?

  In my model I have a tenants table, which I define before I add the
  request_tenant field.  In that table I have one tenant.

  In my auth_user table I have one user.  His request_tenant field is
  set to the id of the one tenant in the tenant table.

  Okay so far.

  I log in as that one user and open the appadmin database page.  The
  appadmin will show me records that belong to the tenant.  If I create
  a record with a bogus request_tenant id, I can't see it in the
  appadmin database index pages.

  If I log out and use appadmin I can see all the rows on the index
  pages BUT the signature fields and the request_tenant field are
  invisible.

  Are request_tenant and appadmin supposed to interact this way?  It
  seems like appadmin should be able to see all records in a table,
  regardless of the request_tenant setting.

  Thanks,
  Cliff Kachinske


[web2py] question about modules reload

2011-08-30 Thread Richard
Hello,

Is it normal that I have to restart web2py between any change to code
embed into modules files?

If so... Could it be possible to have a reload button in the admin
interface like the update language button to force the reload of the
modules files to improve the convinience of the admin interface?

Thanks

Richard


[web2py] Re: question about modules reload

2011-08-30 Thread Massimo Di Pierro
from gluon.custom_import  import track_changes; track_changes(True)

On Aug 30, 11:15 am, Richard ml.richard.vez...@gmail.com wrote:
 Hello,

 Is it normal that I have to restart web2py between any change to code
 embed into modules files?

 If so... Could it be possible to have a reload button in the admin
 interface like the update language button to force the reload of the
 modules files to improve the convinience of the admin interface?

 Thanks

 Richard


Re: [web2py] Re: cannot run web2py on windows 7 machine with python 2.7 installed

2011-08-30 Thread Anthony
I'm running web2py source code version on Windows 7 with Python 2.7 with no 
problems.

Anthony

On Tuesday, August 30, 2011 11:56:25 AM UTC-4, larry wrote:

 Dear All, thanks for your prompt responses! This is a great community.  i 
 was just coming back to report that i somehow got it working by installing 
 python 2.5 (win) and trying again -- and it works! Except i don't like the 
 idea of having two versions of python installed on my machine, but ok for 
 now. Maybe later, i'll uninstall the 2.5 and try Anthony's suggestion, being 
 careful also not to have another process running -- as was indeed the case 
 correctly diagnosed by Alan and Jonathan. Thanks again, everyone!

 On Tue, Aug 30, 2011 at 5:45 PM, Anthony abas...@gmail.com wrote:

 If you have Python 2.7 installed on your system and you want web2py to use 
 it, then you should download the web2py Source version (not the Windows 
 version). To run the source version, click the web2py.py file in the /web2py 
 folder (there's no web2py.exe file). The Windows version of web2py includes 
 its own Python 2.5 interpreter and will not use the Python version installed 
 on your system.

 Do you have another process running that is using port 8000? If so, then 
 maybe try running web2py on a different port (i.e., just enter a different 
 port number in the dialog -- maybe 8080).

 Anthony


 On Tuesday, August 30, 2011 11:09:34 AM UTC-4, larry wrote:

 Dear All, i am new to web2py and this forum, so please pardon me if 
 this subject has already been addressed. Here's the problem: 

 i have python 2.7 installed on windows 7. 
 i have downloaded web2py for windows from this site: 
 http://web2py.com/examples/**default/downloadhttp://web2py.com/examples/default/download.
  

 According to the site: The source code version (of web2py) works on 
 all supported platforms, including Linux, but it requires Python 2.4, 
 2.5, 2.6, or 2.7. It runs on Windows and most Unix systems... 
 After downloading the file, ii am then instructed to ...unzip it and 
 click on web2py.exe (windows)... 
 After clicking on web2py.exe, i get the following message on the 
 command line: 
 web2py Web Framework 
 Created by Massimo Di Pierro, Copyright 2007-2011 
 Version 1.98.2 (2011-08-04 00:47:09) 
 Database drivers available: SQLite3. pymysql 
 Starting hardcron... 

 Another window pops up with the following information: 
 Server IP: 127.0.0.1 
 Server Port: 8000 
 Choose Password: 

 When i enter a password and either press enter or click the start 
 server button, i get the following command line error message: 
 ERROR: Rocket.Errors. Port8000: Socket 127.0.0.1:8000 in use by other 
 process and it won't share. 
 Please visit: http://127.0.0.1:8000 
 starting browser... 
 WARNING: Rocket.Errors.Port8000: Listener started when not ready. 

 Can anyone help a newbie? Otherwise it seems my adventure with web2py 
 ended before it even started!




 -- 
 Fate is a future you didn't work to change -- Joe Konrath



Re: [web2py] Re: question about modules reload

2011-08-30 Thread Richard Vézina
Thank you!

Richard

On Tue, Aug 30, 2011 at 12:23 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 from gluon.custom_import  import track_changes; track_changes(True)

 On Aug 30, 11:15 am, Richard ml.richard.vez...@gmail.com wrote:
  Hello,
 
  Is it normal that I have to restart web2py between any change to code
  embed into modules files?
 
  If so... Could it be possible to have a reload button in the admin
  interface like the update language button to force the reload of the
  modules files to improve the convinience of the admin interface?
 
  Thanks
 
  Richard



[web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread rami
I know this myight be a silly question, but how do I install this app?
Do I have to put it in the same folder as where my web2py is at? Right
now I am accessing web2py admin interface through HTTP from another
computer where I have downloaded this saymyname app. So When I am on
this other computer and I try to upload it tells me I can't upload
because i get this error:

Unable to download app because:
[Errno 2] No such file or directory: 'saymyname'


So basically I am using apache server with mod_wsgi and a virtual host
to run web2py on the server I am accessing the admin interface.

Thanks,

Beatris.

On Aug 29, 2:36 pm, Omi Chiba ochib...@gmail.com wrote:
 Rami,

 I'm using the same version and just follow the chapter but It works
 fine.
 It runs under Rocket WSGI web server comming with web2py. If you are
 using another web server, then you should check the configuration. Or
 it could be a typo somewhere. I will send youmyapp to your mail
 address.

 On Aug 29, 2:29 pm, rami beatrisr...@gmail.com wrote:







  I recently decided to try web2py and so I am going through the
  tutorials in Chapter 3.
  I have Version 1.98.2. When I got to theSayMyNameExample, I
  followed the steps, but I found out that I have to add
  response.generic_patterns = ['*']  because I kept getting Invalid
  View.
  Ok, so inmydefault controller I did this:

  def first():
      response.generic_patterns = ['*']
      return dict()

  def second():
      response.generic_patterns = ['*']
      return dict()

  Then under views, I created first.html and second html:
  first.html
  {{extend 'layout.html'}}
  What is yourname?
  form action=second
      inputname=visitor_name /
      input type=submit /
  /form

  second.html
  {{extend 'layout.html'}}
  h1 Hello {{=request.vars.visitor_name}}/h1

  Now when I try to see first.html, it just displays First as a title,
  but no form is present.

  Any ideas why this is happening??

  Thank you!


Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread pbreit
Are we defaulting generics on for request.is_local?

[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
Cool , also please note about the related vulnerability too , and a
security announcement section may be? I do not know about the related
vulnerability until Anthony told me now .

On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 Good idea. Will do that.

 On Aug 30, 2011, at 7:38 AM, Phyo Arkar wrote:

 On the mailing list?

 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.

 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.

 I update from 1.96 tho .

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 We did. Over and over. We announced this starting... 1.95 ;-)

 On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:

 Ok thats good .

 But please announce somewhere that 1.98.2 will break compatbility to
 existing views those are without
 response.generic_patters = ['*']

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py

   response.generic_patters = ['*']

 Massimo

 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:

 heres my call :

 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view
 (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(








[web2py] Re: crud not updating

2011-08-30 Thread apple
Works with crud.settings.detect_record_change = False

Without this it fails any time you make 2 edits to the same record
within a session. Does not have to be 2 sequential changes e.g. I
change record 1 then record 2 then record 3.then try to update
record 1 again and it fails.

On Aug 30, 4:15 am, Anthony abasta...@gmail.com wrote:
 Yes, that is in fact the problem, but shouldn't you be able to make two
 edits to a record in a row without an intervening failure? It's not just
 that a failure message is missing -- the behavior seems wrong.

 Anthony







 On Monday, August 29, 2011 10:44:35 PM UTC-4, Massimo Di Pierro wrote:

  Can you try?

  crud.settings.detect_record_change = False

  SQLFORM has a mechanism to prevent two users from doing this:

  user 1) visualize and edit record
  user 2) visualize and edit record
  user 1) save changes
  user 2) save changes and override changes by user 1

  in SQLFORM it is disabled by default. In crud it is enabled by
  default.

  crud.settings.detect_record_change = True

  Still something is wrong because you should get a message about it.

  On Aug 28, 2:18 pm, apple sim...@gmail.com wrote:
   If the database fails to update within CRUD is there a way I can view
   the error?

   I have a controller with this code that works fine:
          form=SQLFORM(table,a.id)
          if form.accepts(request.vars, session):
              response.flash=record updated

   I replace it with:
         form=crud.update(table, a.id)

   Now it works fine the first time the form is changed. Then the second
   time it correctly calls the controller but the database is not updated
   and the form reverts to the pre-change values. This continues so on
   odd submits it works and even submits it does not.

   It also seems to work on all submits when I excluded certain fields. I
   am thinking maybe there is a database error thrown inside CRUD but no
   error message is logged.


Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Phyo Arkar
Wow

thanks alot for the notice Anthony , thats such a big security hole.

So , putting response.generic_patterns =  ['json']  inside db.py ,
will still re-open that vulnerability?


Putting it on all views that return Json will be the safest?
On 8/30/11, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 30, 2011 8:05:59 AM UTC-4, Phyo Arkar wrote:

 I having the same problem , with all my json calls , which are not with
 jsonrpc.
 I found this post and  i tried adding

 response.generic_patterns = ['*']

 and it worked! Thanks alot rammi you save a life.I will never updating
  web2py unless something major improved.

 Note, changes in web2py only cause breaks like this when they are fixing
 bugs or resolving a security vulnerability. In this case, there was a
 security vulnerability, and it might be good that it broke your application,
 because it could prompt you to discover and fix a vulnerability. In fact,
 you probably should not simply set response.generic_patterns = ['*'], as
 that will completely restore the old behavior and therefore leave you open
 to the vulnerability. Instead, you should be more specific with
 response.generic_patterns.

 If you enable generic.json for all requests (which is what you have done),
 then a malicious user can go to _any_ function in _any_ controller in you
 app (even functions that you do not intend to serve via JSON) and get a JSON
 view of whatever is returned by that function. If your function returns any
 variables that you do not want exposed to all users or returns a database
 select that includes some fields you do not want to expose to all users,
 those variables and fields will be exposed via JSON. For example, if you
 return some user records to a view (e.g., a list of users/members), all
 fields will be exposed (including the password field).

 To be safest, it is best to conditionally set response.generic_patterns =
 ['json'] only when needed. You could set it inside the functions that need
 to serve JSON, or set it conditionally in a model depending on the incoming
 request. Note, generic_patterns can be a list of globs that match the
 incoming controller/function.extension.

 Anthony




Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 1:00:29 PM UTC-4, pbreit wrote:

 Are we defaulting generics on for request.is_local?


Not at the framework level, but db.py in the 'welcome' app includes a line 
defaulting to all generics being on for request.is_local (and all off 
otherwise).

Anthony


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Richard Vézina
I think telling the vulnerabilities is not the wiser thing to do...

Telling the reason for a change like vulnerability issue ok... But no
description of the vulnerabilities...

It only helps the hakers to exploit those vulnerabilities.

Richard

On Tue, Aug 30, 2011 at 1:09 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 Cool , also please note about the related vulnerability too , and a
 security announcement section may be? I do not know about the related
 vulnerability until Anthony told me now .

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  Good idea. Will do that.
 
  On Aug 30, 2011, at 7:38 AM, Phyo Arkar wrote:
 
  On the mailing list?
 
  One problem with mailing list is it is not a forum and it can't have a
  Sticky feature. Information of last month is totally lost. Most busy
  people on tight schedule wont have time to dig into pile of posts.
 
  So a good place to put it is on the web2py.com home page , make a
  Notice  section . Also in Download page showing that notice.
 
  I update from 1.96 tho .
 
  On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  We did. Over and over. We announced this starting... 1.95 ;-)
 
  On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:
 
  Ok thats good .
 
  But please announce somewhere that 1.98.2 will break compatbility to
  existing views those are without
  response.generic_patters = ['*']
 
  On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  This is a security measure.
  Just add this to your db.py
 
response.generic_patters = ['*']
 
  Massimo
 
  On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:
 
  heres my call :
 
 
 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000
 
  Resulting in :
  htmlbodyh1invalid view
  (extraction/listMIME.json)/h1/body/html
 
  All other .json calls which are not with json RPC fails horribly ,
  breaking all my applications.
 
  is that a bug or Feature ?
 
  This will be the last time i updating web2py blindly :(
 
 
 
 
 
 



[web2py] Re: request_tenant oddity

2011-08-30 Thread Cliff
It allows me to see all the rows in the table, irrespective of
request_tenant, but it does not show me the signature columns or the
request_tenant column.  It acts this way whether I am logged in as a
user or not.

Using 1.98.2, by the way.

This is not a high priority, though.  I asked the original question to
find out if I have a bug in my code.  Since it appears not, I'm
content to work around the problem.

On Aug 30, 12:07 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I think you can disable this although I have not tried. In your model:

 if request.controller=='appadmin': db._request_tenant=None

 If this does what you want, please let me know.

 On Aug 30, 7:20 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Currently, even appadmin is tenant dependent.

  On Aug 30, 6:03 am, Cliff cjk...@gmail.com wrote:

   Is request_tenant supposed to work this way?

   In my model I have a tenants table, which I define before I add the
   request_tenant field.  In that table I have one tenant.

   In my auth_user table I have one user.  His request_tenant field is
   set to the id of the one tenant in the tenant table.

   Okay so far.

   I log in as that one user and open the appadmin database page.  The
   appadmin will show me records that belong to the tenant.  If I create
   a record with a bogus request_tenant id, I can't see it in the
   appadmin database index pages.

   If I log out and use appadmin I can see all the rows on the index
   pages BUT the signature fields and the request_tenant field are
   invisible.

   Are request_tenant and appadmin supposed to interact this way?  It
   seems like appadmin should be able to see all records in a table,
   regardless of the request_tenant setting.

   Thanks,
   Cliff Kachinske


Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 1:31:56 PM UTC-4, Anthony wrote:


 Yes. In general, you can take one of two approaches (or some combination):

- Be selective about which generic_patterns you enable for which 
specific requests -- only enable the specific generic views you need for 
specific functions.
- Make sure your controller functions return only the variables and 
database records and fields that you are comfortable exposing to the 
 public 
via generic views (i.e., don't return anything to the view that is not 
needed or is needed only conditionally for some authorized users). For 
example, in the view, don't do something like {{if auth.user:}}{{show 
some sensitive data returned by the controller action}} -- a generic 
view will expose the sensitive data because it won't check for auth.user.

 I should add that because it's fairly easy to slip up regarding the second 
approach, it's probably wise to rely more on the first approach (i.e., be 
explicit whenever you are enabling a generic view).

Anthony 


Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 1:10:07 PM UTC-4, Phyo Arkar wrote:

 Wow

 thanks alot for the notice Anthony , thats such a big security hole.

 So , putting response.generic_patterns =  ['json']  inside db.py ,
 will still re-open that vulnerability?

Yes, that would still be vulnerable. 


 Putting it on all views that return Json will be the safest?


Yes. In general, you can take one of two approaches (or some combination):

   - Be selective about which generic_patterns you enable for which specific 
   requests -- only enable the specific generic views you need for specific 
   functions.
   - Make sure your controller functions return only the variables and 
   database records and fields that you are comfortable exposing to the public 
   via generic views (i.e., don't return anything to the view that is not 
   needed or is needed only conditionally for some authorized users). For 
   example, in the view, don't do something like {{if auth.user:}}{{show 
   some sensitive data returned by the controller action}} -- a generic view 
   will expose the sensitive data because it won't check for auth.user.

Anthony



[web2py] Re: SQLFORM not handling hidden fields? Or do I have a bug?

2011-08-30 Thread Cliff
Hmmm.

I'm on 1.98.2.

This needs more investigation, but I can't do it today.

On Aug 30, 8:39 am, DenesL denes1...@yahoo.ca wrote:
 SQLFORM with hidden fields works fine in 1.98.2:

 # model
 db.define_table('dog',
   Field('name'),
   Field('age', 'integer')
   )

 # controller
 def newdog():
   form = SQLFORM(db.dog, fields=['name'], hidden={'age': 1})
   if form.accepts(request, session):
     response.flash = 'ok'
   elif form.errors:
     response.flash = 'not ok'
   return dict(form = form)

 Any new entry in the dog table will have the age field set to 1.


[web2py] Re: Sample code for new scheduler

2011-08-30 Thread Andrew
Thanks very much for your reply.

On Aug 31, 12:18 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 On Aug 30, 3:47 am, Andrew awillima...@gmail.com wrote:

  Hi Massimo,
  I watched your video tutorial on thescheduler.  Very helpful and
  thanks for a great job.  I haven't quite got your example working, but
  I haven't yet spent the time to investigate.

  If I understand correctly, the full functioningschedulerwith task
  dependencies will be coming as some sort of interface to Celery,
  correct ?

 Not quite. There are two schedulers (different and incompatible):
 - gluon.scheduler.py (in the video)
 - web2py-celery
 They can both run the same functions but they use different db models.

  In your example, you built some functions in the Model.  Can you
  please clarify where is the correct place to put such batch style
  scripts - in the model or controller.  One could argue that they don't
  quite fit into either, (neither data or logic for a view) but I'm not
  very experienced with the MVC architecture.   On a similar note, when
  building functions called by other functions, are there any guidelines
  for where they go.  I don't think there were any examples in the book.

 I would put them into modules in a file called, for example, tasks.py.
 I will post more examples.



  Much thanks
  Andrew


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Bruno Rocha
I've already added this information in /book some weeks ago.

In generic views section.

http://zerp.ly/rochacbruno
Em 30/08/2011 10:21, Massimo Di Pierro mdipie...@cs.depaul.edu escreveu:
 Good idea. Will do that.

 On Aug 30, 2011, at 7:38 AM, Phyo Arkar wrote:

 On the mailing list?

 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.

 So a good place to put it is on the web2py.com home page , make a
 Notice section . Also in Download page showing that notice.

 I update from 1.96 tho .

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 We did. Over and over. We announced this starting... 1.95 ;-)

 On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:

 Ok thats good .

 But please announce somewhere that 1.98.2 will break compatbility to
 existing views those are without
 response.generic_patters = ['*']

 On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 This is a security measure.
 Just add this to your db.py

 response.generic_patters = ['*']

 Massimo

 On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:

 heres my call :


http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000

 Resulting in :
 htmlbodyh1invalid view
 (extraction/listMIME.json)/h1/body/html

 All other .json calls which are not with json RPC fails horribly ,
 breaking all my applications.

 is that a bug or Feature ?

 This will be the last time i updating web2py blindly :(







Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Richard Vézina
I think he would have it in the changelog page or something...

Richard

On Tue, Aug 30, 2011 at 2:16 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 I've already added this information in /book some weeks ago.

 In generic views section.

 http://zerp.ly/rochacbruno
 Em 30/08/2011 10:21, Massimo Di Pierro mdipie...@cs.depaul.edu
 escreveu:

  Good idea. Will do that.
 
  On Aug 30, 2011, at 7:38 AM, Phyo Arkar wrote:
 
  On the mailing list?
 
  One problem with mailing list is it is not a forum and it can't have a
  Sticky feature. Information of last month is totally lost. Most busy
  people on tight schedule wont have time to dig into pile of posts.
 
  So a good place to put it is on the web2py.com home page , make a
  Notice section . Also in Download page showing that notice.
 
  I update from 1.96 tho .
 
  On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  We did. Over and over. We announced this starting... 1.95 ;-)
 
  On Aug 30, 2011, at 7:20 AM, Phyo Arkar wrote:
 
  Ok thats good .
 
  But please announce somewhere that 1.98.2 will break compatbility to
  existing views those are without
  response.generic_patters = ['*']
 
  On 8/30/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  This is a security measure.
  Just add this to your db.py
 
  response.generic_patters = ['*']
 
  Massimo
 
  On Aug 30, 2011, at 6:46 AM, Phyo Arkar wrote:
 
  heres my call :
 
 
 http://localhost:8080/sExtract/extraction/listMIME.json?extracted_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/extractedsource_path=/home/v3ss/workspace-bbb/web2py-clone/applications/sExtract/static/ediscov/testFails/source_search=falsend=1314704423498rows=100page=1sidx=idsord=desctotalrows=1000
 
  Resulting in :
  htmlbodyh1invalid view
  (extraction/listMIME.json)/h1/body/html
 
  All other .json calls which are not with json RPC fails horribly ,
  breaking all my applications.
 
  is that a bug or Feature ?
 
  This will be the last time i updating web2py blindly :(
 
 
 
 
 



Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 2:19:02 PM UTC-4, Richard wrote:

 I think he would have it in the changelog page or something...


See changelog for 1.96.1 (also posted on list): 
http://web2py.com/examples/default/changelog#1.95.1. 


[web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 8:38:14 AM UTC-4, Phyo Arkar wrote:

 On the mailing list?

 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.

 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.

 I update from 1.96 tho .

For changes like this, it would certainly be helpful to post a more 
prominent notice somewhere, as you suggest. But in general, when upgrading, 
it's probably a good idea to review the changelogs between your previous 
version and the new version: http://web2py.com/examples/default/changelog. 
In this case, the change was explained in the changelog.

Anthony 


[web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread rami

pbreit above made me realize that when I was creating my first.html
and second.html, I forgot to specify default/first and default/second
and then click the create view, and not just first and second without
the default/. My bad! Thank you, pbreit!

I am happy that I posted this question because some interesting
discussion was generated.
Anthony, thank you for your input and explaining the motivation of
introducing the generics change in newer version of web2py. It makes
sense!
For now I am still letting this response.generic_patterns = ['*']
because I am just trying to follow the tutorial and learn web2py and
then worry more about the security issues.
Anthony, I do have a question though. Looking at your first approach,
how do I even know what generic_patterns or views I need for my
functions. Could you direct me to some documentation to read more
about it? Again, I just started working with web2py so I am not
familiar with all this generics. Your help will further on be
appreciated!




On Aug 30, 10:34 am, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 30, 2011 1:31:56 PM UTC-4, Anthony wrote:

  Yes. In general, you can take one of two approaches (or some combination):

     - Be selective about which generic_patterns you enable for which
     specific requests -- only enable the specific generic views you need for
     specific functions.
     - Make sure your controller functions return only the variables and
     database records and fields that you are comfortable exposing to the 
  public
     via generic views (i.e., don't return anything to the view that is not
     needed or is needed only conditionally for some authorized users). For
     example, in the view, don't do something like {{if auth.user:}}{{show
     some sensitive data returned by the controller action}} -- a generic
     view will expose the sensitive data because it won't check for auth.user.

  I should add that because it's fairly easy to slip up regarding the second

 approach, it's probably wise to rely more on the first approach (i.e., be
 explicit whenever you are enabling a generic view).

 Anthony


[web2py] free computer racks (with computers in them)

2011-08-30 Thread Massimo Di Pierro
I have some friends who are giving away 8 racks of 32 U1 modules in
the Chicago area. They were purchased in 2005 and as far as I know are
fully working.
Each module has:

1U form factor
3.2 GHz hyperthreaded dual Xeons
2GB memory
two 10/100/1000 ethernet ports
two small, 20-80 GBytes, disks.
1.7 A current draw
Mounted 32 per rack with sliders.  Racks are 36 deep.
Power from Cyclades PM10 PDUs

If anybody wants a rack and can arrange for transport, let me know.
They are not giving away pieces, the basic unit is a rack.


[web2py] free computer racks (with computers in them)

2011-08-30 Thread Massimo Di Pierro
I have some friends who are giving away 8 racks of 32 U1 modules in
the Chicago area. They were purchased in 2005 and as far as I know are
fully working.
Each module has:

1U form factor
3.2 GHz hyperthreaded dual Xeons
2GB memory
two 10/100/1000 ethernet ports
two small, 20-80 GBytes, disks.
1.7 A current draw
Mounted 32 per rack with sliders.  Racks are 36 deep.
Power from Cyclades PM10 PDUs

If anybody wants a rack and can arrange for transport, let me know.
They are not giving away pieces, the basic unit is a rack.


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
Well , I did the update because i trust web2py's backward
compatibility . Yeah i will never do blind update again (or use update
button on web2py ).

On 8/31/11, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 30, 2011 8:38:14 AM UTC-4, Phyo Arkar wrote:

 On the mailing list?

 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.

 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.

 I update from 1.96 tho .

 For changes like this, it would certainly be helpful to post a more
 prominent notice somewhere, as you suggest. But in general, when upgrading,
 it's probably a good idea to review the changelogs between your previous
 version and the new version: http://web2py.com/examples/default/changelog.
 In this case, the change was explained in the changelog.

 Anthony



Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
This is Opensource community , hiding vulnerability does not belong here.

Remember what happened when Microsoft was dumb and thought hiding
vulnerabilities under the carpet was good thing?

Code Red , Blaster and many other worms enjoyed!

On 8/31/11, Richard Vézina ml.richard.vez...@gmail.com wrote:
 I think telling the vulnerabilities is not the wiser thing to do...

 Telling the reason for a change like vulnerability issue ok... But no
 description of the vulnerabilities...

 It only helps the hakers to exploit those vulnerabilities.

 Richard



[web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 2:44:44 PM UTC-4, rami wrote:


 Anthony, I do have a question though. Looking at your first approach, 
 how do I even know what generic_patterns or views I need for my 
 functions.


It depends on how you want your functions to be accessed. As long as a given 
function has a specific named view associated with it, then you don't need a 
generic view at all. For example, if you have function 'myfunc' in 
/controllers/default.py, as long as you have a /views/default/myfunc.html 
view, you don't need a generic view for that function. Generic views are 
only used/needed when you don't have a specific view for a function.

There's some explanation near the end of this book 
section: http://web2py.com/book/default/chapter/03#Say-Hello

There is more detailed discussion in the context of services (JSON, 
XML): http://web2py.com/book/default/chapter/09#Generic-Views

Anthony



Re: [web2py] CRUD update in modal iframe

2011-08-30 Thread Jim Steil

Still stuck on this one.  Anyone have any advice?

The problem (as it stands now) is after an update to the record via a 
modal edit form, I can't get the 'next' url to load in the main window.  
It is now displaying in the modal window (iFrame).  Bruno recommended 
executing some JS to set the window.parent.location but I don't know 
where I'd specify this.  Any help would be appreciated.


-Jim

On 8/25/2011 4:59 PM, Jim Steil wrote:
It would appear that I can supply an 'onaccept' argument on a 
crud.create that is a function or list of functions to be executed 
after the record is updated.  Is there a way I could use this to 
change the 'target' on the form submission in the event of a 
successful update?


Again, any help would really be appreciated.  I'm pulling my hair out 
on this one...


-Jim

On 8/25/2011 10:10 AM, Jim Steil wrote:

Ok, found what was causing the problem.

On my page that I'm loading in my modal window I was specifying a 
different view.  This view had:


base target=_top

...in the head section.  This caused all submits/re-displays to go 
to the parent to display.  If I take it out it works as expected.  
However, now (as Bruno mentioned) when I submit my form the next url 
is loaded in the modal as well.  I'm using CRUD in my modal window, 
how/where do I specify the window.parent.location='next url' as Bruno 
mentioned?


Thanks again.

-Jim

On 8/25/2011 8:18 AM, Jim Steil wrote:

Anthony and Bruno

Thank you for your replies.  I tried nyroModal but get the same 
results as with FancyBox (which I've been using).  I am going to 
work up a simple app that shows my problem.  Either that will show 
me where my problem lies or provide something simple for you to see 
the behavior I'm dealing with.


Thanks again for the input.

-Jim

On 8/24/2011 6:13 PM, Bruno Rocha wrote:


Your modal uses Iframe?

nyroModal needs target='_blank' to open in iframe and work as you want.

Other modal plugins has other ways for doing it.

For redirect in parent window. You ll need to execute a javascript 
inside modal.


window.parent.location = ''

http://zerp.ly/rochacbruno

Em 24/08/2011 17:55, Jim Steil j...@qlf.com mailto:j...@qlf.com 
escreveu:

 Hi

 I have a crud.update that I'm displaying in a modal iFrame. This is
 working fine for me except when there is an error in the form and 
crud
 redisplays with the error message. This is opening outside the 
iFrame
 when I want it to load inside the iFrame. But, on submit, the 
next url

 should load outside the iFrame.

 Make any sense? Any advice on where to look to get this working 
the way

 I want?

 -Jim




Re: [web2py] CRUD update in modal iframe

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 4:00:17 PM UTC-4, Jim S wrote:

  Still stuck on this one.  Anyone have any advice?

 The problem (as it stands now) is after an update to the record via a modal 
 edit form, I can't get the 'next' url to load in the main window.  It is now 
 displaying in the modal window (iFrame).  Bruno recommended executing some 
 JS to set the window.parent.location but I don't know where I'd specify 
 this.  Any help would be appreciated.


Maybe have the 'next' URL return a blank page that immediately executes the 
JS in the head.

Anthony


Re: [web2py] CRUD update in modal iframe

2011-08-30 Thread Bruno Rocha
What modal lib are you using?

It support js callbacks?

In nyro I can specify some JS to be included inside model frame.

You can have a view to be used only with crud and input the javascript
there.

http://zerp.ly/rochacbruno
Em 30/08/2011 17:01, Jim Steil j...@qlf.com escreveu:
 Still stuck on this one. Anyone have any advice?

 The problem (as it stands now) is after an update to the record via a
 modal edit form, I can't get the 'next' url to load in the main window.
 It is now displaying in the modal window (iFrame). Bruno recommended
 executing some JS to set the window.parent.location but I don't know
 where I'd specify this. Any help would be appreciated.

 -Jim

 On 8/25/2011 4:59 PM, Jim Steil wrote:
 It would appear that I can supply an 'onaccept' argument on a
 crud.create that is a function or list of functions to be executed
 after the record is updated. Is there a way I could use this to
 change the 'target' on the form submission in the event of a
 successful update?

 Again, any help would really be appreciated. I'm pulling my hair out
 on this one...

 -Jim

 On 8/25/2011 10:10 AM, Jim Steil wrote:
 Ok, found what was causing the problem.

 On my page that I'm loading in my modal window I was specifying a
 different view. This view had:

 base target=_top

 ...in the head section. This caused all submits/re-displays to go
 to the parent to display. If I take it out it works as expected.
 However, now (as Bruno mentioned) when I submit my form the next url
 is loaded in the modal as well. I'm using CRUD in my modal window,
 how/where do I specify the window.parent.location='next url' as Bruno
 mentioned?

 Thanks again.

 -Jim

 On 8/25/2011 8:18 AM, Jim Steil wrote:
 Anthony and Bruno

 Thank you for your replies. I tried nyroModal but get the same
 results as with FancyBox (which I've been using). I am going to
 work up a simple app that shows my problem. Either that will show
 me where my problem lies or provide something simple for you to see
 the behavior I'm dealing with.

 Thanks again for the input.

 -Jim

 On 8/24/2011 6:13 PM, Bruno Rocha wrote:

 Your modal uses Iframe?

 nyroModal needs target='_blank' to open in iframe and work as you
want.

 Other modal plugins has other ways for doing it.

 For redirect in parent window. You ll need to execute a javascript
 inside modal.

 window.parent.location = ''

 http://zerp.ly/rochacbruno

 Em 24/08/2011 17:55, Jim Steil j...@qlf.com mailto:j...@qlf.com
 escreveu:
  Hi
 
  I have a crud.update that I'm displaying in a modal iFrame. This is
  working fine for me except when there is an error in the form and
 crud
  redisplays with the error message. This is opening outside the
 iFrame
  when I want it to load inside the iFrame. But, on submit, the
 next url
  should load outside the iFrame.
 
  Make any sense? Any advice on where to look to get this working
 the way
  I want?
 
  -Jim
 
 


Re: [web2py] CRUD update in modal iframe

2011-08-30 Thread Bruno Rocha
if using IFRAME:

$('.yourselector iframe').load( function(){ $('body',
$('iframe').contents()).prepend('scriptJS HERE /script '); });


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Massimo Di Pierro
the rule is that we promise backward compatibility except when we need fix a 
security vulnerability. until we setup a page dedicated to this, make sure you 
read the changelog ( not just of the current release but all the releases in 
between the one you upgrade from to the one you upgrade to). Usually backward 
incompatible issues (if known) are prominently highlighted.

On Aug 30, 2011, at 2:40 PM, Phyo Arkar wrote:

 Well , I did the update because i trust web2py's backward
 compatibility . Yeah i will never do blind update again (or use update
 button on web2py ).
 
 On 8/31/11, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 30, 2011 8:38:14 AM UTC-4, Phyo Arkar wrote:
 
 On the mailing list?
 
 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.
 
 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.
 
 I update from 1.96 tho .
 
 For changes like this, it would certainly be helpful to post a more
 prominent notice somewhere, as you suggest. But in general, when upgrading,
 it's probably a good idea to review the changelogs between your previous
 version and the new version: http://web2py.com/examples/default/changelog.
 In this case, the change was explained in the changelog.
 
 Anthony
 



Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Phyo Arkar
Yeah, don't worry I know , web2py is most backward compatible
framework in the know. Just need some prominent annoucement section on
the web pages , and it will even more popular. *Regular website
update*

For announcement , only Prominent Changes such as :
- Major changes/improvement
- Security Alerts
- Backward Incompatible changes

I know alot of users of web2py in my country , most of the I
introduced to. even my closest friends who use web2py , dont bother to
join web2py mailing list. They will be much less likely to read
mailing list ferequently.

I believe whoever post once in this mailing list is less than 20% of
actual users out there.

Those people will just Read the web site , and use web2py's Update
button in admin view.

On 8/31/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
 the rule is that we promise backward compatibility except when we need fix a
 security vulnerability. until we setup a page dedicated to this, make sure
 you read the changelog ( not just of the current release but all the
 releases in between the one you upgrade from to the one you upgrade to).
 Usually backward incompatible issues (if known) are prominently highlighted.

 On Aug 30, 2011, at 2:40 PM, Phyo Arkar wrote:

 Well , I did the update because i trust web2py's backward
 compatibility . Yeah i will never do blind update again (or use update
 button on web2py ).

 On 8/31/11, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 30, 2011 8:38:14 AM UTC-4, Phyo Arkar wrote:

 On the mailing list?

 One problem with mailing list is it is not a forum and it can't have a
 Sticky feature. Information of last month is totally lost. Most busy
 people on tight schedule wont have time to dig into pile of posts.

 So a good place to put it is on the web2py.com home page , make a
 Notice  section . Also in Download page showing that notice.

 I update from 1.96 tho .

 For changes like this, it would certainly be helpful to post a more
 prominent notice somewhere, as you suggest. But in general, when
 upgrading,
 it's probably a good idea to review the changelogs between your previous
 version and the new version:
 http://web2py.com/examples/default/changelog.
 In this case, the change was explained in the changelog.

 Anthony





[web2py] Re: free computer racks (with computers in them)

2011-08-30 Thread Ismael Serratos
How can I get one (or more?)?? I'm from Mexico.

On Aug 30, 2:22 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I have some friends who are giving away 8 racks of 32 U1 modules in
 the Chicago area. They were purchased in 2005 and as far as I know are
 fully working.
 Each module has:

 1U form factor
 3.2 GHz hyperthreaded dual Xeons
 2GB memory
 two 10/100/1000 ethernet ports
 two small, 20-80 GBytes, disks.
 1.7 A current draw
 Mounted 32 per rack with sliders.  Racks are 36 deep.
 Power from Cyclades PM10 PDUs

 If anybody wants a rack and can arrange for transport, let me know.
 They are not giving away pieces, the basic unit is a rack.


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Bruno Rocha
Maybe I am a little addicted, but. I check this stream daily (I have it rss
on my Google Reader)  http://code.google.com/p/web2py/source/list


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Richard Vézina
I never use the update button of the Admin interface, so I don't know if the
information about the changelog are exposed before the update proceed, but I
think that it could be interresting to tell what's new for user that are
tempting to update their web2py installation like this. Calculating and
concatenating the changelogs from the user version of web2py until the new
given version that the user is about to install is not really difficult.

Maybe it could be a nice new feature...

Richard

On Tue, Aug 30, 2011 at 4:44 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 Yeah, don't worry I know , web2py is most backward compatible
 framework in the know. Just need some prominent annoucement section on
 the web pages , and it will even more popular. *Regular website
 update*

 For announcement , only Prominent Changes such as :
 - Major changes/improvement
 - Security Alerts
 - Backward Incompatible changes

 I know alot of users of web2py in my country , most of the I
 introduced to. even my closest friends who use web2py , dont bother to
 join web2py mailing list. They will be much less likely to read
 mailing list ferequently.

 I believe whoever post once in this mailing list is less than 20% of
 actual users out there.

 Those people will just Read the web site , and use web2py's Update
 button in admin view.

 On 8/31/11, Massimo Di Pierro mdipie...@cs.depaul.edu wrote:
  the rule is that we promise backward compatibility except when we need
 fix a
  security vulnerability. until we setup a page dedicated to this, make
 sure
  you read the changelog ( not just of the current release but all the
  releases in between the one you upgrade from to the one you upgrade to).
  Usually backward incompatible issues (if known) are prominently
 highlighted.
 
  On Aug 30, 2011, at 2:40 PM, Phyo Arkar wrote:
 
  Well , I did the update because i trust web2py's backward
  compatibility . Yeah i will never do blind update again (or use update
  button on web2py ).
 
  On 8/31/11, Anthony abasta...@gmail.com wrote:
  On Tuesday, August 30, 2011 8:38:14 AM UTC-4, Phyo Arkar wrote:
 
  On the mailing list?
 
  One problem with mailing list is it is not a forum and it can't have a
  Sticky feature. Information of last month is totally lost. Most busy
  people on tight schedule wont have time to dig into pile of posts.
 
  So a good place to put it is on the web2py.com home page , make a
  Notice  section . Also in Download page showing that notice.
 
  I update from 1.96 tho .
 
  For changes like this, it would certainly be helpful to post a more
  prominent notice somewhere, as you suggest. But in general, when
  upgrading,
  it's probably a good idea to review the changelogs between your
 previous
  version and the new version:
  http://web2py.com/examples/default/changelog.
  In this case, the change was explained in the changelog.
 
  Anthony
 
 
 



Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread Richard Vézina
+1 addict too ;-)

On Tue, Aug 30, 2011 at 5:00 PM, Bruno Rocha rochacbr...@gmail.com wrote:

 Maybe I am a little addicted, but. I check this stream daily (I have it rss
 on my Google Reader)  http://code.google.com/p/web2py/source/list





[web2py] Bug or future ?

2011-08-30 Thread brushek
Hello,

I have tested format argument in define_table:

db.define_table('person', Field('name'), format='%(name)s')

db.define_table('dog',Field('name'),Field('image','upload'),Field('owner',db.person))
db.dog.owner.requires=IS_IN_DB(db, 'person.id')

If I comment out last line, the form=SQLFORM(db.dog, record=None,
deletable=False) will show name in select box (where owner will show),
but without comment there is only id (number).

Is it ok ?

regards
brushek


[web2py] Re: Howto change request.uri_language through URL function?

2011-08-30 Thread Alexander Cabezas
Something like this:

http://www.amnesty.org/fr/how-you-can-help

On 29 ago, 23:40, Christopher Steel chris.st...@gmail.com wrote:
 So something like this:

    http://www.amnesty.org/fr/how-you-can-help

 and not this:

    http://voiceofaccess.org/init/default/index?_language=fr-ca

 ?


Re: [web2py] CRUD update in modal iframe

2011-08-30 Thread Jim Steil

I am using FancyBox to display my modal dialog.  www.fancybox.net.

I believe it does support callbacks.  I just don't know how to register 
it so that it is executed after the form has been accepted and the db 
updated.


-Jim

On 8/30/2011 3:14 PM, Bruno Rocha wrote:


What modal lib are you using?

It support js callbacks?

In nyro I can specify some JS to be included inside model frame.

You can have a view to be used only with crud and input the javascript 
there.


http://zerp.ly/rochacbruno

Em 30/08/2011 17:01, Jim Steil j...@qlf.com mailto:j...@qlf.com 
escreveu:

 Still stuck on this one. Anyone have any advice?

 The problem (as it stands now) is after an update to the record via a
 modal edit form, I can't get the 'next' url to load in the main window.
 It is now displaying in the modal window (iFrame). Bruno recommended
 executing some JS to set the window.parent.location but I don't know
 where I'd specify this. Any help would be appreciated.

 -Jim

 On 8/25/2011 4:59 PM, Jim Steil wrote:
 It would appear that I can supply an 'onaccept' argument on a
 crud.create that is a function or list of functions to be executed
 after the record is updated. Is there a way I could use this to
 change the 'target' on the form submission in the event of a
 successful update?

 Again, any help would really be appreciated. I'm pulling my hair out
 on this one...

 -Jim

 On 8/25/2011 10:10 AM, Jim Steil wrote:
 Ok, found what was causing the problem.

 On my page that I'm loading in my modal window I was specifying a
 different view. This view had:

 base target=_top

 ...in the head section. This caused all submits/re-displays to go
 to the parent to display. If I take it out it works as expected.
 However, now (as Bruno mentioned) when I submit my form the next url
 is loaded in the modal as well. I'm using CRUD in my modal window,
 how/where do I specify the window.parent.location='next url' as Bruno
 mentioned?

 Thanks again.

 -Jim

 On 8/25/2011 8:18 AM, Jim Steil wrote:
 Anthony and Bruno

 Thank you for your replies. I tried nyroModal but get the same
 results as with FancyBox (which I've been using). I am going to
 work up a simple app that shows my problem. Either that will show
 me where my problem lies or provide something simple for you to see
 the behavior I'm dealing with.

 Thanks again for the input.

 -Jim

 On 8/24/2011 6:13 PM, Bruno Rocha wrote:

 Your modal uses Iframe?

 nyroModal needs target='_blank' to open in iframe and work as 
you want.


 Other modal plugins has other ways for doing it.

 For redirect in parent window. You ll need to execute a javascript
 inside modal.

 window.parent.location = ''

 http://zerp.ly/rochacbruno

 Em 24/08/2011 17:55, Jim Steil j...@qlf.com 
mailto:j...@qlf.com mailto:j...@qlf.com mailto:j...@qlf.com

 escreveu:
  Hi
 
  I have a crud.update that I'm displaying in a modal iFrame. 
This is

  working fine for me except when there is an error in the form and
 crud
  redisplays with the error message. This is opening outside the
 iFrame
  when I want it to load inside the iFrame. But, on submit, the
 next url
  should load outside the iFrame.
 
  Make any sense? Any advice on where to look to get this working
 the way
  I want?
 
  -Jim
 
 


[web2py] Storing logged on user in database

2011-08-30 Thread Chris Rowson
Hi all,

This is my first foray into web app design and so I wondered if it
would be possible to get a bit of a sanity check on what I'm doing to
ensure I'm understanding web2py correctly.

My database has a table which should store data collected by SQLFORM
along with the ID of the logged on user who entered the data.

The relevant bits of my model look like this:


db.define_table('data',
   Field('dataowner', db.auth_user, default=auth.user.id,
writable=False, readable=False), #this points at the auth user
   Field('provider', db.providers), #points to another table
   Field('speed', 'integer'),
   Field('timestamp', default=request.now, writable=False,
readable=False))
db.data.dataowner.requires=IS_IN_DB(db,
'auth_user.id','auth_user.email') #and here shows which field to
return for a record
db.data.provider.requires=IS_IN_DB(db, 'providers.id','providers.name')
db.data.speed.requires=IS_NOT_EMPTY()
-

And the controller like this:

-
@auth.requires_login()
def adddata():
form=SQLFORM(db.data, fields=['provider', 'speed'])
if form.accepts(request.vars, session):
   #response.flash puts the flash in this page, session.flash in
the next page of the session
   session.flash = 'form accepted'
   redirect(URL(r=request, f='index'))
elif form.errors:
   response.flash = 'form has errors'
return dict(form=form)

--
My intention is to collect the provider and speed data with SQLFORM
and for the logged on user id and the timestamp to be automatically
populated. As you can see, I have used a decorator on the adddata
function to require a logged on user.

Does this look right to you?

Thanks in advance!

Chris


Re: [web2py] Bug or future ?

2011-08-30 Thread Bruno Rocha
as far as I know, this line db.dog.owner.requires=IS_IN_DB(db, 'person.id')
is responsible for the dropdown widget.

It is a validator, but using it implies the use of widget.

if you do not use the IS_IN_DB(..) you will have no widget, then will be
only a text box field to input the id.



On Tue, Aug 30, 2011 at 6:47 PM, brushek luk...@chrustek.net wrote:

 Hello,

 I have tested format argument in define_table:

 db.define_table('person', Field('name'), format='%(name)s')


 db.define_table('dog',Field('name'),Field('image','upload'),Field('owner',db.person))
 db.dog.owner.requires=IS_IN_DB(db, 'person.id')

 If I comment out last line, the form=SQLFORM(db.dog, record=None,
 deletable=False) will show name in select box (where owner will show),
 but without comment there is only id (number).

 Is it ok ?

 regards
 brushek




-- 



--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]
[ Aprenda a programar: http://CursoDePython.com.br ]
[ O seu aliado nos cuidados com os animais: http://AnimalSystem.com.br ]
[ Consultoria em desenvolvimento web: http://www.blouweb.com ]


Re: [web2py] Re: Web2py 1.98.2 broke compatbility with all .json calls

2011-08-30 Thread pbreit
I think this is getting blown out of proportion. This is the only breaking 
change I can remember in the past year or more. The security implications 
were real. Generics are not widely used in production (at least they 
shouldn't be; and when they are, it's usually to a forgiving audience). 
There was a lot of discussion on the forums. Information was included in the 
changelog. Etc. Etc.

[web2py] Re: Storing logged on user in database

2011-08-30 Thread pbreit
Looks OK at a high level. Is it working for you?

Re: [web2py] Re: Say My Name Example not working, version 1.98.2

2011-08-30 Thread pbreit
If you only use generics during development (good practice), put this in 
db.py or another model file:

response.generic_patterns = ['*'] if request.is_local else []


[web2py] Re: free computer racks (with computers in them)

2011-08-30 Thread Christopher Steel
When would I need to pick them up by?

Thanks,


Christopher Steel
Voice of Access


[web2py] Re: Bug or future ?

2011-08-30 Thread brushek


On 31 Sie, 00:03, Bruno Rocha rochacbr...@gmail.com wrote:
 as far as I know, this line db.dog.owner.requires=IS_IN_DB(db, 'person.id')
 is responsible for the dropdown widget.

 It is a validator, but using it implies the use of widget.

 if you do not use the IS_IN_DB(..) you will have no widget, then will be
 only a text box field to input the id.


Hm... So You suggests, that if I remove the line
db.dog.owner.requires=IS_IN_DB(db, 'person.id') I should get
in form generated by SQLFORM text box ? If so, then something is
wrong, because I get the select box with numbers (id's from person
table).

Regards
brushek


[web2py] Re: free computer racks (with computers in them)

2011-08-30 Thread Massimo Di Pierro
Looks like the information I posted was incorrect and I was not
allowed to post it. I apologize. Please do not continue this thread.


Re: [web2py] Re: Storing logged on user in database

2011-08-30 Thread Chris Rowson
 Looks OK at a high level. Is it working for you?

I thought it was until I logged in and out a couple of times and then
started getting an error:

AttributeError:'NoneType' object has no attribute 'id

Noticed a discussion here:
http://comments.gmane.org/gmane.comp.python.web2py/44801

Seems to indicate that the problem is caused because the session no
longer exists and therefore auth_user.id is none.

:-S

Chris


Re: [web2py] Re: Storing logged on user in database

2011-08-30 Thread pbreit
You could perhaps try default=auth.user_id instead. I'm not totally sure if 
that behaves differently.

I don't usually use is_in_db() so can't say for sure how that might be 
affecting it.

Can you provide more of the error details?


Re: [web2py] Re: Storing logged on user in database

2011-08-30 Thread Chris Rowson
 You could perhaps try default=auth.user_id instead. I'm not totally sure if
 that behaves differently.
 I don't usually use is_in_db() so can't say for sure how that might be
 affecting it.
 Can you provide more of the error details?

I think I *might* have fixed it about the same time as you answered!

I changed the model:

Field('dataowner', db.auth_user, default=auth.user.id if auth.user
else None, writable=False, readable=False),

In my minuscule understanding of this, I think it then allows the
model to accept 'None' as valid (although in reality 'None' should
never be recorded in the database because the decorator on the data
entry function requires the user to be logged in).

Seems to work for me as far as I've tested. What do you think?

Chris


Re: [web2py] Re: Storing logged on user in database

2011-08-30 Thread pbreit
Good to hear.

It's possible using auth.user_id might also fix it like that.

This is what it says in the book:

auth.user contains a copy of the db.auth_user records for the current logged 
in user or None otherwise. There is also also a auth.user_id which is the 
same as auth.user.id (i.e. the id of the current logger in user) or None.


[web2py] possible to extend controllers?

2011-08-30 Thread monotasker
Hi all,

I'm fairly new to python as well as to web2py, so this may be a silly
question. But is there any way to make one controller extend another,
like view inheritance?

More broadly, I'm finding that it's hard to take advantage of python's
OO structure in controllers. I keep writing nested if else
statements to handle different kinds of input, instead of being able
to invoke different objects to handle it. I feel like I'm back to old-
style javascript functions for controllers.

Thanks for your help,

Ian


[web2py] Re: Bug or future ?

2011-08-30 Thread Anthony
On Tuesday, August 30, 2011 6:42:20 PM UTC-4, brushek wrote:



 On 31 Sie, 00:03, Bruno Rocha rocha...@gmail.com wrote: 
  as far as I know, this line db.dog.owner.requires=IS_IN_DB(db, '
 person.id') 
  is responsible for the dropdown widget. 
  
  It is a validator, but using it implies the use of widget. 
  
  if you do not use the IS_IN_DB(..) you will have no widget, then will be 
  only a text box field to input the id. 
  

 Hm... So You suggests, that if I remove the line 
 db.dog.owner.requires=IS_IN_DB(db, 'person.id') I should get 
 in form generated by SQLFORM text box ? If so, then something is 
 wrong, because I get the select box with numbers (id's from person 
 table). 


Because db.dog.owner is a reference field, it automatically gets the 
following validator by default:

db.dog.owner.requires=IS_IN_DB(db, 'person.id', db.person._format)

So, by default, it uses db.person._format (which in this case is 
'%(name)s'), which displays the names instead of the ids. However, you have 
overridden the default validator with your own IS_IN_DB, but you did not 
specify a format. If you don't specify a format in IS_IN_DB, it defaults to 
'%(id)s', which is why you see ids instead of names.

Anthony


[web2py] Re: Published my collection of plugins

2011-08-30 Thread kenji4569
 I still see the same
 problem with 'Format', 'Font size' and 'Font' dropdown selections.
Sorry, I addressed the issue, and I think it would be fixed.
The cause for this is null entry for the text area.

Kenji


On 8月31日, 午前12:14, tomt tom_tren...@yahoo.com wrote:
 Hi,

 I tried your update, and I can now successfully modify text color and
 background color with IE7 and IE8. Unfortunately I still see the same
 problem with 'Format', 'Font size' and 'Font' dropdown selections.
 That is,
 the dropdown selection is erased before I can select an option.

 - Tom

 On Aug 30, 4:05 am, kenji4569 hos...@s-cubism.jp wrote:







  Hi, Tom.

  Thank you for reporting the bug.
  I just fixed it.
  Please check:http://dev.s-cubism.com/plugin_elrte_widget
  (you might need to clear the browser cache)

  [modification detail]
  I upgraded theelrteversion from 1.2 to 1.3.
  Additionally, since the version 1.3 had a serious IE problem, I
  applied some patches for it.
  I also slightly modified the plugin css not to conflict with the site
  css.
  (https://github.com/kenji4569/sqlabs/issues/39)

  Kenji

  On 8月30日, 午前11:38, tomt tom_tren...@yahoo.com wrote:

   Hi,

   Thanks for the great contributions to web2py.  I'm looking forward to
   trying them.

   I implemented web2py.plugin.elrte_widget.w2p and while it worked great
   with firefox, I had some problems using internet explorer.
   Specifically, the dropdown boxes, such as the colorpicker, disappear
   before I can make a selection.

   This happened with IE7 and IE8.  I used the same IE browser to go to
   thehttp://elrte.org/demoandtheproblem didn't exist there. Does
   anyone else see this problem?

   - Tom- Hide quoted text -

  - Show quoted text -


[web2py] Re: possible to extend controllers?

2011-08-30 Thread Massimo Di Pierro
Within one controller, one function can call another.

If you have two controllers in different apps they should not depend
on each other because the two apps  can be distributed separately.

It remains the case of two controllers in the same app. If they depend
one on the other they should be the same controller.

Perhaps I am missing something Can you make an example of use case?

On Aug 30, 6:51 pm, monotasker scotti...@gmail.com wrote:
 Hi all,

 I'm fairly new to python as well as to web2py, so this may be a silly
 question. But is there any way to make one controller extend another,
 like view inheritance?

 More broadly, I'm finding that it's hard to take advantage of python's
 OO structure in controllers. I keep writing nested if else
 statements to handle different kinds of input, instead of being able
 to invoke different objects to handle it. I feel like I'm back to old-
 style javascript functions for controllers.

 Thanks for your help,

 Ian


Re: [web2py] Re: possible to extend controllers?

2011-08-30 Thread Bruno Rocha
I think it is not a good thing to code business login in controllers, in my
projects I realized that logic goes to classes in some module under
/modules. or maybe in some /model when it is globally used.

For me controllers is an extension of the routers system, they live to
'control' the application flow: what parameters received, what class to
instantiate, what function to call, where to redirect, what dict, format,
response.headers to return.

I always see people asking about class based controllers (maybe because
Django has class based views), extending controllers can be a good idea to
implement, if possible. but I still prefer to keep my code outside in
/modules and use controllers as the routes bandmaster


Re: [web2py] Re: possible to extend controllers?

2011-08-30 Thread Bruno Rocha
replace('business login','business LOGIC')


[web2py] Re: possible to extend controllers?

2011-08-30 Thread monotasker
Here's part of a controller I've written to evaluate answers in a
language quizzing app (Forgive the poor coding--I'm a religious
studies professor and am just self-taught at all of this). In the
snippet below I'm checking evaluating the answer and updating the
table that holds students' records. Since I want a high level of
granularity in my tracking of student performance I'm tracking several
pieces of data on each student, for each individual question. The
problem is that different db fields need to be updated depending on a
student's answer. E.g., if the student has answered correctly, I need
to update db.question_records.last_right but not
db.question_records.last_wrong. If the student submits a wrong answer
I need to update .times_wrong but not .times_write. I also need to
create a new row in the question_records table for the student/
question combination if this is the student's first attempt. But if
not, I need to update an existing row. (This is why I'm not just
issuing different update() instructions for correct, partially
correct, and incorrect answers. In that case I would need an if/else
and two different update instructions for each kind of answer--either
to update or to create the necessary table row)

It's all working, but doesn't feel very DRY or efficient. I'm moving
through an if/elif tree, creating needless variables with default
values for the fields that don't need updating, making unnecessary db
calls along the way. What I'd like to be able to do is define a sub-
function (or external function) to provide the common architecture for
handling a student response, and then create related functions that
inherit its architecture and just change a few specifics (e.g., are we
updating the last_right field or last_wrong field?) What I've been
thinking about is creating an external py file with a prototype python
class and a few sub-classes, then just creating instances of these
classes in my controller. But I keep thinking that there must be some
way to do it within web2py's own architecture.

Here's the snippet from my controller:

#Evaluate answer, update records, and redirect to 'respond' page
if a response is being submitted
if request.vars.user_response:
#include this question in the number of questions attempted in
this session
if session.q_counter:
session.q_counter += 1
else:
session.q_counter = 1
#get the question that was asked
q_ID = session.qID
the_q = db(db.question_records.question==q_ID).select()
#see whether answer matches any of the three answer
fields
if
re.match(session.answer,request.vars.user_response):
session.response = 'correct'
rightCount = 1
wrongCount = 0
if the_q:
wrongDate = the_q[0].last_wrong
else:
wrongDate = request.now
rightDate = request.now
session.score = 1
elif re.match(session.answer2,request.vars.user_response) and
session.answer2 != 'null':
session.response = 'partial'
rightCount = 0
wrongCount = 0
if the_q:
wrongDate = the_q[0].last_wrong
rightDate = the_q[0].last_right
else:
wrongDate = request.now
rightDate = request.now
session.score = 0.5
elif re.match(session.answer3,request.vars.user_response) and
session.answer2 != 'null':
session.response = 'partial'
rightCount = 0
wrongCount = 0
if the_q:
wrongDate = the_q[0].last_wrong
rightDate = the_q[0].last_right
else:
wrongDate = request.now
rightDate = request.now
session.score = 0.3
else:
session.response = wrong
wrongCount = 1
rightCount = 0
if the_q:
rightDate = the_q[0].last_right
else:
rightDate = request.now
wrongDate = request.now
session.score = 0
#If the user has already attempted this question once, update
their record for this question
if
db((db.question_records.name==auth.user_id)(db.question_records.question==q_ID)).select():
timesR = the_q[0].times_right
timesW = the_q[0].times_wrong
newTimesR = int(timesR) + int(rightCount)
newTimesW = int(timesW) + int(wrongCount)
 
db(db.question_records.question==q_ID).update(times_right=newTimesR,
times_wrong=newTimesW, last_right=rightDate, last_wrong=wrongDate)
#if the user hasn't attempted this question, create a new
record for it
else:
db.question_records.insert(question=q_ID,
times_right=rightCount, times_wrong=wrongCount)
#display the answer page
redirect(URL('respond'))

On Aug 30, 10:27 pm, Massimo Di Pierro 

[web2py] Re: possible to extend controllers?

2011-08-30 Thread monotasker
OK. This is the solution I was moving toward (classes in an external
module) but I was wondering if I was missing some web2py way of doing
it. Thanks.

On Aug 30, 11:26 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 I think it is not a good thing to code business login in controllers, in my
 projects I realized that logic goes to classes in some module under
 /modules. or maybe in some /model when it is globally used.

 For me controllers is an extension of the routers system, they live to
 'control' the application flow: what parameters received, what class to
 instantiate, what function to call, where to redirect, what dict, format,
 response.headers to return.

 I always see people asking about class based controllers (maybe because
 Django has class based views), extending controllers can be a good idea to
 implement, if possible. but I still prefer to keep my code outside in
 /modules and use controllers as the routes bandmaster


Re: [web2py] Re: possible to extend controllers?

2011-08-30 Thread Bruno Rocha
While developing include this in any of your models (i. e in /models/0.py)

from gluon.custom_import import track_changes; track_changes(True)

This for your changes in modules get reflected without the need to restart
web2py server.

(does not works very well under MS windows)


  1   2   >