[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread zeng
Hi Massimo,

Further tracing lead to some additional information:

 AppA/models/db.py 
from gluon.shell import exec_environment
common_db = exec_environment('applications/appauth/models/db.py',
request=request, response=response)
db = common_db.db # -- yes, point to the db file in AppAuth
session.connect(request, response, db, masterapp='appauth')
auth = Auth(globals(), db)
auth.define_tables(migrate=False, username=True)
auth.settings.login_url = '/appauth/default/user/login'
---

What's interesting is the exec_enviroment(), which i use to load the
db value from AppAuth in AppA, if exec_environment() is called it will
reset the session to empty, if I do not use exec_enviroment() cross
app login will work in both 1.95.1 and 1.96.1, if I do, it will only
work in 1.95.1

Ok, and the next question I may sound like a retard, where to submit
the ticket?


best,
Zeng


On Aug 1, 11:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 Please open a ticket about this.

 On Jul 22, 2:25 am, Heng Zeng Aun zeng...@gmail.com wrote:







  Good day Massimo,

  the following are the snippets:

   AppAuth/models/db.py 
  db = DAL('sqlite://storage.sqlite')
  session.connect(request, response, db)
  auth = Auth(globals(), db)
  crud = Crud(globals(), db)
  auth.settings.hmac_key = 'sha512:secret key here'
  auth.define_tables(username=True)
  crud.settings.auth = auth

   AppA/models/db.py 
  db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to the db
  file in AppAuth
  session.connect(request, response, db, masterapp='appauth')
  auth = Auth(globals(), db)
  auth.define_tables(migrate=False, username=True)
  auth.settings.login_url = '/appauth/default/user/login'

   AppA/controllers/default.py 
  @auth.requires_login()
  def index():
      response.view='index.html'
      return dict()

  @auth.requires_permission('sayhello')
  def hello():
      response.view='saysomething.html'
      return dict(message=T(hello))

  The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to login
  and view the page provided in AppAuth, but when browse to AppA or AppB, it
  will not be able to access it because auth says its not loggin. However all
  this works in 1.95.1

  If i go into web2py.gluon.tools.Auth and hack current to current =
  Storage(globals()) like it used to be in 1.95.1, and things works again.

  I'm sure forcing current from threading.local() to something else
  definitely is not the correct way of doing this (as i dont know what is the
  intention of the current is using for as well : ).

  Awaits your input, Many Thanks Massimo.

  best,
  Zeng

  On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 

  massimo.dipie...@gmail.com wrote:
   This change should not break it. Can you please show us the code that
   breaks and we will check what is going on? It is possible that one of
   the auth modules has not been patched correctly.

   Massimo

   On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
Hey guys,

I'm currently running version 1.95.1 and have 3 application,
AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
authenticate logged in user and it has been working great.

After upgrading 1.96.1 and cross app authentication no longer works,
some debuging lead to:
- web2py.gluon.tools.Auth 
self.environment = current
request = current.request
session = current.session
- web2py.gluon.tools.Auth 

and current is a threading.local() in gluon.globals.py !!!

In the good'o 1.95.1 the session and auth object is retrieved from
global() ,

Question is, why is this changed? this seems to break the backward
compatibility feature of web2py, and what are the recommended
solutions now that global() is no longer used?

Thanks!


Re: [web2py] Re: Requesting Feedback for Web2py Instant Admin

2011-08-02 Thread Ramana
Dear all,

I am overwhelmed by your positive response and kind words. Thank you very
much.

I just want to clarify that the HTML theme is not my own. I copied it
from Rails
Admin https://github.com/sferik/rails_admin, which in turn is based on Activo
Theme https://github.com/dmfrancisco/activo, both are MIT licensed.

Regarding including this plugin in welcome app, I feel that it is still too
early. There are no test cases. Widgets for Date Time fields, multi-select
fields and many-to-many associations are still not there. But I am working
on them. I released the plugin even before it is perfect/stable because I
wanted some feedback from you. Now I can work more confidently and
enthusiastically, thanks to your feedback.

Thanks  Regards,
Ramana.

On Mon, Aug 1, 2011 at 2:21 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 A proposal

 1) we change

 auth.requires_permission() with auth.requires(is_admin or
 has_permission(...))

 2) we move  everything that is not under */plugin_instant_admin under
 plugins/plugin_instant_admin

 3) we rename instant_admin into iadmin

 4) we include it into welcome app

 5) we expose iadmin and old appadmin, default to iadmin, allow
 administrator to switch back to old appadmin (using session to keep
 state)?

 I would take a patch in this direction but I would like to hear more
 opinions.
 It would be great if the the edit for and the pagination table where
 to expose as components to be embedded in regular pages.

 Massimo

 On Aug 1, 1:09 am, Ramana srama...@gmail.com wrote:
  Dear Web2py users,
 
  I just launched the beta version of Web2py Instant
  Adminhttp://sramana.in/web2py-instant-admin,
  a (supposedly) django-like admin interface for Web2py applications.
  The demohttp://w2padmin.appspot.com/is here, documentation is
  here http://readthedocs.org/docs/web2py-instant-admin and source code
 is
  here http://github.com/sramana/web2py-instant-admin. Since this is my
  first Web2py project, I don't know how good/bad the quality is. Your
  feedback will be very valuable for me. Thanks for your time.
 
  Thanks  Regards,
  Ramana.



Re: [web2py] Re: Requesting Feedback for Web2py Instant Admin

2011-08-02 Thread Ramana
Hi Chris,

The requirements are not necessary to use the plugin. They are only for
developers for automating the dev/deploy/testing.

Regarding path, it's my mistake. It should have been path.py. It is at
http://pypi.python.org/pypi/path.py. I fixed it now.

On Tue, Aug 2, 2011 at 7:02 AM, Christopher Steel chris.st...@gmail.comwrote:

 Ramana,

 Gorgeous plugin, I think we should make it part of the Web2py Welcome app
 as well. It is a great example of a plugin and if fills an important need
 for site administration.

 I was able to find urls for all the requirements with the exception of path
 which obviously brings up a lot of unrelated google listings : )

 Here are urls for the requirements I found,  are they correct?

 web2py
 http://www.web2py.com/examples/static/web2py_src.zip

 web2py-utils
 http://packages.python.org/web2py_utils/

 WebTest
 http://webtest.canoo.com/webtest/manual/WebTestHome.html

 nose
 http://readthedocs.org/docs/nose/en/latest/

 path
 ???

 Thanks for the awesome plugin!!!

 Chris



Re: [web2py] Re: Requesting Feedback for Web2py Instant Admin

2011-08-02 Thread Ramana
Hi,

I just reset the password and verified that the login is working. Can you
please try now?

On Tue, Aug 2, 2011 at 12:12 AM, Francisco Costa m...@franciscocosta.comwrote:

 Looks very good, but I can't login with superuser credentials
 (usearname = a, password = a)
 I get this message: We're sorry. Please enter a password with at
 least six characters.

 On Aug 1, 2:16 pm, Anthony abasta...@gmail.com wrote:
  Looks very promising, but I cannot log into the demo (I've tried all the
  provided demo logins, but they all result in Invalid login).
 
 
 
 
 
 
 
  On Monday, August 1, 2011 2:09:23 AM UTC-4, Ramana wrote:
   Dear Web2py users,
 
   I just launched the beta version of Web2py Instant Admin
 http://sramana.in/web2py-instant-admin,
   a (supposedly) django-like admin interface for Web2py applications. The
   demo http://w2padmin.appspot.com/ is here, documentation is here
 http://readthedocs.org/docs/web2py-instant-admin and
   source code is here http://github.com/sramana/web2py-instant-admin.
   Since this is my first Web2py project, I don't know how good/bad the
 quality
   is. Your feedback will be very valuable for me. Thanks for your time.
 
   Thanks  Regards,
   Ramana.



[web2py] Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Kenneth Lundström
I tried to upgrade a development server from 1.91.4 to 1.98.1 and now I 
get these tickets:



Version
web2py^(TM) Version 1.98.1 (2011-07-31 10:15:50)

Traceback (most recent call last):
  File /data/domains/gluon/restricted.py, line 192, in restricted
exec ccode in environment
  File /data/domains/applications/init/models/2_db.py, line 463, in 
module

migrate=settings.migrate)
  File /data/domains/gluon/dal.py, line 4311, in define_table
polymodel=polymodel)
  File /data/domains/gluon/dal.py, line 593, in create_table
fields.append('PRIMARY KEY(%s)' % table._id.name)
  File /data/domains/gluon/dal.py, line 4730, in __getattr__
return self[key]
  File /data/domains/gluon/dal.py, line 4674, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: '_id'

462 db.define_table('returning_revision',
463 db.returning,
464 db.Field  
https://exp-kal.nudata.fi/examples/global/vars/Field('returning',db.returning,required=True),
465 migrate=settings.migrate)


Any ideas whats wrong?


Kenneth



[web2py] Re: web2py for freelance work

2011-08-02 Thread Massimo Di Pierro
 As for CMS, there's Instant Press (http://code.google.com/p/instant-press/),
 which has now been incorporated into Powerpack 2.0 
 (http://powerpack.tecnodoc.com.ar/powerpack/default/index).

It has? I did not know. Is there any of Martin's blogs that talk about
this?

Massimo


[web2py] Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread pbreit
That's a really odd model. Usually it would look like this:


462 db.define_table('returning_revision',
464 Field('returning', db.returning))


Re: [web2py] Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Kenneth Lundström
 That's a really odd model. Usually it would look like this: 462 
db.define_table('returning_revision', 464 Field('returning', db.returning))


2,5 years, but this is not the first revision definition, maybe 30:th.


Kenneth




[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread Massimo Di Pierro
I think I now fixed this in trunk. Can you give it a try?

Massimo

On Aug 2, 1:30 am, zeng zeng...@gmail.com wrote:
 Hi Massimo,

 Further tracing lead to some additional information:

  AppA/models/db.py 
 from gluon.shell import exec_environment
 common_db = exec_environment('applications/appauth/models/db.py',
 request=request, response=response)
 db = common_db.db # -- yes, point to the db file in AppAuth
 session.connect(request, response, db, masterapp='appauth')
 auth = Auth(globals(), db)
 auth.define_tables(migrate=False, username=True)
 auth.settings.login_url = '/appauth/default/user/login'
 ---

 What's interesting is the exec_enviroment(), which i use to load the
 db value from AppAuth in AppA, if exec_environment() is called it will
 reset the session to empty, if I do not use exec_enviroment() cross
 app login will work in both 1.95.1 and 1.96.1, if I do, it will only
 work in 1.95.1

 Ok, and the next question I may sound like a retard, where to submit
 the ticket?

 best,
 Zeng

 On Aug 1, 11:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Please open a ticket about this.

  On Jul 22, 2:25 am, Heng Zeng Aun zeng...@gmail.com wrote:

   Good day Massimo,

   the following are the snippets:

    AppAuth/models/db.py 
   db = DAL('sqlite://storage.sqlite')
   session.connect(request, response, db)
   auth = Auth(globals(), db)
   crud = Crud(globals(), db)
   auth.settings.hmac_key = 'sha512:secret key here'
   auth.define_tables(username=True)
   crud.settings.auth = auth

    AppA/models/db.py 
   db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to the 
   db
   file in AppAuth
   session.connect(request, response, db, masterapp='appauth')
   auth = Auth(globals(), db)
   auth.define_tables(migrate=False, username=True)
   auth.settings.login_url = '/appauth/default/user/login'

    AppA/controllers/default.py 
   @auth.requires_login()
   def index():
       response.view='index.html'
       return dict()

   @auth.requires_permission('sayhello')
   def hello():
       response.view='saysomething.html'
       return dict(message=T(hello))

   The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to 
   login
   and view the page provided in AppAuth, but when browse to AppA or AppB, it
   will not be able to access it because auth says its not loggin. However 
   all
   this works in 1.95.1

   If i go into web2py.gluon.tools.Auth and hack current to current =
   Storage(globals()) like it used to be in 1.95.1, and things works again.

   I'm sure forcing current from threading.local() to something else
   definitely is not the correct way of doing this (as i dont know what is 
   the
   intention of the current is using for as well : ).

   Awaits your input, Many Thanks Massimo.

   best,
   Zeng

   On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 

   massimo.dipie...@gmail.com wrote:
This change should not break it. Can you please show us the code that
breaks and we will check what is going on? It is possible that one of
the auth modules has not been patched correctly.

Massimo

On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
 Hey guys,

 I'm currently running version 1.95.1 and have 3 application,
 AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
 authenticate logged in user and it has been working great.

 After upgrading 1.96.1 and cross app authentication no longer works,
 some debuging lead to:
 - web2py.gluon.tools.Auth 
 self.environment = current
 request = current.request
 session = current.session
 - web2py.gluon.tools.Auth 

 and current is a threading.local() in gluon.globals.py !!!

 In the good'o 1.95.1 the session and auth object is retrieved from
 global() ,

 Question is, why is this changed? this seems to break the backward
 compatibility feature of web2py, and what are the recommended
 solutions now that global() is no longer used?

 Thanks!


[web2py] Re: Requesting Feedback for Web2py Instant Admin

2011-08-02 Thread Massimo Di Pierro
Let us know when you think it is ready.

Massimo

On Aug 2, 1:31 am, Ramana srama...@gmail.com wrote:
 Dear all,

 I am overwhelmed by your positive response and kind words. Thank you very
 much.

 I just want to clarify that the HTML theme is not my own. I copied it
 from Rails
 Admin https://github.com/sferik/rails_admin, which in turn is based on 
 Activo
 Theme https://github.com/dmfrancisco/activo, both are MIT licensed.

 Regarding including this plugin in welcome app, I feel that it is still too
 early. There are no test cases. Widgets for Date Time fields, multi-select
 fields and many-to-many associations are still not there. But I am working
 on them. I released the plugin even before it is perfect/stable because I
 wanted some feedback from you. Now I can work more confidently and
 enthusiastically, thanks to your feedback.

 Thanks  Regards,
 Ramana.

 On Mon, Aug 1, 2011 at 2:21 PM, Massimo Di Pierro 







 massimo.dipie...@gmail.com wrote:
  A proposal

  1) we change

  auth.requires_permission() with auth.requires(is_admin or
  has_permission(...))

  2) we move  everything that is not under */plugin_instant_admin under
  plugins/plugin_instant_admin

  3) we rename instant_admin into iadmin

  4) we include it into welcome app

  5) we expose iadmin and old appadmin, default to iadmin, allow
  administrator to switch back to old appadmin (using session to keep
  state)?

  I would take a patch in this direction but I would like to hear more
  opinions.
  It would be great if the the edit for and the pagination table where
  to expose as components to be embedded in regular pages.

  Massimo

  On Aug 1, 1:09 am, Ramana srama...@gmail.com wrote:
   Dear Web2py users,

   I just launched the beta version of Web2py Instant
   Adminhttp://sramana.in/web2py-instant-admin,
   a (supposedly) django-like admin interface for Web2py applications.
   The demohttp://w2padmin.appspot.com/is here, documentation is
   here http://readthedocs.org/docs/web2py-instant-admin and source code
  is
   here http://github.com/sramana/web2py-instant-admin. Since this is my
   first Web2py project, I don't know how good/bad the quality is. Your
   feedback will be very valuable for me. Thanks for your time.

   Thanks  Regards,
   Ramana.


[web2py] Re: Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Massimo Di Pierro
Can you show the definition of table returning?
I think I know what is wrong.

As a test, can you try adding a Field(id,id) on top of your table
returning_revision?

On Aug 2, 2:24 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 I tried to upgrade a development server from 1.91.4 to 1.98.1 and now I
 get these tickets:

 Version
 web2py^(TM)     Version 1.98.1 (2011-07-31 10:15:50)

 Traceback (most recent call last):
    File /data/domains/gluon/restricted.py, line 192, in restricted
      exec ccode in environment
    File /data/domains/applications/init/models/2_db.py, line 463, in
 module
      migrate=settings.migrate)
    File /data/domains/gluon/dal.py, line 4311, in define_table
      polymodel=polymodel)
    File /data/domains/gluon/dal.py, line 593, in create_table
      fields.append('PRIMARY KEY(%s)' % table._id.name)
    File /data/domains/gluon/dal.py, line 4730, in __getattr__
      return self[key]
    File /data/domains/gluon/dal.py, line 4674, in __getitem__
      return dict.__getitem__(self, str(key))
 KeyError: '_id'

 462     db.define_table('returning_revision',
 463     db.returning,
 464     db.Field  
 https://exp-kal.nudata.fi/examples/global/vars/Field('returning',db.returning,required=True),
 465     migrate=settings.migrate)

 Any ideas whats wrong?

 Kenneth


Re: [web2py] Re: Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Kenneth Lundström

Here´s the definition:

db.define_table('returning',
db.Field('troop', db.troop, required=True),
db.Field('campaign', db.campaign, required=True),
db.Field('type', 'string', length=2, default='', 
requires=IS_IN_SET(['', 'r', 'c', 'd', 'p'])),

db.Field('edited_by', db[user_table], required=True),
db.Field('edited_date', 'datetime', required=True),
migrate=settings.migrate)

db.define_table('returning_revision',
db.returning,
db.Field('returning', db.returning, required=True),
migrate=settings.migrate)

I added db.Field(id,id), and now it is working.


Kenneth




Can you show the definition of table returning?
I think I know what is wrong.

As a test, can you try adding a Field(id,id) on top of your table
returning_revision?

On Aug 2, 2:24 am, Kenneth Lundströmkenneth.t.lundst...@gmail.com
wrote:

I tried to upgrade a development server from 1.91.4 to 1.98.1 and now I
get these tickets:

Version
web2py^(TM) Version 1.98.1 (2011-07-31 10:15:50)

Traceback (most recent call last):
File /data/domains/gluon/restricted.py, line 192, in restricted
  exec ccode in environment
File /data/domains/applications/init/models/2_db.py, line 463, in
module
  migrate=settings.migrate)
File /data/domains/gluon/dal.py, line 4311, in define_table
  polymodel=polymodel)
File /data/domains/gluon/dal.py, line 593, in create_table
  fields.append('PRIMARY KEY(%s)' % table._id.name)
File /data/domains/gluon/dal.py, line 4730, in __getattr__
  return self[key]
File /data/domains/gluon/dal.py, line 4674, in __getitem__
  return dict.__getitem__(self, str(key))
KeyError: '_id'

462 db.define_table('returning_revision',
463 db.returning,
464 
db.Fieldhttps://exp-kal.nudata.fi/examples/global/vars/Field('returning',db.returning,required=True),
465 migrate=settings.migrate)

Any ideas whats wrong?

Kenneth




[web2py] Re: Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Massimo Di Pierro
I fixed it in trunk anyway, the problem originates from the fact that
your table returing has a type field which is a keyword

On Aug 2, 3:16 am, Kenneth Lundström kenneth.t.lundst...@gmail.com
wrote:
 Here s the definition:

 db.define_table('returning',
      db.Field('troop', db.troop, required=True),
      db.Field('campaign', db.campaign, required=True),
      db.Field('type', 'string', length=2, default='',
 requires=IS_IN_SET(['', 'r', 'c', 'd', 'p'])),
      db.Field('edited_by', db[user_table], required=True),
      db.Field('edited_date', 'datetime', required=True),
      migrate=settings.migrate)

 db.define_table('returning_revision',
      db.returning,
      db.Field('returning', db.returning, required=True),
      migrate=settings.migrate)

 I added db.Field(id,id), and now it is working.

 Kenneth







  Can you show the definition of table returning?
  I think I know what is wrong.

  As a test, can you try adding a Field(id,id) on top of your table
  returning_revision?

  On Aug 2, 2:24 am, Kenneth Lundstr mkenneth.t.lundst...@gmail.com
  wrote:
  I tried to upgrade a development server from 1.91.4 to 1.98.1 and now I
  get these tickets:

  Version
  web2py^(TM)     Version 1.98.1 (2011-07-31 10:15:50)

  Traceback (most recent call last):
      File /data/domains/gluon/restricted.py, line 192, in restricted
        exec ccode in environment
      File /data/domains/applications/init/models/2_db.py, line 463, in
  module
        migrate=settings.migrate)
      File /data/domains/gluon/dal.py, line 4311, in define_table
        polymodel=polymodel)
      File /data/domains/gluon/dal.py, line 593, in create_table
        fields.append('PRIMARY KEY(%s)' % table._id.name)
      File /data/domains/gluon/dal.py, line 4730, in __getattr__
        return self[key]
      File /data/domains/gluon/dal.py, line 4674, in __getitem__
        return dict.__getitem__(self, str(key))
  KeyError: '_id'

  462     db.define_table('returning_revision',
  463     db.returning,
  464     
  db.Fieldhttps://exp-kal.nudata.fi/examples/global/vars/Field('returning',db.returning,required=True),
  465     migrate=settings.migrate)

  Any ideas whats wrong?

  Kenneth


[web2py] Is Css in web2py different

2011-08-02 Thread pbreit
Can you confirm that those CSS and js files can be accessed at those urls? Do 
hey have urls similar to those hat web2py creates for other css, js and image 
files? Try viewing them in the browser to make sure.


[web2py] Re: Bug in virtualfields w/ session

2011-08-02 Thread Massimo Di Pierro
We need to work on the speed. This can perhaps help the syntax:

db=DAL()
db.define_table('a',Field('b','integer'))
for i in range(10):
db.a.insert(b=i)

def lazy(f):
def g(self,f=f):
import copy
self=copy.copy(self)
return lambda *a,**b: f(self,*a,**b)
return g

class Scale:
@lazy
def c(self,scale=1):
return self.a.b*scale

db.a.virtualfields.append(Scale())
for row in db(db.a).select():
print row.b, row.c(1), row.c(2), row.c(3)



On Aug 1, 3:10 pm, Michael Toomim too...@gmail.com wrote:
 Maybe it helps for me to explain my use-case. I mainly use virtual fields as 
 lazy methods, to help traverse related tables. I was actually surprised that 
 lazy evaluation wasn't the default. I noticed a few implications of this:
   - Large queries are slowed by virtualfields, even if they won't be needed, 
 esp if they query db
   - My definitions for virtualfields aren't as clean as they could be, 
 because I have many nested lazy funcs in the class definition
   - We can't serialize all objects into session variables

 So really I'm just using this because it's a nicer notation to call 
 row.otherthing() instead of getotherthing(row). Maybe I really want some 
 different feature here?

 On Aug 1, 2011, at 5:40 AM, Anthony Bastardi wrote:







  Note, after looking at this some more, Massimo recalled that the reason 
  auth_user virtual fields were excluded from auth.user (and therefore from 
  saving in the session) is because some virtual fields are objects that 
  cannot be pickled and therefore cannot be serialized to store in the 
  session. So, we're thinking of either creating an option to store auth_user 
  virutual fields in auth.user, or maybe testing to make sure the virtual 
  fields can be pickled, and excluding them if not.

  Anthony

  On Mon, Aug 1, 2011 at 5:30 AM, Michael Toomim too...@cs.washington.edu 
  wrote:
  Awesome! I did not know there was an issue submission system.

  On Jul 30, 2011, at 7:02 AM, Anthony wrote:

  An issue has been submitted, and this should be corrected soon.

  Anthony

  On Friday, July 29, 2011 9:57:30 PM UTC-4, Anthony wrote:
  auth.user is Storage(table_user._filter_fields(user, id=True)). The 
  _filter_fields method of the auth_user table only selects actual table 
  fields, not virtual fields, so auth.user will not include any virtual 
  fields. Perhaps this should be changed.

  Anthony

  On Friday, July 29, 2011 9:05:39 PM UTC-4, Michael Toomim wrote:
  I think I found a bug in virtualfields. I have the following
  controller:

  def posts():
      user = session.auth.user
      n = user.name # returns None

  Where person is defined as a virtualfield on user:

  class Users():
      def name(self):
          return self.users.first_name + ' ' + self.users.last_name
  db.users.virtualfields.append(Users())

  The problem is that user.name returns None, because apparently the
  virtualfield isn't loaded into the session variable of user.

  I made this work with the following modification to the controller:

  def posts():
      user = db.users[session.auth.user.id]
      n = user.name # returns the user name correctly!

  I just had to refetch the user from the database.


[web2py] Web2py traffic to web2py.com and twitter

2011-08-02 Thread António Ramos
hello, my firewall detects that my we2py server is constantly connecting to
twitter and web2py
The connection is blocked by the firewall.

is this normal?


thank you


[web2py] Requesting Feedback for Web2py Instant Admin Options

2011-08-02 Thread peter
As I fedback earlier, I get an error message when using it with one of
my apps. So tried the 'radio' app in appliances. It works , but is
empty. So I tried the  online store app from appliances, it blows up
with the following message


Traceback
Traceback (most recent call last):
File D:\web2py\gluon\restricted.py, line 192, in restricted
exec ccode in environment
File D:/web2py/applications/estore/models/plugin_instant_admin.py,
line 21, in module
db = databases.values()[0]  # Take only one database for now.
IndexError: list index out of range

This bug should be reproducible by yourself.

Peter


[web2py] Re: Is Css in web2py different

2011-08-02 Thread Web2Py Freak
am sure of the urls  but there is another question  : do i have to
edit the urls in the css file two ???


Re: [web2py] Web2py traffic to web2py.com and twitter

2011-08-02 Thread Kenneth Lundström
Atleast admin get web2py version from web2py.com and get discussion from 
Twitter.



Kenneth

hello, my firewall detects that my we2py server is constantly 
connecting to twitter and web2py

The connection is blocked by the firewall.

is this normal?


thank you




[web2py] Web2Py with Python 2.4

2011-08-02 Thread Jagmal
Does web2py work with python 2.4?

Our servers have python 2.4 as of now and though i have requested for an 
upgrade, I am not sure if it will be available before I need.

Web2Py seem to ask for hashlib and uuid packages to run and I tried by 
installing those (on local machine with 2.4) but it didn't work. Also, is 
there anyway I could get around installing packages by tweaking PYTHONPATH?

Thanks  Regards,
Jagmal


[web2py] Re: Web2Py with Python 2.4

2011-08-02 Thread Massimo Di Pierro
Officially we dropped support for 2.4. Yet, I cannot think of anything
that broke it yet. What error did you get?


On Aug 2, 4:55 am, Jagmal jag...@gmail.com wrote:
 Does web2py work with python 2.4?

 Our servers have python 2.4 as of now and though i have requested for an
 upgrade, I am not sure if it will be available before I need.

 Web2Py seem to ask for hashlib and uuid packages to run and I tried by
 installing those (on local machine with 2.4) but it didn't work. Also, is
 there anyway I could get around installing packages by tweaking PYTHONPATH?

 Thanks  Regards,
 Jagmal


[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread zeng
Hi Massimo,

Yes I can confirm it's working now! Many Thanks!

best,
Zeng


On Aug 2, 11:01 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 I think I now fixed this in trunk. Can you give it a try?

 Massimo

 On Aug 2, 1:30 am, zeng zeng...@gmail.com wrote:







  Hi Massimo,

  Further tracing lead to some additional information:

   AppA/models/db.py 
  from gluon.shell import exec_environment
  common_db = exec_environment('applications/appauth/models/db.py',
  request=request, response=response)
  db = common_db.db # -- yes, point to the db file in AppAuth
  session.connect(request, response, db, masterapp='appauth')
  auth = Auth(globals(), db)
  auth.define_tables(migrate=False, username=True)
  auth.settings.login_url = '/appauth/default/user/login'
  ---

  What's interesting is the exec_enviroment(), which i use to load the
  db value from AppAuth in AppA, if exec_environment() is called it will
  reset the session to empty, if I do not use exec_enviroment() cross
  app login will work in both 1.95.1 and 1.96.1, if I do, it will only
  work in 1.95.1

  Ok, and the next question I may sound like a retard, where to submit
  the ticket?

  best,
  Zeng

  On Aug 1, 11:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:

   Please open a ticket about this.

   On Jul 22, 2:25 am, Heng Zeng Aun zeng...@gmail.com wrote:

Good day Massimo,

the following are the snippets:

 AppAuth/models/db.py 
db = DAL('sqlite://storage.sqlite')
session.connect(request, response, db)
auth = Auth(globals(), db)
crud = Crud(globals(), db)
auth.settings.hmac_key = 'sha512:secret key here'
auth.define_tables(username=True)
crud.settings.auth = auth

 AppA/models/db.py 
db = DAL('sqlite://../../appauth/storage.sqlite') # -- yes, point to 
the db
file in AppAuth
session.connect(request, response, db, masterapp='appauth')
auth = Auth(globals(), db)
auth.define_tables(migrate=False, username=True)
auth.settings.login_url = '/appauth/default/user/login'

 AppA/controllers/default.py 
@auth.requires_login()
def index():
    response.view='index.html'
    return dict()

@auth.requires_permission('sayhello')
def hello():
    response.view='saysomething.html'
    return dict(message=T(hello))

The behavior of this in 1.96.1 (and 1.97.1) is that I will be able to 
login
and view the page provided in AppAuth, but when browse to AppA or AppB, 
it
will not be able to access it because auth says its not loggin. However 
all
this works in 1.95.1

If i go into web2py.gluon.tools.Auth and hack current to current =
Storage(globals()) like it used to be in 1.95.1, and things works 
again.

I'm sure forcing current from threading.local() to something else
definitely is not the correct way of doing this (as i dont know what is 
the
intention of the current is using for as well : ).

Awaits your input, Many Thanks Massimo.

best,
Zeng

On Thu, Jul 21, 2011 at 8:44 PM, Massimo Di Pierro 

massimo.dipie...@gmail.com wrote:
 This change should not break it. Can you please show us the code that
 breaks and we will check what is going on? It is possible that one of
 the auth modules has not been patched correctly.

 Massimo

 On Jul 21, 11:02 am, zeng zeng...@gmail.com wrote:
  Hey guys,

  I'm currently running version 1.95.1 and have 3 application,
  AppAuth, AppA, AppB, AppA and AppB is using AppAuth to
  authenticate logged in user and it has been working great.

  After upgrading 1.96.1 and cross app authentication no longer works,
  some debuging lead to:
  - web2py.gluon.tools.Auth 
  self.environment = current
  request = current.request
  session = current.session
  - web2py.gluon.tools.Auth 

  and current is a threading.local() in gluon.globals.py !!!

  In the good'o 1.95.1 the session and auth object is retrieved from
  global() ,

  Question is, why is this changed? this seems to break the backward
  compatibility feature of web2py, and what are the recommended
  solutions now that global() is no longer used?

  Thanks!


[web2py] Can I change the color of the cursor on the web2py editor

2011-08-02 Thread dorasan
Hello everyone

I want to change the color of the cursor on the web2py editor.
It is very light gray and sometimes it's hard to find the cursor on
the editor because of sunlight shining on the display.
Ive found the definition of the line color which the cursor exists in
edit_area_full.js but I still don't know how to change the color of
the cursor.

Plese help me.

Dora


Re: [web2py] Do we need a Web2py micro-framework , or split web2py into multiple components ?

2011-08-02 Thread Phyo Arkar
Check it out :

One example.

You cant just remove contrib at all.

It will screwup all the html helper

check this :
$ cat html.py | grep ^from
from HTMLParser import HTMLParser
from htmlentitydefs import name2codepoint
from contrib.markmin.markmin2html import render
from storage import Storage
from highlight import highlight
from utils import web2py_uuid, hmac_hash


you cant just remove utils also

that will screw up html.py too

Too many modules reference each other. as a whole frame work it is
good but if you want to strip down into smaller , lighter web2py , you
will run up into lots of problem.


Re: [web2py] Do we need a Web2py micro-framework , or split web2py into multiple components ?

2011-08-02 Thread Phyo Arkar
I know i can remove all the apps . yes i had allready done that in my
work project.


On 8/2/11, Anthony abasta...@gmail.com wrote:
 On Monday, August 1, 2011 6:45:52 PM UTC-4, Phyo Arkar wrote:

 I haven't test yest.

 But i am not sure if i remove a module it will break some other features
 as
 web2py does magic import not static.


 Right, I guess you can't actually delete DAL because it is automatically
 imported by the framework. I think you can probably delete tools.py (Auth,
 Crud, Mail). And you should be able to delete any of the apps.

 Anthony



Re: [web2py] Do we need a Web2py micro-framework , or split web2py into multiple components ?

2011-08-02 Thread Phyo Arkar
I know i can remove all the apps . yes i had allready done that in my
work project.


On 8/2/11, Anthony abasta...@gmail.com wrote:
 On Monday, August 1, 2011 6:45:52 PM UTC-4, Phyo Arkar wrote:

 I haven't test yest.

 But i am not sure if i remove a module it will break some other features
 as
 web2py does magic import not static.


 Right, I guess you can't actually delete DAL because it is automatically
 imported by the framework. I think you can probably delete tools.py (Auth,
 Crud, Mail). And you should be able to delete any of the apps.

 Anthony



[web2py] Fwd: Server slow

2011-08-02 Thread Kenneth
Getting back to this discussion.

I have a table containing 31.000 record. Model below.

db.define_table('tracker_person_product',
db.Field('troop', db.troop, required=True),
db.Field('troop_person', db.troop_person, required=True),
db.Field('campaign', db.campaign, required=True),
db.Field('product', db.product, required=True),
db.Field('count_received', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
db.Field('count_sold', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
db.Field('count_returned', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
db.Field('count_paid', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
db.Field('edited_by', db.auth_user,default=auth.user_id,
required=True),
db.Field('edited_date', 'datetime', required=True),
format='%(count_received)s',
migrate=settings.migrate)


Queryn all records (record=db(db.tracker_person_product).select())
takes 47 seconds. Just executing one row of python code. Not even
showing all records.

Is there something I can do to reduce query time? 31.000 records just
doesn't sound like that much yet.


Kenneth


-- Forwarded message --
From: Kenneth Lundström kenneth.t.lundst...@gmail.com
Date: Dec 27 2010, 9:14 am
Subject: Server slow
To: web2py-users


So it rather fast notslow:=)

But the edited_by column is not showing a name, it shows a number.

But that is not very intresting as I don t need a list like that, it
was
just a test. I m trying to optimize some reporting functions. I ll
have
to start from an other angle.

Kenneth







 Now I understand.

 The problem is here:

   Field('edited_by', db[user_table], required=True),

 When you do {{=orders}} is uses a default representation for
 edited_by. The field contains a user id and the default representation
 is the user name. So for each record it has to do a database lookup
 (980 of them).

 If you want to represent users by name, you should either cache them.
 Something like this:

 db.orders.edited_by.represent = lambda id: cache.ram('user:
 %i'%id,lambda:db.auth_user(id).first_name,3600)

 or turn your query into a join.

 Massimo

 On Dec 26, 11:37 pm, Kenneth Lundstr mkenneth.t.lundst...@gmail.com
 wrote:
 What part of the model would you like to see?

 This?

 db.define_table('orders',
       db.Field('name', 'string', length=40, requires=IS_NOT_EMPTY()),
       db.Field('district', db.district, required=True),
       db.Field('edited_by', db[user_table], required=True),
       db.Field('edited_date', 'datetime', required=True),
       db.Field('reward_selected', 'integer', default=0),
       db.Field('members', 'integer', default=0),
       db.Field('memb_no', 'string', default=0),
       db.Field('locked', 'integer', default=False, required=True),
       db.Field('cow_id', 'string', default=''),
       migrate=settings.migrate)

 So far there was no view defined for this controller. If I define a
 empty one it takes like 2-3 seconds to show a empty page, controller
 changed to dict(orders=orders).

 If I define the view to be {{=orders}} it takes again 40 seconds to show.

 The strange thing is if I change the view to
 {{
 for order in orders:
       =XML(order)
       pass

 }}

 it only takes about 2-3 seconds to show all orders. Not as nice as
 =orders but very strange anyhow.

 Kenneth

 I have never seen this before. Can I see the model?
 massimo
 On Dec 25, 3:51 pm, Kenneth Lundstr mkenneth.t.lundst...@gmail.com
 wrote:
    Is this reproducible?
 This happens all the time, if I do it ten times in a row every time it 
 takes 38-39 seconds. Even with lynx on theserveritself it takes about 40 
 seconds.
 If I use:
        t0=time.time()
        orders = db(db.orders.id      0).select()
        logging.info('time to fetch %s' % (time.time()-t0))
 The time is 1.75 - 1.90 seconds to fetch the data from database
 I change the controller to this
        sql = db(db.orders.id      0)._select()
        t0=time.time()
        db.executesql(sql)
        logging.info('time to fetch %s' % (time.time()-t0))
        orders=[]
 now I get times like 0.38 - 0.39 seconds
 If I instead of db.orders.id      490) to get half the rows all times 
 drops to half, even 40 seconds is now 20 seconds.
 Just testing I tried with:
        t0=time.time()
        orders = db(db.orders.id      0).select()
        orders1 = db(db.orders.id      0).select()
        orders2 = db(db.orders.id      0).select()
        orders3 = db(db.orders.id      0).select()
        orders4 = db(db.orders.id      0).select()
        logging.info('time to fetch %s' % (time.time()-t0))
        return orders
 This takes about, 5x1,8s (to fetch data) + 35 seconds = 45 seconds
 I tried with a different table that contains about 1250 rows, 6 columns. 
 It takes 1.2-1.3 seconds to fetch the data, but then over 60 seconds to 
 display it.
 Kenneth


[web2py] Re: Not getting proper Janrain choices

2011-08-02 Thread Matthew
Thank you! That bit of code was the key.

The wizard definitely does NOT work. I had to manually copy/paste this
code into db.py to get it working.

Can you point me in the right direction of the wizard's files so I can
take a look at fixing this bug? Also, what's the best way to
contribute to the documentation? I'd like to point out that domain
is not actually the full domain as defined by Janrain's documentation,
but your domain's application name.

Thanks again,
Matthew


On Jul 31, 10:57 pm, Anthony abasta...@gmail.com wrote:
 On Sunday, July 31, 2011 7:20:27 PM UTC-4, Matthew wrote:

  0.py

  settings.login_config = 'domain:api_key'

 I think the above is supposed to be your domain and Janrain API key, not the
 literal string 'domain:api_key' (you input this in the first step of the
 wizard). However, in this case I don't think it matters, because it appears
 your code does not actually use this setting (see below).

  db.py (abridged)

  ...

  #
  ## If you need to use OpenID, Facebook, MySpace, Twitter, Linkedin,
  etc.
  ## register with janrain.com, uncomment and customize following
  from gluon.contrib.login_methods.rpx_account import RPXAccount
  auth.settings.actions_disabled = \
     ['register','change_password','request_reset_password']
  auth.settings.login_form = RPXAccount(request,
  api_key='xx',domain='x',
     url = http://localhost:/%s/default/user/login; %
  request.application)

 When using the wizard, you shouldn't need to manually uncomment and fill in
 the code above. Instead, the following code should be inserted in db.py for
 you by the wizard:

 from gluon.contrib.login_methods.rpx_account import RPXAccount
 auth.settings.actions_disabled=['register','change_password','request_reset_password']
 auth.settings.login_form = RPXAccount(request,
     api_key = settings.login_config.split(':')[-1],
     domain = settings.login_config.split(':')[0],
     url = http://%s/%s/default/user/login; %
 (request.env.http_host,request.application))

 Notice this uses settings.login_config to obtain your domain and API key.
 Does your db.py include this code? If not, what version of web2py are you
 using?

 Anthony


Re: [web2py] Fwd: Server slow

2011-08-02 Thread Kenneth Lundström

Sorry, meant this discussion:
http://groups.google.com/group/web2py/browse_thread/thread/c6bc090c04b323ed/b2e8ec8a2d5d0786?lnk=gstq=server+slow#b2e8ec8a2d5d0786

Database: MySQL, server Apache 2.2.3 on CentOS and web2py version 1.98.1


Kenneth


Getting back to this discussion.

I have a table containing 31.000 record. Model below.

db.define_table('tracker_person_product',
 db.Field('troop', db.troop, required=True),
 db.Field('troop_person', db.troop_person, required=True),
 db.Field('campaign', db.campaign, required=True),
 db.Field('product', db.product, required=True),
 db.Field('count_received', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
 db.Field('count_sold', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
 db.Field('count_returned', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
 db.Field('count_paid', 'integer', required=True,
requires=IS_INT_IN_RANGE(0, 100)),
 db.Field('edited_by', db.auth_user,default=auth.user_id,
required=True),
 db.Field('edited_date', 'datetime', required=True),
 format='%(count_received)s',
 migrate=settings.migrate)


Queryn all records (record=db(db.tracker_person_product).select())
takes 47 seconds. Just executing one row of python code. Not even
showing all records.

Is there something I can do to reduce query time? 31.000 records just
doesn't sound like that much yet.


Kenneth


-- Forwarded message --
From: Kenneth Lundströmkenneth.t.lundst...@gmail.com
Date: Dec 27 2010, 9:14 am
Subject: Server slow
To: web2py-users


So it rather fast notslow:=)

But the edited_by column is not showing a name, it shows a number.

But that is not very intresting as I don t need a list like that, it
was
just a test. I m trying to optimize some reporting functions. I ll
have
to start from an other angle.

Kenneth








Now I understand.
The problem is here:
   Field('edited_by', db[user_table], required=True),
When you do {{=orders}} is uses a default representation for
edited_by. The field contains a user id and the default representation
is the user name. So for each record it has to do a database lookup
(980 of them).
If you want to represent users by name, you should either cache them.
Something like this:
db.orders.edited_by.represent = lambda id: cache.ram('user:
%i'%id,lambda:db.auth_user(id).first_name,3600)
or turn your query into a join.
Massimo
On Dec 26, 11:37 pm, Kenneth Lundstr mkenneth.t.lundst...@gmail.com
wrote:

What part of the model would you like to see?
This?
db.define_table('orders',
   db.Field('name', 'string', length=40, requires=IS_NOT_EMPTY()),
   db.Field('district', db.district, required=True),
   db.Field('edited_by', db[user_table], required=True),
   db.Field('edited_date', 'datetime', required=True),
   db.Field('reward_selected', 'integer', default=0),
   db.Field('members', 'integer', default=0),
   db.Field('memb_no', 'string', default=0),
   db.Field('locked', 'integer', default=False, required=True),
   db.Field('cow_id', 'string', default=''),
   migrate=settings.migrate)
So far there was no view defined for this controller. If I define a
empty one it takes like 2-3 seconds to show a empty page, controller
changed to dict(orders=orders).
If I define the view to be {{=orders}} it takes again 40 seconds to show.
The strange thing is if I change the view to
{{
for order in orders:
   =XML(order)
   pass
}}
it only takes about 2-3 seconds to show all orders. Not as nice as
=orders but very strange anyhow.
Kenneth

I have never seen this before. Can I see the model?
massimo
On Dec 25, 3:51 pm, Kenneth Lundstr mkenneth.t.lundst...@gmail.com
wrote:

Is this reproducible?

This happens all the time, if I do it ten times in a row every time it takes 
38-39 seconds. Even with lynx on theserveritself it takes about 40 seconds.
If I use:
t0=time.time()
orders = db(db.orders.id0).select()
logging.info('time to fetch %s' % (time.time()-t0))
The time is 1.75 - 1.90 seconds to fetch the data from database
I change the controller to this
sql = db(db.orders.id0)._select()
t0=time.time()
db.executesql(sql)
logging.info('time to fetch %s' % (time.time()-t0))
orders=[]
now I get times like 0.38 - 0.39 seconds
If I instead of db.orders.id490) to get half the rows all times drops 
to half, even 40 seconds is now 20 seconds.
Just testing I tried with:
t0=time.time()
orders = db(db.orders.id0).select()
orders1 = db(db.orders.id0).select()
orders2 = db(db.orders.id0).select()
orders3 = db(db.orders.id0).select()
orders4 = db(db.orders.id0).select()
logging.info('time to fetch %s' % (time.time()-t0))
return orders
This takes about, 5x1,8s (to fetch data) + 35 seconds = 45 seconds
I tried with a 

[web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Heath Jordaan
This seems to be an issue with the 1.98.1 install.

I tried the experimental online upgrade from to 1.97.1 and on restarting 
web2py I got the same NameError message.
Downloaded a fresh OSX binary of 1.98.1 from the website and got the same 
error.

Mac OSX 10.6.8

1.97.1 still works fine without an issue


Re: [web2py] Fwd: Server slow

2011-08-02 Thread pbreit
Can you run the query directly against the db to compare? Do you have the debug 
tool displaying at the bottom of the page that shows how long he query took?


[web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread pbreit
Where are you seeing this error? Is it on a web2py error page? Does it show the 
code that is causing the error?


Re: [web2py] Do we need a Web2py micro-framework , or split web2py into multiple components ?

2011-08-02 Thread pbreit
Are you just looking to save a few kilobytes? That doesn't really seem 
worthwhile to me.


Re: [web2py] Fwd: Server slow

2011-08-02 Thread Kenneth Lundström
 Can you run the query directly against the db to compare? Do you have 
the debug tool displaying at the bottom of the page that shows how long 
he query took?


t3=time.time()
testar = db(db.tracker_person_product.id).select()

t4=time.time()

 logging.info('query time: %s' % (t4-t3))

-- query time: 47,7 seconds

If I run this:
sql = db(db.tracker_person_product.id  0)._select()
t0=time.time()
db.executesql(sql)
logging.info('time to fetch %s' % (time.time()-t0))

time to fetch: 16.8 seconds


Kenneth




[web2py] Re: Not getting proper Janrain choices

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 8:12:01 AM UTC-4, Matthew wrote: 

 Thank you! That bit of code was the key. 

 The wizard definitely does NOT work. I had to manually copy/paste this 
 code into db.py to get it working.

 
Are you saying that in Step 1 of the wizard you selected Janrain as the 
login method and specified a login_config but did not get the following code 
inserted into your db.py file:
 
from gluon.contrib.login_methods.rpx_account import RPXAccount
auth.settings.actions_disabled=['register','change_password','request_reset_password']
auth.settings.login_form = RPXAccount(request,
api_key = settings.login_config.split(':')[-1],
domain = settings.login_config.split(':')[0],
url = http://%s/%s/default/user/login; % 
(request.env.http_host,request.application))
 
 
This works when I try it. What version of web2py are you using? Or was there 
some other problem?
 


 Can you point me in the right direction of the wizard's files so I can 
 take a look at fixing this bug?

 
The wizard is part of the 'admin' application in 
/web2py/applications/admin (
http://code.google.com/p/web2py/source/browse/#hg%2Fapplications%2Fadmin). 
There is a wizard.py controller (
http://code.google.com/p/web2py/source/browse/applications/admin/controllers/wizard.py)
 
and a couple views (
http://code.google.com/p/web2py/source/browse/applications/admin/#admin%2Fviews%2Fwizard
).
 

 Also, what's the best way to 
 contribute to the documentation? I'd like to point out that domain 
 is not actually the full domain as defined by Janrain's documentation, 
 but your domain's application name.

 
You can submit requests for documentation changes/corrections here.
 
Anthony


Re: [web2py] Fwd: Server slow

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 8:44:52 AM UTC-4, Kenneth wrote: 

  Can you run the query directly against the db to compare? Do you have 
 the debug tool displaying at the bottom of the page that shows how long 
 he query took? 

  t3=time.time()
  testar = db(db.tracker_person_product.id).select()

What happens if you do:
 
testar = db(db.tracker_person_product.id  0).select() # Note, added ' 
0'
 


Re: [web2py] Fwd: Server slow

2011-08-02 Thread David Marko
In the first example, web2py converts SQL query results into DAL row objects 
which takes time for 31K records. Using executesql is always faster ...

[web2py] Re: upgrading from 1.95.1 to 1.96.1 breaks cross app authentication

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 2:30:01 AM UTC-4, zeng wrote: 

 Ok, and the next question I may sound like a retard, where to submit 
 the ticket?

 
Looks like this one is solved, but for future reference, tickets get 
submitted here: http://code.google.com/p/web2py/issues/list.
 
Anthony
 


Re: [web2py] Fwd: Server slow

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 8:54:57 AM UTC-4, David Marko wrote: 

 In the first example, web2py converts SQL query results into DAL row 
 objects which takes time for 31K records. Using executesql is always faster 
 ...

 
Good point -- executesql isn't returning the same object: 
http://web2py.com/book/default/chapter/06#executesql
 
Anthony


[web2py] Re: web2py for freelance work

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 3:47:09 AM UTC-4, Massimo Di Pierro wrote: 

  As for CMS, there's Instant Press (
 http://code.google.com/p/instant-press/), 
  which has now been incorporated into Powerpack 2.0 (
 http://powerpack.tecnodoc.com.ar/powerpack/default/index). 

 It has? I did not know. Is there any of Martin's blogs that talk about 
 this?

 
There's this: 
http://martin.tecnodoc.com.ar/default/post/2011/04/20/13_instant-press-is-dead-long-live-to-instant-press-20
 
And Instant 2 Press is listed as one of the plugins within Powerpack 2.0: 
http://powerpack.tecnodoc.com.ar/powerpack/default/index
 
Anthony


[web2py] Re: Upgrading from 1.91.4 to 1.98.1

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 3:52:54 AM UTC-4, pbreit wrote: 

 That's a really odd model. Usually it would look like this: 

 462 db.define_table('returning_revision',
 464Field('returning', db.returning))

 
http://web2py.com/book/default/chapter/06#Table-Inheritance
 
 


[web2py] Re: Login form's remember for 30 days not working

2011-08-02 Thread Iceberg
Hi Massimo, I've sent you the file yesterday. Did you get it? If that
mail somehow lost, I can open an issue and submit a patch there.

Regards,
Ray

On Aug 1, 6:32 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 No objection but can you please email me the new file as an
 attachment?

 On Aug 1, 5:26 am, Iceberg iceb...@21cn.com wrote:







  Hi Massimo,

  This problem exists for quite some time, today I trace it to these old
  source.

  [1] The 
  diagnosis.http://groups.google.com/group/web2py/browse_thread/thread/bb9f92e255...

  [2] The 
  fix.http://groups.google.com/group/web2py/browse_thread/thread/b9ad5c501d...

  Would you please take the above fix? Thanks.

  Regards,
  Ray (a.k.a. Iceberg)


Re: [web2py] Re: Is Css in web2py different

2011-08-02 Thread Richard Vézina
You should confirm that you can acces your css file by edit de source code
of your page Ctrl + U in most browser then check if the links are
accessible... Or you also can use Dev tool in Chrome and check if all the
linked file are get by chrome in the Network tab of the Dev tool.

If there is linked image in the CSS you will have to make sure those images
are in the right place and also accessible.

Richard

On Tue, Aug 2, 2011 at 5:39 AM, Web2Py Freak halna...@gardeniatelco.comwrote:

 am sure of the urls  but there is another question  : do i have to
 edit the urls in the css file two ???


[web2py] Re: Splitting python code in the database

2011-08-02 Thread DenesL
Hi Hybride,

you can do

t=TABLE(*[ TR(x.split('\r\n')[:2]) for x in f_codetest.split('')
[1:]])


On Aug 1, 2:54 pm, Hybride mshybr...@gmail.com wrote:
 Hi everyone,

 Am having a hard time with figuring out this rather simple split. I
 have python code (actual code) store in the database, with the
 following table (f_codetest is the table, the result are three after):

 'f_codetest': ' functionOne(1, 2)\r\nTrue\r\n functionOne(2, 1)\r
 \nFalse\r\n functionOne(0, -1)\r\nFalse\r\n'

 I grab the data as such:

 {{for row in
 db(db.t_problems.id==db.t_problems(request.args(0))).select(): }}

 How do I loop through the functions to put functionOne(X, Y) in a
 separate variable from True/False? I've gotten this far:

 {{io = row.f_tests.split('')}}

 Which will remove the , and the result is:

 functionOne(1, 2)\r\nTrue\r\n functionOne(2, 1)\r\nFalse\r\n
 functionOne(0, -1)\r\nFalse\r\n'

 I tried doing:
 {{ for io in ioList:
     i = io.split(\r\n)}}

 but that only removes the \r\n. Am trying to put functionOne(X,Y) in
 it's own td and True/False right next to it, so:

 tabletrtdfunctionOne(X,Y)/tdtdTrue/td/tr
 trtdfunctionOne(X,Y)/tdtdFalse/td/tr/table

 Not sure why Python loops have always given me so much trouble, but
 any help would be awesome!


Re: [web2py] Re: Ubuntu pip install web2py in virtualenv

2011-08-02 Thread David Webb

On 08/01/2011 05:55 PM, pbreit wrote:

I always advise installing via Mercurial clone if possible.

hg clone https://code.google.com/p/web2py/ web2py
i am get an error when trying to clone, tried multiple times last night 
and today


hg clone https://code/google.com/p/web2py/ web2py
abort: error: Connection refused

do i have to register somewhere or am i missing something?



[web2py] auth.login onaccept web2py-component-command don't work

2011-08-02 Thread Alexander Cabezas
Hello,

I don't get the correct behavior when update response.headers with
onaccept parameter on auth.login function. Here I'm trying to redirect
with Javascript after user logins but it redirect to default/
index.load, below:


# default.py
def login():
nc = request.vars.nc or 'default'
nf = request.vars.nf or 'index'
next = URL(r=request, c=nc, f=nf)
return dict(form=auth.login(onaccept=lambda form:
response.headers.update({'web2py-component-
command':document.location='%s'%next})))


# index.html
{{extend 'layout.html'}}
{{=LOAD(default,login.load,vars={'nc':'editor','nf':'list.html'},ajax=True,ajax_trap=True)}}


# login.load
{{=form.custom.begin}}
Usuario: {{=form.custom.widget.username}}
Clave: {{=form.custom.widget.password}}
{{=form.custom.submit}}
{{=form.custom.end}}


If anyone see something, please tell me.


[web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Heath Jordaan
The error is showing up only in the Mac web2py binary package
Its happening when you click on the web2py.app in finder, it basically 
throws an error window with the following message

NameError: name 'copyright' is not defined, and gives you the option to open 
the console log or terminate .

I have pasted the relevant entries from my mac's console log if it helps.


2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]Traceback (most 
recent call last):
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
/Users/heathjordaan/Desktop/web2py-1.9/web2py.app/Contents/Resources/__boot__.py,
 
line 137, in module
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]
_run('web2py.py')
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
/Users/heathjordaan/Desktop/web2py-1.9/web2py.app/Contents/Resources/__boot__.py,
 
line 134, in _run
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]execfile(path, 
globals(), globals())
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
/Users/heathjordaan/Desktop/web2py-1.9/web2py.app/Contents/Resources/web2py.py,
 
line 16, in module
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]import 
gluon.widget
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
gluon/widget.py, line 24, in module
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
gluon/main.py, line 83, in module
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
gluon/custom_import.py, line 280, in __call__
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
gluon/custom_import.py, line 74, in __call__
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]  File 
gluon/compileapp.py, line 50, in module
2011/08/02 4:46:00 PM
[0x0-0xbf0bf].org.pythonmac.unspecified.web2py[4172]NameError: name 
'copyright' is not defined
2011/08/02 4:46:00 PMweb2py[4172]web2py Error
2011/08/02 4:46:00 PMweb2py[4172]web2py Error
An unexpected error has occurred during execution of the main script

NameError: name 'copyright' is not defined


On a side note I have tested the source code version of 1.98.1 and that 
seems to start up and work fine from the command line.




Re: [web2py] Fwd: Server slow

2011-08-02 Thread Richard Vézina
To me it seems that it comes from : *psycopg2._psycopg*

I use Postgres 8.4 under ubuntu 11.04, python 2.6.5, web2py 1.97.1, with the
dev http server...


In [3]: import cProfile

In [4]: import pstats

In [5]: cProfile.run('SQLTABLE(db().select(db.test_ph.ALL))')
 650629 function calls (580822 primitive calls) in 14.921 CPU
seconds

   Ordered by: standard name

   ncalls  tottime  percall  cumtime  percall filename:lineno(function)
10.0000.000   14.921   14.921 string:1(module)
  4210.0040.0000.0040.000
copy.py:112(_copy_with_constructor)
  4210.0090.0000.0160.000 copy.py:65(copy)
  6770.2220.0001.2430.002 dal.py:1046(_select)
  6770.0120.0000.0120.000 dal.py:1155(select_limitby)
  6770.0440.000   13.7060.020 dal.py:1161(select)
  6770.0170.0004.7450.007 dal.py:1165(response)
 2136/7840.0780.0000.1610.000 dal.py:1202(tables)
  6770.0560.0004.6870.007 dal.py:1243(log_execute)
  6770.0120.0004.6990.007 dal.py:1250(execute)
  6760.0390.0000.0680.000 dal.py:1253(represent)
  6760.0040.0000.0040.000
dal.py:1320(represent_exceptions)
  6770.0070.0000.0070.000 dal.py:1329(rowslice)
  6772.2850.0037.6520.011 dal.py:1333(parse)
  6770.0190.0000.0450.000 dal.py:1458(filter_tenant)
   850.0070.0000.4340.005 dal.py:3603(ff)
   850.0070.0000.7230.009 dal.py:3649(list_ref_repr)
  1700.0040.0000.4550.003 dal.py:3653(genexpr)
   850.0080.0000.0100.000
dal.py:3683(bar_decode_integer)
 93100.1530.0000.2140.000 dal.py:3697(__getitem__)
277250.2640.0000.2640.000 dal.py:3706(__setitem__)
   850.0010.0000.0030.000 dal.py:3709(__getattr__)
 15220.0220.0000.0350.000 dal.py:3712(__setattr__)
935120.8030.0000.8030.000 dal.py:4248(__getitem__)
  6770.0060.0000.0060.000 dal.py:4251(__setitem__)
256940.3890.0000.6010.000 dal.py:4254(__getattr__)
  6770.0110.0000.0170.000 dal.py:4257(__setattr__)
  6770.0240.0000.0390.000 dal.py:4266(__call__)
 15220.0230.0000.0330.000 dal.py:4381(__setattr__)
73242/64801.7290.000   12.9280.002 dal.py:4579(__getitem__)
   850.0080.0000.4060.005 dal.py:4594(__call__)
 49890.0720.0000.2550.000 dal.py:4647(__getattr__)
 44920.0660.0000.2390.000 dal.py:4655(__iter__)
194390.4950.0001.1670.000 dal.py:4950(__eq__)
  6760.0180.0000.0390.000 dal.py:4953(__ne__)
   850.0030.0000.0050.000 dal.py:4971(belongs)
  4250.0240.0000.0600.000 dal.py:5247(formatter)
 18700.0130.0000.0130.000 dal.py:5277(__nonzero__)
 46610.0390.0000.0390.000 dal.py:5280(__str__)
202000.2260.0000.2260.000 dal.py:5301(__init__)
195250.1550.0000.1550.000 dal.py:5357(__init__)
  6770.0250.000   13.7460.020 dal.py:5393(select)
  6770.0060.0000.0060.000 dal.py:5474(__init__)
   860.0010.0000.0020.000 dal.py:5518(__nonzero__)
   860.0010.0000.0020.000 dal.py:5523(__len__)
  7610.0330.0000.0660.000 dal.py:5529(__getitem__)
  2560.0050.0000.0220.000 dal.py:5536(__iter__)
  5910.0100.0000.0630.000 dal.py:5553(first)
   850.0030.0000.0230.000 dal.py:861(BELONGS)
  1700.0020.0000.0140.000 dal.py:865(genexpr)
  5910.0130.0000.1200.000 dal.py:883(EQ)
6013/46610.1490.0000.3260.000 dal.py:932(expand)
   850.0070.0000.0130.000 decimal.py:512(__new__)
   860.0010.0000.0800.001 html.py:1403(_fixup)
10.0000.0000.0000.000 html.py:1410(_fixup)
10.0000.0000.0030.003 html.py:1418(_fixup)
10.0000.0000.0000.000 html.py:1452(_fixup)
 19810.1100.0000.3260.000 html.py:551(__init__)
 18920.0130.0000.0130.000 html.py:670(_fixup)
   890.0430.0000.0820.001 html.py:679(_wrap_components)
 19810.0120.0000.0120.000 html.py:705(_postprocessing)
 38700.0530.0000.0800.000 html.py:750(_setnode)
10.1820.182   14.267   14.267 sqlhtml.py:1305(__init__)
   850.0040.0004.4930.053 test.py:1126(lambda)
   850.0030.0001.0160.012 test.py:1128(lambda)
   850.0030.0001.8270.021 test.py:1131(lambda)
 

[web2py] linkto SQLTABLE mmodal

2011-08-02 Thread Ismael Serratos
Hi! How could I represent the ID of a SQLTABLE as a link that shows a mmodal
plugin window? And how can I pass to it args?? The form that I'd like to
show in the modal is in another controller.

Greetings!


[web2py] how to limit upload field

2011-08-02 Thread António Ramos
hello i have a model with a field of type upload.

how can i limit the size of the upload file?

thank you
António


[web2py] something strange when installing application

2011-08-02 Thread mart
Hi,

I built a small app (locally on Mac OS) that makes use of plugin_wiki.
I packed it, copied it to a windows server and installed it.

It installs fine, plugin_wiki is available, but all of the plugin_wiki
pages are missing...

has this happened to anyone else?

my workaround was to re-write (well, copied  paste really) tyhe wiki
pages, and all works well again... but I would like to get to the
bottom of this :)

thanks
Mart :)


[web2py] Re: something strange when installing application

2011-08-02 Thread pbreit
Are the pages in the DB?

[web2py] get any field as input for lambda function with .represent

2011-08-02 Thread Richard
Hello,

Is it possible to do that :

db.table.field.represent = lambda field1, field2: do something

???

If it not braking anything in the logic of web2py it could sometime be
of so much help to solve issue like this one...

I have a 1 to many relation... So table1 contain the represent of my
records in table2... But since there is more then one record for the
same sample number from table1 I can't do something like this :

dict1 = {}
for r in db(db[request.args(0)].id0).select(db[request.args(0)].id,
db[request.args(0)].sample_id):
dict1[r.sample_id] = r.id

db[request.args(0)].sample_id.represent=\
lambda sample_id: A(%(sample)s %db.table1[sample_id],
\
 
_href=URL(r=request,f='read',args=request.args(0)+'/'+str((dict1[sample_id])))

But if I could do :

db[request.args(0)].sample_id.represent=\
lambda id, sample_id: A(%(sample)s
%db.table1[sample_id],\
 
_href=URL(r=request,f='read',args=request.args(0)+'/'+str((id)))

I want to get rid off id field column in a grid...

How it sounds?

Richard


Re: [web2py] get any field as input for lambda function with .represent

2011-08-02 Thread Anthony
The change log for 1.98.1 includes:
 
field.represent = lambda value,record:  
 
 
I think that might do what you want.
 
Anthony

On Tuesday, August 2, 2011 12:21:11 PM UTC-4, Richard wrote:

 Hello, 

 Is it possible to do that : 

 db.table.field.represent = lambda field1, field2: do something 

 ??? 

 If it not braking anything in the logic of web2py it could sometime be 
 of so much help to solve issue like this one... 

 I have a 1 to many relation... So table1 contain the represent of my 
 records in table2... But since there is more then one record for the 
 same sample number from table1 I can't do something like this : 

 dict1 = {} 
 for r in db(db[request.args(0)].id0).select(db[request.args(0)].id, 
 db[request.args(0)].sample_id): 
 dict1[r.sample_id] = r.id 

 db[request.args(0)].sample_id.represent=\ 
 lambda sample_id: A(%(sample)s %db.table1[sample_id], 
 \ 
   
 _href=URL(r=request,f='read',args=request.args(0)+'/'+str((dict1[sample_id])))
  


 But if I could do : 

 db[request.args(0)].sample_id.represent=\ 
 lambda id, sample_id: A(%(sample)s 
 %db.table1[sample_id],\ 
   
 _href=URL(r=request,f='read',args=request.args(0)+'/'+str((id))) 

 I want to get rid off id field column in a grid... 

 How it sounds? 

 Richard



[web2py] typo book chapter 2

2011-08-02 Thread Herman
try...except...else...finally


 try:
 a = 1 / 0
 except Exception, e
 print 'oops: %s' % e

missing :
 except Exception, e:


[web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread pbreit
Looks like it could be a bug that only happens when a certain Java version 
is not found:

*is_jython = settings.global_settings.is_jython = 'java' in 
sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or 
str(copyright).find('Jython')  0*

http://code.google.com/p/web2py/source/detail?r=398f46917b468faf67c9b201b505685e0013d9a6path=/gluon/compileapp.py


Re: [web2py] get any field as input for lambda function with .represent

2011-08-02 Thread Richard Vézina
Great...

Thanks Anthony.

Richard

On Tue, Aug 2, 2011 at 12:43 PM, Anthony abasta...@gmail.com wrote:

 The change log for 1.98.1 includes:

 field.represent = lambda value,record: 


 I think that might do what you want.

 Anthony

 On Tuesday, August 2, 2011 12:21:11 PM UTC-4, Richard wrote:

 Hello,

 Is it possible to do that :

 db.table.field.represent = lambda field1, field2: do something

 ???

 If it not braking anything in the logic of web2py it could sometime be
 of so much help to solve issue like this one...

 I have a 1 to many relation... So table1 contain the represent of my
 records in table2... But since there is more then one record for the
 same sample number from table1 I can't do something like this :

 dict1 = {}
 for r in db(db[request.args(0)].id0).**select(db[request.args(0)].id,
 db[request.args(0)].sample_id)**:
 dict1[r.sample_id] = r.id

 db[request.args(0)].sample_id.**represent=\
 lambda sample_id: A(%(sample)s %db.table1[sample_id],
 \

 _href=URL(r=request,f='read',**args=request.args(0)+'/'+str((**dict1[sample_id])))


 But if I could do :

 db[request.args(0)].sample_id.**represent=\
 lambda id, sample_id: A(%(sample)s
 %db.table1[sample_id],\

 _href=URL(r=request,f='read',**args=request.args(0)+'/'+str((**id)))

 I want to get rid off id field column in a grid...

 How it sounds?

 Richard




Re: [web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Jonathan Lundell
On Aug 2, 2011, at 10:02 AM, pbreit wrote:

 Looks like it could be a bug that only happens when a certain Java version is 
 not found:
 
 is_jython = settings.global_settings.is_jython = 'java' in 
 sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or 
 str(copyright).find('Jython')  0
 
 http://code.google.com/p/web2py/source/detail?r=398f46917b468faf67c9b201b505685e0013d9a6path=/gluon/compileapp.py

copyright appears to be a built-in symbol, at least in my command-line Python.

~ $ python
Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type help, copyright, credits or license for more information.
 copyright
Copyright (c) 2001-2010 Python Software Foundation.
All Rights Reserved.

Copyright (c) 2000 BeOpen.com.
All Rights Reserved.

Copyright (c) 1995-2001 Corporation for National Research Initiatives.
All Rights Reserved.

Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
All Rights Reserved.
 type(copyright)
class 'site._Printer'
 str(copyright)
'Copyright (c) 2001-2010 Python Software Foundation.\nAll Rights 
Reserved.\n\nCopyright (c) 2000 BeOpen.com.\nAll Rights Reserved.\n\nCopyright 
(c) 1995-2001 Corporation for National Research Initiatives.\nAll Rights 
Reserved.\n\nCopyright (c) 1991-1995 Stichting Mathematisch Centrum, 
Amsterdam.\nAll Rights Reserved.'



Re: [web2py] Re: multiselect with part of a table

2011-08-02 Thread Nicolas Palumbo
yes, shouldn't be what already exists in db because that may include
items of the actual selection. DOing the multiselect only useful for
adding stuff... but the actual selection + what was already selected
from the other products.
I'll see if I find a way to do that.

Thanks,
Nico

On Sat, Jul 30, 2011 at 7:58 PM, howesc how...@umich.edu wrote:
 sounds like you would need to write either a custom validator and or some
 custom handling of the form - the SQLFORM() helper assumes that what is the
 output of the validated field is exactly what you want to store in the DB,
 but it sounds like you want the output of the validated field to be made of
 data that was both submitted by the user and also by what already exists in
 the DB.

 look for custom validators in the book and see if you can build one that
 will work for you.  sounds like you have defined the requirements so that's
 a good first step!



Re: [web2py] Re: Ubuntu pip install web2py in virtualenv

2011-08-02 Thread pbreit
Hmmm...hard to say. Are you on Mac, Windows or *nix?

Can you try it with http:

hg clone http://code.google.com/p/web2py/https://code.google.com/p/web2py/
 web2py



Re: [web2py] get any field as input for lambda function with .represent

2011-08-02 Thread Richard Vézina
Wonderful it works :

db[request.args(0)].sample_id.represent=\
lambda sample_id, record: A(%(sample)s
%db.v_sample_num_all[sample_id],\
_href=URL(r=request,f='read',args=request.args(0)+'/'+str(
record.id)))

Richard

On Tue, Aug 2, 2011 at 1:12 PM, Richard Vézina
ml.richard.vez...@gmail.comwrote:

 Great...

 Thanks Anthony.

 Richard

 On Tue, Aug 2, 2011 at 12:43 PM, Anthony abasta...@gmail.com wrote:

 The change log for 1.98.1 includes:

 field.represent = lambda value,record: 


 I think that might do what you want.

 Anthony

 On Tuesday, August 2, 2011 12:21:11 PM UTC-4, Richard wrote:

 Hello,

 Is it possible to do that :

 db.table.field.represent = lambda field1, field2: do something

 ???

 If it not braking anything in the logic of web2py it could sometime be
 of so much help to solve issue like this one...

 I have a 1 to many relation... So table1 contain the represent of my
 records in table2... But since there is more then one record for the
 same sample number from table1 I can't do something like this :

 dict1 = {}
 for r in db(db[request.args(0)].id0).**select(db[request.args(0)].id,
 db[request.args(0)].sample_id)**:
 dict1[r.sample_id] = r.id

 db[request.args(0)].sample_id.**represent=\
 lambda sample_id: A(%(sample)s %db.table1[sample_id],
 \

 _href=URL(r=request,f='read',**args=request.args(0)+'/'+str((**dict1[sample_id])))


 But if I could do :

 db[request.args(0)].sample_id.**represent=\
 lambda id, sample_id: A(%(sample)s
 %db.table1[sample_id],\

 _href=URL(r=request,f='read',**args=request.args(0)+'/'+str((**id)))

 I want to get rid off id field column in a grid...

 How it sounds?

 Richard





[web2py] Re: Not getting proper Janrain choices

2011-08-02 Thread Matthew
1. Yes, I completed those steps and the code was not inserted.
2. Version 1.98.1
3. I will submit the recommended example/language to this group.


On Aug 2, 8:51 am, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 2, 2011 8:12:01 AM UTC-4, Matthew wrote:

  Thank you! That bit of code was the key.

  The wizard definitely does NOT work. I had to manually copy/paste this
  code into db.py to get it working.

 Are you saying that in Step 1 of the wizard you selected Janrain as the
 login method and specified a login_config but did not get the following code
 inserted into your db.py file:

 from gluon.contrib.login_methods.rpx_account import RPXAccount
 auth.settings.actions_disabled=['register','change_password','request_reset 
 _password']
 auth.settings.login_form = RPXAccount(request,
     api_key = settings.login_config.split(':')[-1],
     domain = settings.login_config.split(':')[0],
     url = http://%s/%s/default/user/login; %
 (request.env.http_host,request.application))

 This works when I try it. What version of web2py are you using? Or was there
 some other problem?



  Can you point me in the right direction of the wizard's files so I can
  take a look at fixing this bug?

 The wizard is part of the 'admin' application in
 /web2py/applications/admin 
 (http://code.google.com/p/web2py/source/browse/#hg%2Fapplications%2Fadmin).
 There is a wizard.py controller 
 (http://code.google.com/p/web2py/source/browse/applications/admin/cont...)
 and a couple views 
 (http://code.google.com/p/web2py/source/browse/applications/admin/#adm...
 ).

  Also, what's the best way to
  contribute to the documentation? I'd like to point out that domain
  is not actually the full domain as defined by Janrain's documentation,
  but your domain's application name.

 You can submit requests for documentation changes/corrections here.

 Anthony


[web2py] delete a SQLTABLE column

2011-08-02 Thread Richard
Hello,

If you have a easy way to delete a entire SQLTABLE column before I
find a way, I will take it.

Thanks.

Richard


[web2py] Re: Not getting proper Janrain choices

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 1:45:52 PM UTC-4, Matthew wrote: 

 1. Yes, I completed those steps and the code was not inserted.

 
Hmm, I just tried it (from 1.98.1 source version on Windows), and it works. 
Which distribution are you using -- Windows or Mac binary, or source? What 
else are you doing in the wizard? If you just specify the Janrain login but 
don't do anything else in the wizard, does it still fail to insert the code 
(note, it should be at the very bottom of your db.py model file, not at the 
place where the commented out Janrain code is).
 
Anthony


Re: [web2py] delete a SQLTABLE column

2011-08-02 Thread Richard Vézina
Here I go ;-)

rows = db().select(db.table1.ALL)
table = SQLTABLE(rows)
for i in range(0, len(table[1])):
del(table[1][i][0])
del(table[0][0][0]) # Delete the header entry of the deleted column

Richard

On Tue, Aug 2, 2011 at 2:17 PM, Richard ml.richard.vez...@gmail.com wrote:

 Hello,

 If you have a easy way to delete a entire SQLTABLE column before I
 find a way, I will take it.

 Thanks.

 Richard


Re: [web2py] Fwd: Server slow

2011-08-02 Thread Kenneth Lundström

On 2.8.2011 15:54, Anthony wrote:

On Tuesday, August 2, 2011 8:44:52 AM UTC-4, Kenneth wrote:

 Can you run the query directly against the db to compare? Do you
have
the debug tool displaying at the bottom of the page that shows how
long
he query took?

 t3=time.time()
 testar = db(db.tracker_person_product.id
http://db.tracker_person_product.id).select()

What happens if you do:
testar = db(db.tracker_person_product.id 
http://db.tracker_person_product.id/  0).select() # Note, added 
' 0'

No difference.

The model for this table contains four reference to other table, can 
this affect the speed?



Kenneth



Re: [web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Anthony
Here's what the Python docs say about the 'copyright' builtin: 
http://docs.python.org/library/constants.html#constants-added-by-the-site-module
 
As pbreit pointed out, compileapp.py includes:
 
is_jython = settings.global_settings.is_jython = 'java' in 
sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or 
str(copyright).find('Jython')  0
 
 
I wonder if we need the 'copyright' check -- isn't 'java' in 
sys.platform.lower() a sufficient check for Jython (that's the same check 
performed by the Python 'site' module to determine whether to display the 
Jython credits).
 
Anthony

On Tuesday, August 2, 2011 1:19:56 PM UTC-4, Jonathan Lundell wrote:

 On Aug 2, 2011, at 10:02 AM, pbreit wrote: 

  Looks like it could be a bug that only happens when a certain Java 
 version is not found:
  
  is_jython = settings.global_settings.is_jython = 'java' in 
 sys.platform.lower() or hasattr(sys, 'JYTHON_JAR') or 
 str(copyright).find('Jython')  0
  
  
 http://code.google.com/p/web2py/source/detail?r=398f46917b468faf67c9b201b505685e0013d9a6path=/gluon/compileapp.py
  

 copyright appears to be a built-in symbol, at least in my command-line 
 Python. 

 ~ $ python
 Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) 
 [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on 
 darwin
 Type help, copyright, credits or license for more information.
  copyright
 Copyright (c) 2001-2010 Python Software Foundation.
 All Rights Reserved. 

 Copyright (c) 2000 BeOpen.com.
 All Rights Reserved. 

 Copyright (c) 1995-2001 Corporation for National Research Initiatives.
 All Rights Reserved. 

 Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.
 All Rights Reserved.
  type(copyright)
 class 'site._Printer'
  str(copyright)
 'Copyright (c) 2001-2010 Python Software Foundation.\nAll Rights 
 Reserved.\n\nCopyright (c) 2000 BeOpen.com.\nAll Rights 
 Reserved.\n\nCopyright (c) 1995-2001 Corporation for National Research 
 Initiatives.\nAll Rights Reserved.\n\nCopyright (c) 1991-1995 Stichting 
 Mathematisch Centrum, Amsterdam.\nAll Rights Reserved.' 



[web2py] Keep Multiple Selection in CRUD.UPDATE

2011-08-02 Thread Ismael Serratos
Hi! I have a crud.update launched via mmodal, the table has 3 string fields
with the option multiple activated.

When I get into the crud.update the multiselect widget doesn't remember the
selection, how could I remember the multiple selection so I can update it??


[web2py] Re: something strange when installing application

2011-08-02 Thread mart
good question... i can't see why they wouldn't though...  hum... I 'm
probably doing something silly again... I'll check it out,

thanks,
Mart :)

On Aug 2, 12:19 pm, pbreit pbreitenb...@gmail.com wrote:
 Are the pages in the DB?


[web2py] Modal edit using FancyBox and iFrame

2011-08-02 Thread Jim Steil

Hi

I'm using fancybox to display a crud.update form in an iframe.  When I 
click on submit the 'next' action displays in the same iframe as the 
crud.update form, as expected.  What I want to do is have the 'next' 
action display in the main browser window.  In reading about iframe, it 
appears as though you can pass a target='_top' to force it to open a 
link in the 'parent' window.  Is there a way I can get crud.update to 
behave this way?


Thanks!

-Jim




[web2py] Re: Strange form behaviour.

2011-08-02 Thread Kevin Butler
 I wish there were a simpler solution than having 
 to add these lines of code to every function returning a form. (I 
 don't want to touch web2py's code outside an app). 

Nice to see the rapid response - the latest version of SQLFORM allows you to 
specify sep='' instead of munging the returned form.

Thanks, Massimo!

kb



[web2py] Re: Strange form behaviour.

2011-08-02 Thread Anthony
On Tuesday, August 2, 2011 3:47:46 PM UTC-4, Kevin Butler wrote: 

  I wish there were a simpler solution than having 
  to add these lines of code to every function returning a form. (I 
  don't want to touch web2py's code outside an app). 

 Nice to see the rapid response - the latest version of SQLFORM allows you 
 to specify sep='' instead of munging the returned form.

 
Slight correction -- it's separator='' (or separator=False), not sep.
 
Also, to control the colon separator in Auth and Crud forms, you can now set 
auth.settings.label_separator and crud.settings.label_separator (this new 
setting gets passed as the 'separator' argument to SQLFORM).
 
Anthony


Re: [web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Heath Jordaan
I think Anthony and pbriet are right about the 'copyright' being the cause. 
If I try and run the included Python Interpreter directly from within the 
app bundle it doesnt seem to include a copyright built in.

Heath-Jordaan-admins-MacBook-Pro:Resources heathjordaan$ ../MacOS/python 
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) 
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
Type help, copyright, credits or license for more information.
 copyright
Traceback (most recent call last):
  File stdin, line 1, in module
NameError: name 'copyright' is not defined

Now my ignorance in terms of web2py's development process is showing because 
I think this needs to be logged as an official bug report somewhere but I 
dont seem to be able to find where to do this on the www.web2py.com site. Im 
new to web2py and while its easy enough to run the source code version this 
really should be fixed for the Mac App download on the site. 



Re: [web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Anthony
Bugs go here: http://code.google.com/p/web2py/issues/list

On Tuesday, August 2, 2011 4:19:27 PM UTC-4, Heath Jordaan wrote:

 I think Anthony and pbriet are right about the 'copyright' being the cause. 
 If I try and run the included Python Interpreter directly from within the 
 app bundle it doesnt seem to include a copyright built in.

 Heath-Jordaan-admins-MacBook-Pro:Resources heathjordaan$ ../MacOS/python 
 Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04) 
 [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
 Type help, copyright, credits or license for more information.
  copyright
 Traceback (most recent call last):
   File stdin, line 1, in module
 NameError: name 'copyright' is not defined

 Now my ignorance in terms of web2py's development process is showing 
 because I think this needs to be logged as an official bug report somewhere 
 but I dont seem to be able to find where to do this on the 
 www.web2py.comsite. Im new to web2py and while its easy enough to run the 
 source code 
 version this really should be fixed for the Mac App download on the site. 



Re: [web2py] Modal edit using FancyBox and iFrame

2011-08-02 Thread Jim Steil

Hey, think I figured it out.  I put this:

base target=_top

...between the head element in my html for the iframe page.  Now when 
the form is submitted, but the 'next' action is performed in the main 
page, not the iframe.


-Jim

On 8/2/2011 2:43 PM, Jim Steil wrote:

Hi

I'm using fancybox to display a crud.update form in an iframe.  When I 
click on submit the 'next' action displays in the same iframe as the 
crud.update form, as expected.  What I want to do is have the 'next' 
action display in the main browser window.  In reading about iframe, 
it appears as though you can pass a target='_top' to force it to open 
a link in the 'parent' window.  Is there a way I can get crud.update 
to behave this way?


Thanks!

-Jim




Re: [web2py] Re: Bug in virtualfields w/ session

2011-08-02 Thread Michael Toomim
That's way better syntax!  Great idea!

On Aug 2, 2011, at 2:31 AM, Massimo Di Pierro wrote:

 We need to work on the speed. This can perhaps help the syntax:
 
 db=DAL()
 db.define_table('a',Field('b','integer'))
 for i in range(10):
db.a.insert(b=i)
 
 def lazy(f):
def g(self,f=f):
import copy
self=copy.copy(self)
return lambda *a,**b: f(self,*a,**b)
return g
 
 class Scale:
@lazy
def c(self,scale=1):
return self.a.b*scale
 
 db.a.virtualfields.append(Scale())
 for row in db(db.a).select():
print row.b, row.c(1), row.c(2), row.c(3)
 
 
 
 On Aug 1, 3:10 pm, Michael Toomim too...@gmail.com wrote:
 Maybe it helps for me to explain my use-case. I mainly use virtual fields as 
 lazy methods, to help traverse related tables. I was actually surprised that 
 lazy evaluation wasn't the default. I noticed a few implications of this:
   - Large queries are slowed by virtualfields, even if they won't be needed, 
 esp if they query db
   - My definitions for virtualfields aren't as clean as they could be, 
 because I have many nested lazy funcs in the class definition
   - We can't serialize all objects into session variables
 
 So really I'm just using this because it's a nicer notation to call 
 row.otherthing() instead of getotherthing(row). Maybe I really want some 
 different feature here?
 
 On Aug 1, 2011, at 5:40 AM, Anthony Bastardi wrote:
 
 
 
 
 
 
 
 Note, after looking at this some more, Massimo recalled that the reason 
 auth_user virtual fields were excluded from auth.user (and therefore from 
 saving in the session) is because some virtual fields are objects that 
 cannot be pickled and therefore cannot be serialized to store in the 
 session. So, we're thinking of either creating an option to store auth_user 
 virutual fields in auth.user, or maybe testing to make sure the virtual 
 fields can be pickled, and excluding them if not.
 
 Anthony
 
 On Mon, Aug 1, 2011 at 5:30 AM, Michael Toomim too...@cs.washington.edu 
 wrote:
 Awesome! I did not know there was an issue submission system.
 
 On Jul 30, 2011, at 7:02 AM, Anthony wrote:
 
 An issue has been submitted, and this should be corrected soon.
 
 Anthony
 
 On Friday, July 29, 2011 9:57:30 PM UTC-4, Anthony wrote:
 auth.user is Storage(table_user._filter_fields(user, id=True)). The 
 _filter_fields method of the auth_user table only selects actual table 
 fields, not virtual fields, so auth.user will not include any virtual 
 fields. Perhaps this should be changed.
 
 Anthony
 
 On Friday, July 29, 2011 9:05:39 PM UTC-4, Michael Toomim wrote:
 I think I found a bug in virtualfields. I have the following
 controller:
 
 def posts():
 user = session.auth.user
 n = user.name # returns None
 
 Where person is defined as a virtualfield on user:
 
 class Users():
 def name(self):
 return self.users.first_name + ' ' + self.users.last_name
 db.users.virtualfields.append(Users())
 
 The problem is that user.name returns None, because apparently the
 virtualfield isn't loaded into the session variable of user.
 
 I made this work with the following modification to the controller:
 
 def posts():
 user = db.users[session.auth.user.id]
 n = user.name # returns the user name correctly!
 
 I just had to refetch the user from the database.



[web2py] Re: NameError: name 'copyright' is not defined

2011-08-02 Thread Heath Jordaan

Thanks, I've submitted this as a bug. (362)

Will just run the source code version in the meantime


On Aug 2, 11:21 pm, Anthony abasta...@gmail.com wrote:
 Bugs go here:http://code.google.com/p/web2py/issues/list



 On Tuesday, August 2, 2011 4:19:27 PM UTC-4, Heath Jordaan wrote:
  I think Anthony and pbriet are right about the 'copyright' being the cause.
  If I try and run the included Python Interpreter directly from within the
  app bundle it doesnt seem to include a copyright built in.

  Heath-Jordaan-admins-MacBook-Pro:Resources heathjordaan$ ../MacOS/python
  Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
  [GCC 4.0.1 (Apple Computer, Inc. build 5367)] on darwin
  Type help, copyright, credits or license for more information.
   copyright
  Traceback (most recent call last):
    File stdin, line 1, in module
  NameError: name 'copyright' is not defined

  Now my ignorance in terms of web2py's development process is showing
  because I think this needs to be logged as an official bug report somewhere
  but I dont seem to be able to find where to do this on 
  thewww.web2py.comsite. Im new to web2py and while its easy enough to run 
  the source code
  version this really should be fixed for the Mac App download on the site.


[web2py] Re: Not getting proper Janrain choices

2011-08-02 Thread Matthew
I see it now, thank you. I didn't realize it was at the bottom of the
file.

Thanks!

On Aug 2, 2:20 pm, Anthony abasta...@gmail.com wrote:
 On Tuesday, August 2, 2011 1:45:52 PM UTC-4, Matthew wrote:

  1. Yes, I completed those steps and the code was not inserted.

 Hmm, I just tried it (from 1.98.1 source version on Windows), and it works.
 Which distribution are you using -- Windows or Mac binary, or source? What
 else are you doing in the wizard? If you just specify the Janrain login but
 don't do anything else in the wizard, does it still fail to insert the code
 (note, it should be at the very bottom of your db.py model file, not at the
 place where the commented out Janrain code is).

 Anthony


[web2py] Re: Ubuntu pip install web2py in virtualenv

2011-08-02 Thread Christopher Steel
You are right, I will take a peek at it. I have never done a pip package but 
it looks interesting. The problem is a lot of these installers can't 
handle something that does not need to be installed... I think pip like to 
make things part of the local python installation as in  
site-packaged/web2py {big grin}

C.


[web2py] Re: something strange when installing application

2011-08-02 Thread pbreit
I believe the w2p files do NOT include the db.

Re: [web2py] delete a SQLTABLE column

2011-08-02 Thread pbreit
Navicat Lite or SQLite Manager for Firefox

[web2py] PATCH: date picker onfocus/onblur

2011-08-02 Thread Kevin Butler
Currently, when you TAB into a date field, the date picker doesn't
open.  It only opens if you click on the field.

I added eventName:'focus' to the date  datetime setup calls in
web2py_ajax.js, and a hide() call for their blur events:

  try {jQuery(input.date).live('focus',function() {Calendar.setup({
  inputField:this, ifFormat:date_format, showsTime:false,
eventName:'focus'
  }); }); } catch(e) {};
...
  try { jQuery(input.datetime).live('focus', function()
{Calendar.setup({
  inputField:this, ifFormat:datetime_format, showsTime:
true,timeFormat: 24, eventName:'focus'
  }); }); } catch(e) {};
  jQuery(input.date,input.datetime).live('blur', function()
{ window.calendar.hide(); });

I also didn't like the fact that if you have the calendar open, you
have to click another field twice to shift focus out of the calendar
(first click closes the calendar, second click focuses on the target).

So I included the following in web2py_ajax.js to prevent the
stopEvent call - though it could really be a patch to calendar.js:

// and prevent the stopevent, so you don't have to click twice to
focus on a different object
Calendar._checkCalendar = function(ev) {
var calendar = window._dynarch_popupCalendar;
if (!calendar) {
return false;
}
var el = Calendar.is_ie ? Calendar.getElement(ev) :
Calendar.getTargetElement(ev);
for (; el != null  el != calendar.element; el = el.parentNode);
if (el == null) {
// calls closeHandler which should hide the calendar.
window._dynarch_popupCalendar.callCloseHandler();
return /*Calendar.stopEvent(ev);*/
}
};

kb


[web2py] Help needed with Google App Engine on Ubuntu 11.04

2011-08-02 Thread Pystar
Hi Guys,
I am having some trouble running GAE on ubuntu 11.04, as I understand,
GAE doesnt support python 2.7, so i installed python2.5 but whenever I
try to run it, I get error messages. I am thinking of doing the
following things but I dont really know how to proceed:
1. How do I completely uninstall the Python2.5 I installed and install
it again as I compiled it from source and it always complains about
missing libraries e.g. SSL, _sqlite3 whenever I try to run Python2.5
PATH_TO_GAE/dev_appserver.py
2. Will using virtualenv to create a sandbox and run GAE solve the
problem? But wont the Python2.5 which I installed in (1) still give
the missing library errors? if it will then uninstalling python2.5
completely from my ubuntu box would be the way to go? Or can I install
another Python2.5 in my virtualenv sandbox?
P.S: I have never used virtualenv before so forgive my newbie
questions about it.
I really need help concerning this, thanks for your rapid response.

Pystar


[web2py] Re: Ubuntu pip install web2py in virtualenv

2011-08-02 Thread Christopher Steel
From my understanding pip is going to install the same package no matter 
what OS is making the request so this is not really an Ubuntu issue, but it 
is very interesting to me because it is cross platform...

I think the best approach would be to create a Python package that is sort 
of a utility for doing a standard Web2py installation. The same basic 
functionality is required for installing Web2py applications so we might 
want to consider that as a possibility as well. The trick will be insuring 
that the package remains os agnostic as pip is used universally across all 
platforms. The faux installer approach might work well for other systems 
that like repackaging things so they fit the systems concept of 
installations, so it could work for Debian and so on and so forth. 

So in a nutshell rather than packaging Web2py for Debian (which kind of 
destroys the elegance of not having to install Web2py) it we could package 
a Web2py installer' that basically a glorified python based downloader, 
unarchiver and permissions checking utility that unpacks Web2py (and demo 
applicaitons?) to a location that is handy for folks who are just getting 
started with Web2py like $HOME/Web2py

I think if we do it as a Python module (the Web2py faux installer for lack 
of a better description, not Web2py itself) then we will have something to 
give to folks who want to create packages for specific OS's and the result 
will be a standard setup across platforms... ie /Users/me/web2py or 
/home/me/web2py and C:/Users?/me/ - I forget the Windows parlance for home 
directory.

A number of options are available so this will require a bit of reflection. 
I think our primary goal is to give new folks an easy way to get started, 
but it also has some very interesting potential as far as making things 
easier for developers as well (we could have the package install mercurial 
or even fabric if we wanted to for example). 

My preference would be to put out a really basic one A.S.A.P. that does a 
straight up install and works across nix platforms (any Windows users using 
pip?) and over time we can add new features or create a similar tool for 
developers depending on how much it gets used and if we have demand.

What do people think?

Chris



[web2py] Re: Rocket support IPv6

2011-08-02 Thread Timothy Farrell
A boy, Zane.  A healthy 8lbs 5oz.  Find me on Google+ for some images.

On Jul 31, 3:39 pm, Michele Comitini michele.comit...@gmail.com
wrote:
 Tim,
 Congratulations.  Male or Female? :-)

 mic

 2011/7/31 Timothy Farrell explori...@gmail.com:







  OK, I'll take a look at these.  New baby here so I'll probably be
  slow.

  -tim

  On Jul 29, 5:25 am, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:
  Since you are at it... can you check why (I think and I may be wrong)
 rocketresponds http/1.1 even when the request is http/1.0?

  On Jul 28, 8:46 am, Timothy Farrell explori...@gmail.com wrote:

  Rocketdoesn't currently support IPv6.  As I understand adding support
   would not be difficult.  If I add it in, can you help me test it?

   Thanks,
   -tim

   On Jul 26, 11:34 pm, Rahul rahul.dhak...@gmail.com wrote:

Hi Tim, All,
        DoesRocketsupport IPv6? If not, can we expect this to be
added to its feature set anytime soon ?

Rahul D


[web2py] No module named pickle when started in App Engine

2011-08-02 Thread Matthew
I tried to start web2py 1.98.1 using dev_appserver.py, but it cannot
find the pickle module.

Traceback (most recent call last):
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 4144, in _HandleRequest
self._Dispatch(dispatcher, self.rfile, outfile, env_dict)
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 4049, in _Dispatch
base_env_dict=env_dict)
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 616, in Dispatch
base_env_dict=base_env_dict)
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 3120, in Dispatch
self._module_dict)
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 3024, in ExecuteCGI
reset_modules = exec_script(handler_path, cgi_path, hook)
  File /home/matthew/dev/sdks/google_appengine_1.5.2/google/appengine/
tools/dev_appserver.py, line 2887, in ExecuteOrImportScript
exec module_code in script_module.__dict__
  File /home/matthew/dev/projects/poprop_cameron/project/src/
gaehandler.py, line 33, in module
import pickle
ImportError: No module named pickle

When I import it using the interpretor, it imports without error. Is
there a path I have to include somewhere?

Thanks,
Matthew


Re: [web2py] Re: Web2Py with Python 2.4

2011-08-02 Thread John La Rooy
hashlib is new in Python2.5
in Python2.4 there is separate md5 module/sha module etc.

John La Rooy

On Tue, Aug 2, 2011 at 8:01 PM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 Officially we dropped support for 2.4. Yet, I cannot think of anything
 that broke it yet. What error did you get?


 On Aug 2, 4:55 am, Jagmal jag...@gmail.com wrote:
  Does web2py work with python 2.4?
 
  Our servers have python 2.4 as of now and though i have requested for an
  upgrade, I am not sure if it will be available before I need.
 
  Web2Py seem to ask for hashlib and uuid packages to run and I tried by
  installing those (on local machine with 2.4) but it didn't work. Also, is
  there anyway I could get around installing packages by tweaking
 PYTHONPATH?
 
  Thanks  Regards,
  Jagmal



Re: [web2py] Re: Ubuntu pip install web2py in virtualenv

2011-08-02 Thread David Webb

On 08/02/2011 12:06 PM, pbreit wrote:

Hmmm...hard to say. Are you on Mac, Windows or *nix?

Can you try it with http:
hg clone http://code.google.com/p/web2py/ 
https://code.google.com/p/web2py/ web2py

on unix, and i found my truly bonehead error
don't know why, but in my terminal window i had typed code/google.com 
NOT code.google.com

thanks, after correcting the mistake download went smoothly


[web2py] Re: pyodbc access to Teradata (via web2py)

2011-08-02 Thread Andrew
Hi Massimo,

I'm working on making a few changes to the TeradataAdaptor in dal.py,
but admittedly learning about how it all works as I go along.  I hope
to give you some code sometime soon.

I have created a legacy table with a 2 column PK.  I am attempting to
do an insert via the admin screen's database administration button,
however the generated insert statement tries to insert NULLS for the
PK columns. (Note that I was having trouble in this area with SQL
Server as well - Nothing was inserted, so I may have a more general
issue).

If you wouldn't mind having a look at this, but I'll keep working
through dal.py.

From the ticket:
Note:  values present for ID1 and ID2 fields.
File D:\Python\web2py\gluon\sqlhtml.py in accepts at line 1194

Function argument list
(self=gluon.sqlhtml.SQLFORM object, request_vars=Storage
{'_formname': 'AndrewTest3/create', '_f...D2': '6722', 'Name':
'DebugTest', 'ID1': '6656'}, session=Storage {'_formkey[AndrewTest3/
create]': '0f51d...ge\xc3\xb8\xcb\xbc|\xa1Y\x16\xabd\xfc\xcd\x81s'},
formname='AndrewTest3/create', keepvalues=False, onvalidation=None,
dbio=True, hideerror=False, detect_record_change=False)

Then I get None for ID1 and ID2 in dal.py

File D:\Python\web2py\gluon\dal.py in insert at line 4790

Function argument list
(self=Table {'ALL': gluon.dal.SQLALL object at 0x01C...rewTest3',
'_format': None, 'virtualfields': []}, **fields={'ID1': None, 'ID2':
None, 'Name': 'DebugTest'})

File D:\Python\web2py\gluon\dal.py in insert at line 844

Function argument list
(self=gluon.dal.TeradataAdapter object, table=Table {'ALL':
gluon.dal.SQLALL object at 0x01C...rewTest3', '_format': None,
'virtualfields': []}, fields=[(gluon.dal.Field object, None),
(gluon.dal.Field object, 'DebugTest'), (gluon.dal.Field object,
None)])

I've changed the ID fields between integer and string, but they both
return NULL.


P.S.  this may becoming more of a developer issue than a user one.
P.P.S.  Excellent work by the way.  This is one of the most
professionally documented and well structured applications I've worked
with.  It is a pleasure to be using it.

Thanks



[web2py] Re: Help needed with Google App Engine on Ubuntu 11.04

2011-08-02 Thread Pystar
still waiting

On Aug 3, 2:15 am, Pystar aitoehi...@gmail.com wrote:
 Hi Guys,
 I am having some trouble running GAE on ubuntu 11.04, as I understand,
 GAE doesnt support python 2.7, so i installed python2.5 but whenever I
 try to run it, I get error messages. I am thinking of doing the
 following things but I dont really know how to proceed:
 1. How do I completely uninstall the Python2.5 I installed and install
 it again as I compiled it from source and it always complains about
 missing libraries e.g. SSL, _sqlite3 whenever I try to run Python2.5
 PATH_TO_GAE/dev_appserver.py
 2. Will using virtualenv to create a sandbox and run GAE solve the
 problem? But wont the Python2.5 which I installed in (1) still give
 the missing library errors? if it will then uninstalling python2.5
 completely from my ubuntu box would be the way to go? Or can I install
 another Python2.5 in my virtualenv sandbox?
 P.S: I have never used virtualenv before so forgive my newbie
 questions about it.
 I really need help concerning this, thanks for your rapid response.

 Pystar


[web2py] Re: web2py for freelance work

2011-08-02 Thread guruyaya
I'm not working at the freelance world, so I don't know if my answer
is valid. But I think any answer you get, will be right to the
location they work in. In israel, there will be a big advantage for
someone that knows PHP, over someone that knows python. I know this
because I recently looked for a job, and could hardly find a python
job. Now I got a job that allows me to work with web2py, but I got it
as a PHP developer, and I managed to convince my boss, that it's
better. Now I acctually asked people on my interviews, why PHP, and
the most common answer was we have wordpress / zend-cart / joomla /
drupal / some other system written in PHP we need extending, and we're
looking for someone that will extend it.
This is acctually the most problematic aspect of web2py. Instant press
is awsome. It still not wordpress. PyForum is great. It still not
vBulletin. GrooverWiki is great. But it's not MediaWiki. The web2py
book application is awsome Ummm... I don't have a PHP example. The
web2py book is really one of a kind. Point is, there is one great
advantage to PHP, over any other language: the things people did with
it allready. As much as I love web2py, I could not tell someone to
install kPax, instead of wordpress, to create a small company website.

On Jul 25, 8:26 pm, spiffytech spiffyt...@gmail.com wrote:
 I'm picking out a framework to use for freelance web development. Does
 anyone use web2py in that sort of situation? How does it fare? Do you
 find anything particularly limiting or particularly easy? How do
 clients respond when you tell them you're building the site in Python
 (not PHP), and that you're building it in one of the less-common
 frameworks?