[web2py] GAE and 'cannot set memcache' error

2011-11-28 Thread Constantine Vasil


I am getting this error:'cannot set memcache' when using in GAE, what is wrong?


Traceback (most recent call last):
  File /base/data/home/apps/s~*/*/gluon/main.py, line 505, in wsgibase
session._try_store_in_db(request, response)
  File /base/data/home/apps/s~*/*/gluon/globals.py, line 548, in 
_try_store_in_db
record_id = table.insert(**dd)
  File /base/data/home/apps/s~*/*/gluon/contrib/memdb.py, line 255, 
in insert
id = self._create_id()
  File /base/data/home/apps/s~*/*/gluon/contrib/memdb.py, line 295, 
in _create_id
raise Exception, 'cannot set memcache'
Exception: cannot set memcache



[web2py] Re: SQLFORM.grid ondelete possible bug

2011-11-28 Thread Casey Schroeder
Also let me say that I was able to get around this problem - to suit
my purposes, but not those who need ondelete - originally with a hack
to .grid.

In the case in question, i don't really want to delete the item.  I
want to remove it for the user in question.  To do this, originally, I
added another parameter to the .grid class *custom_delete*, if this
parameter is nonempty, then in the switch where the delete would get
called, the custom delete gets called instead, which flags the item as
removed for this user (the item is a message between users; instead of
duplicate messaging, i just flag it as removed for one user and not
another.)

What was nice about this custom remove functionality, was that it
removed the item from the .grid as well instantly, like the delete
itself (some ajax magic i assume).  What was not nice was that it is
that it is a change to the core, and not supported going forward
without an official change.

I settled for a custom action, and just added the button to the list,
following the instructions of another post; this has two flaws -
first, this does not remove the item instantly from the .grid like the
delete (the ajax magic is gone) and it is not properly ordered with
the rest of the buttons; namely, there is a reason why view, edit,
delete show in that order, but adding a new remove, it appears as
first in the order, and i have not determined how to change this.

Any further information on the ondelete issue, as well as any
suggestions on my need to elegantly 'remove' would be of help.

Thanks

On Nov 17, 9:45 am, Casey Schroeder vizqu...@gmail.com wrote:
 Thanks Massimo,

 I am trying this:

     delmem = lambda table, itid, ct:
 auth.del_membership(auth.id_group(auth_group_1),
 table[int(itid)].userid)

 SQLFORM.grid(...ondelete=delmem...)

 table[int(itid)] however, is returning a none type, so the userid is
 inaccessible in this way.  An exception is thrown and caught, and the
 db rolls back the delete (all in local SQLite).

 The _dict_ of the table appears empty and I have not been able to find
 where in the table the data is buried if at all.  Running the relevant
 select itself returns nothing - i made the above mentioned change
 manually, but it appears the same as that in mercurial.

 Thanks

 On Nov 17, 7:52 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Hello Casey, Can you show us your test?

  On Nov 16, 1:14 pm, Casey Schroeder vizqu...@gmail.com wrote:

   There may be an update on this that i missed, but can I ask if this
   fix is sufficient?

   I believe that the ret parameter is the effected row count, correct?

   If you just deleted the record, can you reliably retrieve it from the
   table and record id inondelete, i.e. before a subsequent commit?  My
   *small* test say it doesn't work.

   Is there a way to get the record itself instead?  Or am i missing this
   somewhere?

   Thanks

   On Oct 27, 6:46 pm, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

fixed

On Oct 26, 4:54 pm, Bob St John bobinco...@gmail.com wrote:

 using 1.99.2

 in gluon.sqlhtml.SQLFORM.grid:

 line 1489: returnondelete(table,request.args[-2],ret)

 I think it should be: returnondelete(table,request.args[-1],ret)

 As it is now,ondeletegets (table, table, ret), whereas I believe it
 should get (table, record_id, ret) to work properly...

 I like thisgridmethod!


Re: [web2py] Re: Access remote oracle database

2011-11-28 Thread Humberto Ferreira da Luz Junior
I tried also with python 2.5, but without success.

Importing cx_oracle directly in a python script I got this error:
import cx_Oracle
Traceback (most recent calls last):
   File stdin, line 1, in module
ImportError: DLL load failed with error code 193.

I tried installing cx_oracle in my Ubuntu 11.10 and it worked fine, my
problem is happening only on my windows 7 x64.

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL


[web2py] routes.py to remove default from url

2011-11-28 Thread lyn2py
I know routes.py has been brought up many times, but I haven't been
able to get it to work for me.

Here's what I want to do:
I would like to remove default from the URL in
 localhost/app/default/index
so that it appears as
 localhost/app/index

I have referenced the posts in google groups and at
http://web2py.com/book/default/chapter/04#URL-Rewrite

I have reloaded routes in the admin before testing.

Where should I put routes.py and what code should I put inside it to
make this work?

Thanks!


[web2py] where to update response.headers on success

2011-11-28 Thread thodoris
where can i update the response.headers before form.accepts returns
True?
Because i guess that if i update it after form.accepts returns then
the response has already been sent.

Thodoris


[web2py] Re: PostgreSQL names case sensitivity

2011-11-28 Thread Alan Etkin
Great!. I didn know of that option. Instead i was switching the string
in the function that handles the field sequence in gluon.dal (wich was
not a good practice). The cause of the error was that sequence name
for PostgreSQL had to be table_table_id_seq and not table_id_seq (for
a table with table_id field name).

Thanks

On Nov 28, 3:30 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 In gluon/dal.py there is the following code:

 def sequence_name(self,table):
         return '%s_id_Seq' % table

 is generates the default name of a sequence. if you have a sequence
 already and it has another name use

 db.define_table(...,sequence_name = '...')

 On Nov 28, 12:16 am, Johann Spies johann.sp...@gmail.com wrote:

  On 27 November 2011 16:28, Alan Etkin spame...@gmail.com wrote:

   psycopg2.ProgrammingError: relation debugging_id_seq does not exist

  Maybe a typo somewhere where debugging_id_seq should be debugging.id_seq?

  Regards
  Johann
  --
  Because experiencing your loyal love is better than life itself,
  my lips will praise you.  (Psalm 63:3)


Re: [web2py] Error in custom_import and Pyforum

2011-11-28 Thread Martín Mulone
I think you need json module installed on your system. You are under
windows, linux, ?. In ubuntu linux you can install it from console
doing: apt-get
install python-simplejson

2011/11/27 mikech mp.ch...@gmail.com

 Hi:  I downloaded Pyforums in order to study some code in what looks like
 a very well done application.  When I try to look at the default index view
 I get the following error:

 1.
 2.
 3.
 4.
 5.
 6.
 7.

 Traceback (most recent call last):
   File gluon/restricted.py, line 194, in restricted
   File C:\web2py\applications\pyforum\controllers/default.py, line 6, in 
 module
   File gluon/custom_import.py, line 294, in __call__
   File gluon/custom_import.py, line 78, in __call__
 ImportError: No module named json


 Running Version 1.99.2 (2011-09-26 06:55:33) stable




-- 
 http://martin.tecnodoc.com.ar


[web2py] RESTful API error: no matching pattern

2011-11-28 Thread Oliver Lade
I've been following the documentation regarding RESTful web services
(very cool), and it mostly works except for one annoying thing. Every
time I try a URL that's supposed to match the whole table and return
all results (e.g. http://127.0.0.1/myapp/default/api/persons.json in
the example) I get an error message saying no matching pattern. This
happens both copying the example patterns, using auto  patterns, and
when trying my own patterns (in my case /task[task] should get all
rows of the db.task table, but no luck at 
http://127.0.0.1:8000/myapp/default/api/task;
specifying an ID returns an individual result however).

Any idea what might be causing this? Running web2py v1.99.2
(2011-09-26 06:55:33) stable on Windows 7 x64, using the standard
Rocket 1.2.4 and SQLite DBs.


[web2py] simulate a sub-domain from localhost?

2011-11-28 Thread Nik Go
Is it possible to run something like acme.127.0.0.1:8000?

I've already set the common_field, and I want to do other local tests. I
tried a different IP address, and it works but I lose access to the admin
interface.

This is my routes.py
routers = dict(
BASE = dict(
domains = {
'127.0.0.1:8000' : 'welcome',
'acme.127.0.0.1:8000' : 's1'
}
),
)

What's the proper way of doing this?


[web2py] multi-tenant app tables

2011-11-28 Thread Nik Go
I've already set the request_tenant field and each domain can only see the
data they create.

However, from the localhost, I can only see auth_user data, and data
created from localhost. How do I allow access to all data from the
localhost administrators?

Also, how to I allow tenants to access to common/shared tables between them.


Re: [web2py] Re: Access remote oracle database

2011-11-28 Thread Humberto Ferreira da Luz Junior
I also tried with the x86 python, but I got the same result.

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL



2011/11/28 Humberto Ferreira da Luz Junior humbfd...@gmail.com

 I tried also with python 2.5, but without success.

 Importing cx_oracle directly in a python script I got this error:
 import cx_Oracle
 Traceback (most recent calls last):
File stdin, line 1, in module
 ImportError: DLL load failed with error code 193.

 I tried installing cx_oracle in my Ubuntu 11.10 and it worked fine, my
 problem is happening only on my windows 7 x64.


 Humberto Ferreira da Luz Junior
 Mestrado - Ciência da Computação / UEL
 Analista de Informática - ATI / UEL



[web2py] Web2py based STARTUP: Linkfindr.com

2011-11-28 Thread Kuba Kucharski
Hi,

Long time no see. Some of you may remember me, I was very active here :)
This is my profile http://experts4solutions.com/e4s/default/expert/21
I am really gratefull for help of Web2py community. Without you, guys, this
wouldn't be possible.

In one sentence: I created a startup using WEB2PY.
And it was a great experience!!
The address is http://linkfindr.com

What Linkfindr does? We aggregate all your social networks including the
information about your p2p messaging, and we give you two basic
functionalities:

- ability to get the introduction through your friend who really knows the
person you want to meet(so NOT like on Linkedin where you get  just 20
equal connections in common)
- LinkTuner, where you can see your friends and connect them on different
networks with only one click


We integrated a lot of APIs with WEB2PY, including:
- Facebook
- Twitter
- Linkedin
- Google
- Mixpanel
- Sendgrid
 ..

As a db backend we use mysql and redis.

Everyday we are automatically fetching updated user information from all
his social networks. This is done via separate Web2py processes.

If anyone wants to give it a try the invite code is HOWTOWEB, it will be
valid within the next 72 hours. Few things to have in mind:

- Linkfindr is still in EARLY private beta, so it's probably buggy

- The network f.e. in Chicago;) won't be dense enough for you to see the
power of Linkfindr. The solution is to invite as many friends as you can.
For people from startups in Poland and UK we have on average 32000 people
available for introductions and dozens of suggestions in LinkTuner. That's
why we execute via private invites only.

- The Linkfindr will be able to show you all the features within 24-48 from
registering and connecting your networks(generating suggestions for
LinkTuner takes time). You'll get an email:)


Again, thanks a lot, Massimo, Yarko, Thadeus, Bruno, Mr.Freeze..  all
web2py@googlegroups people!

-- 
Kuba
@83tb


p.s. yes, you have to connect Linkedin to use Linkfindr


Re: [web2py] Problems with forms and firefox

2011-11-28 Thread Vinicius Assef
We use Firefox here and don't have this kind of problem, Bruno.
I put a comment in your first link but it really didn't appear.

Would it be some different way you're submiting this form?



On Mon, Nov 28, 2011 at 5:42 AM, Bruno Rocha rochacbr...@gmail.com wrote:
 Hi,
 I am trying to solve a problem (all day long and I cannot find the source of
 this)
 I have a comment form in a page, also I have another page with edit form,
 and one with create form.
 Every form works ok with Google Chrome, I also tested in Midori and
 Safari(running on wine) and it works ok.
 But, I tested two versions of firefox on windows and linux and any form is
 accepted with firefox. The form is submitted, but the form.vars is always
 blank, so it not reach the accepted state.
 The form is simple:

 form = SQLFORM(db.comments, formstyle='divs')
 if form.process().accepted:
    # I DO some stuff here, but only reachs here in chrome, not in firefox

 I already tested another methods as accepts(), validate() and using
 onsuccess and onvalidation but nothing works.
 If somebody knows what can be the source of this here are the test pages:
 http://labs.blouweb.com/movuca/article/show/1/solving-web2py-forms-problems-with-firefox OR http://labs.blouweb.com/movuca/article/show/2/vegetarian-cheese
 In any article (of any article_type) you have a comment box, login with
 t...@test.com and 1234.
 Try to post a comment with Chrome, then try with firefox.
 Also (still logged in)
 http://labs.blouweb.com/movuca/article/new/Article OR http://labs.blouweb.com/movuca/article/new/CookRecipe
 The create and the respective edit forms (click edit in the article view)
 These forms only accepted with another browser but not with firefox 5 to 8.
 Does anybody knows any issue with this browser?
 Thank you.

 --

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



[web2py] how to keep response.headers after redirect

2011-11-28 Thread thodoris
I want to do the following:

I want to add a key to response.headers

response.headers['success']='True'

after a successful file upload and also redirect.

The problem is that i also want to redirect after successful upload
but redirect makes a new reasponse.headers and i lose the key i want
to add.

Is there a way to solve this?

When upload fails and i don't get redirected i can see my key in the
headers.

My code is:

@auth.requires_login()
def upload():
db.reactable.id.default = request.args(0)
form=SQLFORM(db.table)
response.headers['success']='False'
if form.accepts(request.vars,session):
response.headers['success']='True'
session.flash=Record added
redirect(URL('index'))
return dict(form=form)


[web2py] Re: how to keep response.headers after redirect

2011-11-28 Thread Anthony
Does it have to be a response header? How about adding a flag as a URL arg 
or var:

redirect(URL('index', vars=dict(success='True')))

If you need to check it on the client side, you can access the query string 
in JS via window.location.search. Alternatively, you could have the 'index' 
function itself set the header based on the query string:

def index():
if request.vars.success:
response.headers['success'] = 'True'

Anthony

On Monday, November 28, 2011 8:15:02 AM UTC-5, thodoris wrote:

 I want to do the following:

 I want to add a key to response.headers

 response.headers['success']='True'

 after a successful file upload and also redirect.

 The problem is that i also want to redirect after successful upload
 but redirect makes a new reasponse.headers and i lose the key i want
 to add.

 Is there a way to solve this?

 When upload fails and i don't get redirected i can see my key in the
 headers.

 My code is:

 @auth.requires_login()
 def upload():
 db.reactable.id.default = request.args(0)
 form=SQLFORM(db.table)
 response.headers['success']='False'
 if form.accepts(request.vars,session):
 response.headers['success']='True'
 session.flash=Record added
 redirect(URL('index'))
 return dict(form=form)



[web2py] Re: how to keep response.headers after redirect

2011-11-28 Thread thodoris
No it does not. Your solution is quite clean and of course works.

Thanx a lot!

On Nov 28, 2:37 pm, Anthony abasta...@gmail.com wrote:
 Does it have to be a response header? How about adding a flag as a URL arg
 or var:

 redirect(URL('index', vars=dict(success='True')))

 If you need to check it on the client side, you can access the query string
 in JS via window.location.search. Alternatively, you could have the 'index'
 function itself set the header based on the query string:

 def index():
     if request.vars.success:
         response.headers['success'] = 'True'

 Anthony







 On Monday, November 28, 2011 8:15:02 AM UTC-5, thodoris wrote:

  I want to do the following:

  I want to add a key to response.headers

  response.headers['success']='True'

  after a successful file upload and also redirect.

  The problem is that i also want to redirect after successful upload
  but redirect makes a new reasponse.headers and i lose the key i want
  to add.

  Is there a way to solve this?

  When upload fails and i don't get redirected i can see my key in the
  headers.

  My code is:

  @auth.requires_login()
  def upload():
      db.reactable.id.default = request.args(0)
      form=SQLFORM(db.table)
      response.headers['success']='False'
      if form.accepts(request.vars,session):
          response.headers['success']='True'
          session.flash=Record added
          redirect(URL('index'))
      return dict(form=form)


[web2py] Re: Problems with forms and firefox

2011-11-28 Thread Anthony
Does the problem only happen when using the CKEditor plugin, or even with a 
standard textarea?

On Monday, November 28, 2011 2:42:26 AM UTC-5, rochacbruno wrote:

 Hi,

 I am trying to solve a problem (all day long and I cannot find the source 
 of this)

 I have a comment form in a page, also I have another page with edit form, 
 and one with create form.

 Every form works ok with Google Chrome, I also tested in Midori and 
 Safari(running on wine) and it works ok.

 But, I tested two versions of firefox on windows and linux and any form is 
 accepted with firefox. The form is submitted, but the form.vars is always 
 blank, so it not reach the accepted state.

 The form is simple:

 *form = SQLFORM(db.comments, formstyle='divs')
 **if form.process().accepted:
 **   # I DO some stuff here, but only reachs here in chrome, not in 
 firefox*


 I already tested another methods as accepts(), validate() and using 
 onsuccess and onvalidation but nothing works.

 If somebody knows what can be the source of this here are the test pages:


 http://labs.blouweb.com/movuca/article/show/1/solving-web2py-forms-problems-with-firefox
  OR http://labs.blouweb.com/movuca/article/show/2/vegetarian-cheese

 In any article (of any article_type) you have a comment box, login with* 
 te...@test.com* and *1234*.

 Try to post a *comment* with Chrome, then try with firefox.

 Also (still logged in)

 http://labs.blouweb.com/movuca/article/new/Article OR 
 http://labs.blouweb.com/movuca/article/new/CookRecipe

 The create and the respective edit forms (click edit in the article view)

 These forms only accepted with another browser but not with firefox *5*to 
 *8*.

 Does anybody knows any issue with this browser?

 Thank you.


 -- 

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

  

[web2py] Re: Web2py based STARTUP: Linkfindr.com

2011-11-28 Thread lyn2py
Excellent news Kuba!

On Nov 28, 8:36 pm, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 Hi,

 Long time no see. Some of you may remember me, I was very active here :)
 This is my profilehttp://experts4solutions.com/e4s/default/expert/21
 I am really gratefull for help of Web2py community. Without you, guys, this
 wouldn't be possible.

 In one sentence: I created a startup using WEB2PY.
 And it was a great experience!!
 The address ishttp://linkfindr.com

 What Linkfindr does? We aggregate all your social networks including the
 information about your p2p messaging, and we give you two basic
 functionalities:

 - ability to get the introduction through your friend who really knows the
 person you want to meet(so NOT like on Linkedin where you get  just 20
 equal connections in common)
 - LinkTuner, where you can see your friends and connect them on different
 networks with only one click

 We integrated a lot of APIs with WEB2PY, including:
 - Facebook
 - Twitter
 - Linkedin
 - Google
 - Mixpanel
 - Sendgrid
  ..

 As a db backend we use mysql and redis.

 Everyday we are automatically fetching updated user information from all
 his social networks. This is done via separate Web2py processes.

 If anyone wants to give it a try the invite code is HOWTOWEB, it will be
 valid within the next 72 hours. Few things to have in mind:

 - Linkfindr is still in EARLY private beta, so it's probably buggy

 - The network f.e. in Chicago;) won't be dense enough for you to see the
 power of Linkfindr. The solution is to invite as many friends as you can.
 For people from startups in Poland and UK we have on average 32000 people
 available for introductions and dozens of suggestions in LinkTuner. That's
 why we execute via private invites only.

 - The Linkfindr will be able to show you all the features within 24-48 from
 registering and connecting your networks(generating suggestions for
 LinkTuner takes time). You'll get an email:)

 Again, thanks a lot, Massimo, Yarko, Thadeus, Bruno, Mr.Freeze..  all
 web2py@googlegroups people!

 --
 Kuba
 @83tb

 p.s. yes, you have to connect Linkedin to use Linkfindr


Re: [web2py] could use some help ... mobile admin

2011-11-28 Thread Ross Peoples
Nice job. I'll be testing soon. By the way: Is @mobilize documented in the 
book? I looked through it briefly but didn't see any mention of it.

[web2py] Re: simulate a sub-domain from localhost?

2011-11-28 Thread lyn2py
I will also be interested to know the solution to this. Ruby on Rails
has pow.cx to symlink .dev domains, which are able to create and use
subdomains for localhost.

Thanks!


On Nov 28, 7:37 pm, Nik Go nikolai...@gmail.com wrote:
 Is it possible to run something like acme.127.0.0.1:8000?

 I've already set the common_field, and I want to do other local tests. I
 tried a different IP address, and it works but I lose access to the admin
 interface.

 This is my routes.py
 routers = dict(
     BASE = dict(
         domains = {
             '127.0.0.1:8000' : 'welcome',
             'acme.127.0.0.1:8000' : 's1'
         }
     ),
 )

 What's the proper way of doing this?


[web2py] Re: routes.py to remove default from url

2011-11-28 Thread lyn2py
I would like to add that other than index function, I wish to map
 localhost/app/default/any_function
to
 localhost/app/any_function

Thank you!


On Nov 28, 5:47 pm, lyn2py lyn...@gmail.com wrote:
 I know routes.py has been brought up many times, but I haven't been
 able to get it to work for me.

 Here's what I want to do:
 I would like to remove default from the URL in localhost/app/default/index

 so that it appears as

  localhost/app/index

 I have referenced the posts in google groups and 
 athttp://web2py.com/book/default/chapter/04#URL-Rewrite

 I have reloaded routes in the admin before testing.

 Where should I put routes.py and what code should I put inside it to
 make this work?

 Thanks!


[web2py] Re: SQLFORM.grid ondelete possible bug

2011-11-28 Thread Massimo Di Pierro
I figured out what the problem is. in SQLFORM.grid

ret = db(table.id==request.args[-1]).delete()
if ondelete:
return ondelete(table,request.args[-1],ret)

the record is deleted before ondelete is called. This was for
conformity with the oncreate and onupdate. I had to think about this
one but it does make sense to call ondelete before the record is
actually deleted else the info is not available. I have changed the
behavior and your code should not work. Please give it a try.



On Nov 17, 2:45 am, Casey Schroeder vizqu...@gmail.com wrote:
 Thanks Massimo,

 I am trying this:

     delmem = lambda table, itid, ct:
 auth.del_membership(auth.id_group(auth_group_1),
 table[int(itid)].userid)

 SQLFORM.grid(...ondelete=delmem...)

 table[int(itid)] however, is returning a none type, so the userid is
 inaccessible in this way.  An exception is thrown and caught, and the
 db rolls back the delete (all in local SQLite).

 The _dict_ of the table appears empty and I have not been able to find
 where in the table the data is buried if at all.  Running the relevant
 select itself returns nothing - i made the above mentioned change
 manually, but it appears the same as that in mercurial.

 Thanks

 On Nov 17, 7:52 am, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:







  Hello Casey, Can you show us your test?

  On Nov 16, 1:14 pm, Casey Schroeder vizqu...@gmail.com wrote:

   There may be an update on this that i missed, but can I ask if this
   fix is sufficient?

   I believe that the ret parameter is the effected row count, correct?

   If you just deleted the record, can you reliably retrieve it from the
   table and record id inondelete, i.e. before a subsequent commit?  My
   *small* test say it doesn't work.

   Is there a way to get the record itself instead?  Or am i missing this
   somewhere?

   Thanks

   On Oct 27, 6:46 pm, Massimo Di Pierro massimo.dipie...@gmail.com
   wrote:

fixed

On Oct 26, 4:54 pm, Bob St John bobinco...@gmail.com wrote:

 using 1.99.2

 in gluon.sqlhtml.SQLFORM.grid:

 line 1489: returnondelete(table,request.args[-2],ret)

 I think it should be: returnondelete(table,request.args[-1],ret)

 As it is now,ondeletegets (table, table, ret), whereas I believe it
 should get (table, record_id, ret) to work properly...

 I like thisgridmethod!


[web2py] Re: Web2py based STARTUP: Linkfindr.com

2011-11-28 Thread Anthony
Cool. Note, you should do some testing in IE -- there are some major 
display issues.

On Monday, November 28, 2011 7:36:42 AM UTC-5, kuba wrote:

 Hi, 

 Long time no see. Some of you may remember me, I was very active here :)
 This is my profile http://experts4solutions.com/e4s/default/expert/21
 I am really gratefull for help of Web2py community. Without you, guys, 
 this wouldn't be possible.

 In one sentence: I created a startup using WEB2PY. 
 And it was a great experience!!
 The address is http://linkfindr.com

 What Linkfindr does? We aggregate all your social networks including the 
 information about your p2p messaging, and we give you two basic 
 functionalities:

 - ability to get the introduction through your friend who really knows the 
 person you want to meet(so NOT like on Linkedin where you get  just 20 
 equal connections in common)
 - LinkTuner, where you can see your friends and connect them on different 
 networks with only one click


 We integrated a lot of APIs with WEB2PY, including:
 - Facebook
 - Twitter
 - Linkedin
 - Google
 - Mixpanel
 - Sendgrid
  ..

 As a db backend we use mysql and redis.

 Everyday we are automatically fetching updated user information from all 
 his social networks. This is done via separate Web2py processes.

 If anyone wants to give it a try the invite code is HOWTOWEB, it will be 
 valid within the next 72 hours. Few things to have in mind:

 - Linkfindr is still in EARLY private beta, so it's probably buggy

 - The network f.e. in Chicago;) won't be dense enough for you to see the 
 power of Linkfindr. The solution is to invite as many friends as you can. 
 For people from startups in Poland and UK we have on average 32000 people 
 available for introductions and dozens of suggestions in LinkTuner. That's 
 why we execute via private invites only.

 - The Linkfindr will be able to show you all the features within 24-48 
 from registering and connecting your networks(generating suggestions for 
 LinkTuner takes time). You'll get an email:)


 Again, thanks a lot, Massimo, Yarko, Thadeus, Bruno, Mr.Freeze..  all 
 web2py@googlegroups people!

 -- 
 Kuba 
 @83tb


 p.s. yes, you have to connect Linkedin to use Linkfindr





[web2py] Re: routes.py to remove default from url

2011-11-28 Thread Massimo Di Pierro
in routes.py

myapps = ['app'] # assuming your app is called app

routes_in = [
  ('/admin/$anything','/admin/$anything'), # do not break admin
]
for app in myapps: routes_in += [ # for everyone of my apps
  ('/%s/static/$anything' % app,'/%s/static/$anything' % app), # do
not break static  ('/%s/appadmin/$anything' % app,'/%s/appadmin/
$anything' % app), # do not break appadmin
  ('/%s/$anything' % app,'/%s/default/$anything' % app) # remove
default
]

routes_out = [(b,a) for (a,b) in routes_in] # reverse the mapping
On Nov 28, 3:47 am, lyn2py lyn...@gmail.com wrote:
 I know routes.py has been brought up many times, but I haven't been
 able to get it to work for me.

 Here's what I want to do:
 I would like to remove default from the URL in localhost/app/default/index

 so that it appears as

  localhost/app/index

 I have referenced the posts in google groups and 
 athttp://web2py.com/book/default/chapter/04#URL-Rewrite

 I have reloaded routes in the admin before testing.

 Where should I put routes.py and what code should I put inside it to
 make this work?

 Thanks!


[web2py] Re: Error in custom_import and Pyforum

2011-11-28 Thread Massimo Di Pierro
or replace

import json

with

import gluon.contrib.simplejson as json

On Nov 28, 4:59 am, Martín Mulone mulone.mar...@gmail.com wrote:
 I think you need json module installed on your system. You are under
 windows, linux, ?. In ubuntu linux you can install it from console
 doing: apt-get
 install python-simplejson

 2011/11/27 mikech mp.ch...@gmail.com









  Hi:  I downloaded Pyforums in order to study some code in what looks like
  a very well done application.  When I try to look at the default index view
  I get the following error:

  1.
  2.
  3.
  4.
  5.
  6.
  7.

  Traceback (most recent call last):
    File gluon/restricted.py, line 194, in restricted
    File C:\web2py\applications\pyforum\controllers/default.py, line 6, in 
  module
    File gluon/custom_import.py, line 294, in __call__
    File gluon/custom_import.py, line 78, in __call__
  ImportError: No module named json

  Running Version 1.99.2 (2011-09-26 06:55:33) stable

 --
  http://martin.tecnodoc.com.ar


[web2py] Re: RESTful API error: no matching pattern

2011-11-28 Thread Massimo Di Pierro
Have you tried

http://127.0.0.1/myapp/default/api/person.json

without the s

On Nov 28, 5:19 am, Oliver Lade piemaste...@gmail.com wrote:
 I've been following the documentation regarding RESTful web services
 (very cool), and it mostly works except for one annoying thing. Every
 time I try a URL that's supposed to match the whole table and return
 all results (e.g.http://127.0.0.1/myapp/default/api/persons.jsonin
 the example) I get an error message saying no matching pattern. This
 happens both copying the example patterns, using auto  patterns, and
 when trying my own patterns (in my case /task[task] should get all
 rows of the db.task table, but no luck 
 athttp://127.0.0.1:8000/myapp/default/api/task;
 specifying an ID returns an individual result however).

 Any idea what might be causing this? Running web2py v1.99.2
 (2011-09-26 06:55:33) stable on Windows 7 x64, using the standard
 Rocket 1.2.4 and SQLite DBs.


[web2py] Re: multi-tenant app tables

2011-11-28 Thread Massimo Di Pierro
if condition:
db._request_tenant = 'ignore_tenant'

On Nov 28, 5:39 am, Nik Go nikolai...@gmail.com wrote:
 I've already set the request_tenant field and each domain can only see the
 data they create.

 However, from the localhost, I can only see auth_user data, and data
 created from localhost. How do I allow access to all data from the
 localhost administrators?

 Also, how to I allow tenants to access to common/shared tables between them.


[web2py] Re: routes.py to remove default from url

2011-11-28 Thread Anthony
Look at router.example.py in the /web2py root folder. I think this should 
do it:

routers = dict(
BASE = dict(
default_controller = 'default',
default_function = 'index'
)
)

Goes in routes.py, which goes in the /web2py root folder.

Anthony

On Monday, November 28, 2011 9:27:04 AM UTC-5, lyn2py wrote:

 I would like to add that other than index function, I wish to map
  localhost/app/default/any_function
 to
  localhost/app/any_function

 Thank you!


 On Nov 28, 5:47 pm, lyn2py lyn...@gmail.com wrote:
  I know routes.py has been brought up many times, but I haven't been
  able to get it to work for me.
 
  Here's what I want to do:
  I would like to remove default from the URL in 
 localhost/app/default/index
 
  so that it appears as
 
   localhost/app/index
 
  I have referenced the posts in google groups and athttp://
 web2py.com/book/default/chapter/04#URL-Rewrite
 
  I have reloaded routes in the admin before testing.
 
  Where should I put routes.py and what code should I put inside it to
  make this work?
 
  Thanks!



[web2py] Re: Access remote oracle database

2011-11-28 Thread Massimo Di Pierro
This is a cx_Oracle issue. I suggest you contact the author. He may
have a mailing list.

On Nov 28, 4:17 am, Humberto Ferreira da Luz Junior
humbfd...@gmail.com wrote:
 I tried also with python 2.5, but without success.

 Importing cx_oracle directly in a python script I got this error:import 
 cx_Oracle

 Traceback (most recent calls last):
    File stdin, line 1, in module
 ImportError: DLL load failed with error code 193.

 I tried installing cx_oracle in my Ubuntu 11.10 and it worked fine, my
 problem is happening only on my windows 7 x64.

 Humberto Ferreira da Luz Junior
 Mestrado - Ciência da Computação / UEL
 Analista de Informática - ATI / UEL


[web2py] Re: how to keep response.headers after redirect

2011-11-28 Thread Massimo Di Pierro
Anthony's response suggests a better way to solve your problem yet I
can see people wanting to forward headers. This is possible.

   redirect(URL(...))

is the same as

   raise HTTP(303,location=URL(...))

the named arguments of HTTP are headers so you can do:

   raise HTTP(303,location=URL(...),success=True)

or (forward all headers)

   raise HTTP(303,location=URL(...),**request.headers)



On Nov 28, 7:15 am, thodoris pasxi...@gmail.com wrote:
 I want to do the following:

 I want to add a key to response.headers

 response.headers['success']='True'

 after a successful file upload and also redirect.

 The problem is that i also want to redirect after successful upload
 but redirect makes a new reasponse.headers and i lose the key i want
 to add.

 Is there a way to solve this?

 When upload fails and i don't get redirected i can see my key in the
 headers.

 My code is:

 @auth.requires_login()
 def upload():
     db.reactable.id.default = request.args(0)
     form=SQLFORM(db.table)
     response.headers['success']='False'
     if form.accepts(request.vars,session):
         response.headers['success']='True'
         session.flash=Record added
         redirect(URL('index'))
     return dict(form=form)


[web2py] Re: Web2py based STARTUP: Linkfindr.com

2011-11-28 Thread Massimo Di Pierro
wow looks great!

On Nov 28, 6:36 am, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 Hi,

 Long time no see. Some of you may remember me, I was very active here :)
 This is my profilehttp://experts4solutions.com/e4s/default/expert/21
 I am really gratefull for help of Web2py community. Without you, guys, this
 wouldn't be possible.

 In one sentence: I created a startup using WEB2PY.
 And it was a great experience!!
 The address ishttp://linkfindr.com

 What Linkfindr does? We aggregate all your social networks including the
 information about your p2p messaging, and we give you two basic
 functionalities:

 - ability to get the introduction through your friend who really knows the
 person you want to meet(so NOT like on Linkedin where you get  just 20
 equal connections in common)
 - LinkTuner, where you can see your friends and connect them on different
 networks with only one click

 We integrated a lot of APIs with WEB2PY, including:
 - Facebook
 - Twitter
 - Linkedin
 - Google
 - Mixpanel
 - Sendgrid
  ..

 As a db backend we use mysql and redis.

 Everyday we are automatically fetching updated user information from all
 his social networks. This is done via separate Web2py processes.

 If anyone wants to give it a try the invite code is HOWTOWEB, it will be
 valid within the next 72 hours. Few things to have in mind:

 - Linkfindr is still in EARLY private beta, so it's probably buggy

 - The network f.e. in Chicago;) won't be dense enough for you to see the
 power of Linkfindr. The solution is to invite as many friends as you can.
 For people from startups in Poland and UK we have on average 32000 people
 available for introductions and dozens of suggestions in LinkTuner. That's
 why we execute via private invites only.

 - The Linkfindr will be able to show you all the features within 24-48 from
 registering and connecting your networks(generating suggestions for
 LinkTuner takes time). You'll get an email:)

 Again, thanks a lot, Massimo, Yarko, Thadeus, Bruno, Mr.Freeze..  all
 web2py@googlegroups people!

 --
 Kuba
 @83tb

 p.s. yes, you have to connect Linkedin to use Linkfindr


[web2py] Re: could use some help ... mobile admin

2011-11-28 Thread Massimo Di Pierro
yes.

On Nov 28, 8:11 am, Ross Peoples ross.peop...@gmail.com wrote:
 Nice job. I'll be testing soon. By the way: Is @mobilize documented in the
 book? I looked through it briefly but didn't see any mention of it.


[web2py] Re: could use some help ... mobile admin

2011-11-28 Thread Massimo Di Pierro
No

On Nov 28, 1:48 am, Angelo Compagnucci angelo.compagnu...@gmail.com
wrote:
 Great!

 I'll work on it a soon as possible!

 Are you using the Auto-initialization of form elements ?

 Thanks!

 2011/11/28 Massimo Di Pierro massimo.dipie...@gmail.com:









  I could use some help. In trunk there is code for mobile admin.

  That means that if you visit admin from a mobile device it will use
  jquery.mobile. This is a work in progress and only some pages have
  been implemented but you can help. It is easy.

  In applications/admin/controllers/default.py there is this magic code:

     is_mobile=request.user_agent().is_mobile
     if is_mobile:
         response.view =
  response.view.replace('default/','default.mobile/')

  so if you use a mobile is_mobile==True and is will pick up views from
  views/default.mobile instead of views/default.

  I copied all views from views/default into views/default.mobile and I
  have fixed only index.html, site.html, edit.html about.html. The
  other *.html files need work, this is where you can help

  - replace {{extend 'layout.html'}} with {{extend 'default.mobile/
  layout.html}}.
  - remove any extra text that does not belong to a mobile
  - replace ul with ul  data-role=listview
  - replace all external links (i.e. not internal to admin) from a...
  to a rel=external...

  design.html is going to need some extra work.

  If you can help send me the modified files.

  Also let me know if you have comments or suggestions.

  Massimo

 --
 Profile:http://www.gild.com/compagnucciangelo
 Register on Gild:http://www.gild.com/referral/compagnucciangelo


[web2py] cancel upload leftovers

2011-11-28 Thread thodoris
I have a form that has an upload field.

If i add a cancel button to the form that for example redirects to
'index' the cancel is stopped but what if i wanted to cancel the
upload from an app??

I am asking this cause i am uploading a file from an iphone app to the
database but when i cancel that post request, there is an entry in the
databade which corresponds to the part of the file that was uploaded
until that moment.

Any thoughts?


[web2py] Re: Web2py based STARTUP: Linkfindr.com

2011-11-28 Thread lyn2py
Kuba, if you don't mind, can you share how much time you took to build
your website?

On Nov 28, 8:36 pm, Kuba Kucharski kuba.kuchar...@gmail.com wrote:
 Hi,

 Long time no see. Some of you may remember me, I was very active here :)
 This is my profilehttp://experts4solutions.com/e4s/default/expert/21
 I am really gratefull for help of Web2py community. Without you, guys, this
 wouldn't be possible.

 In one sentence: I created a startup using WEB2PY.
 And it was a great experience!!
 The address ishttp://linkfindr.com

 What Linkfindr does? We aggregate all your social networks including the
 information about your p2p messaging, and we give you two basic
 functionalities:

 - ability to get the introduction through your friend who really knows the
 person you want to meet(so NOT like on Linkedin where you get  just 20
 equal connections in common)
 - LinkTuner, where you can see your friends and connect them on different
 networks with only one click

 We integrated a lot of APIs with WEB2PY, including:
 - Facebook
 - Twitter
 - Linkedin
 - Google
 - Mixpanel
 - Sendgrid
  ..

 As a db backend we use mysql and redis.

 Everyday we are automatically fetching updated user information from all
 his social networks. This is done via separate Web2py processes.

 If anyone wants to give it a try the invite code is HOWTOWEB, it will be
 valid within the next 72 hours. Few things to have in mind:

 - Linkfindr is still in EARLY private beta, so it's probably buggy

 - The network f.e. in Chicago;) won't be dense enough for you to see the
 power of Linkfindr. The solution is to invite as many friends as you can.
 For people from startups in Poland and UK we have on average 32000 people
 available for introductions and dozens of suggestions in LinkTuner. That's
 why we execute via private invites only.

 - The Linkfindr will be able to show you all the features within 24-48 from
 registering and connecting your networks(generating suggestions for
 LinkTuner takes time). You'll get an email:)

 Again, thanks a lot, Massimo, Yarko, Thadeus, Bruno, Mr.Freeze..  all
 web2py@googlegroups people!

 --
 Kuba
 @83tb

 p.s. yes, you have to connect Linkedin to use Linkfindr


[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Anthony
On Sunday, November 27, 2011 11:24:32 PM UTC-5, Constantine Vasil wrote:

 HI Anthony,

 Thank you! 

 This is useful information not available in the book.


Well, that specific example isn't in the book, but the use of the 'default' 
arg to Field() is documented, and it mentions that it is used to 
pre-populate form 
values: http://web2py.com/book/default/chapter/06#Record-Representation. We 
should probably add such an example to the Forms chapter, though.
 


 Now I would define the default in the form definition:
 form = SQLFORM.factory

 How to change it programmatically to other checked 
 value before the form is submitted?


I'm not sure what you mean. Can you explain? Note, the default can be a 
lambda function if needed.

Anthony


[web2py] Re: SQLFORM.factory and custom HTML form radio boxes

2011-11-28 Thread Anthony
This conditional custom HTML seems unnecessary -- why can't you just set 
the default value of the field conditionally in the controller?

Field('primary_email_choice', ..., default='Home' if [condition] else 
'Work')

Anthony

On Sunday, November 27, 2011 11:52:21 PM UTC-5, Constantine Vasil wrote:

 Basically I reverse engineered the HTML generated from web2py and
 came with the following solution:
 In SQLFORM.factory I have this definition:
 Field('*primary_email_choice*', widget=SQLFORM.widgets.radio.widget, 
 requires=IS_IN_SET({'Work' : 'Work', '*Home*' : 'Home'})),

 So in the HTML id=*primary_email_choiceHome*  is a combination of 
 *primary_email_choice* and one of the values in the set: *Home.*
 So I manually composed to HTML to have more control. I have the 
 value in primary_email which determines if the radio check box is checked 
 or not dynamically when the HTML is rendered. It is much more cleared that 
 way and I have a full control on the design:

 {{ if fields['primary_email'] == Home: 
 }}
 input type=radio 
 name=primary_email_choice id=*primary_email_choiceHome* value=Home 
 checked=yes/
 {{ else: }}
 input type=radio 
 name=primary_email_choice id=primary_email_choiceHome value=Home /
 {{ pass }}
 label for=primary_email_choiceHome{{ 
 if fields['primary_email'] == Home: }}Primary Email: Home{{ else: 
 }}Choose Email Home as Primary Email{{ pass }}/label

 Radio check-boxes are under-described in the book and I believe this 
 solution will help others to do the same.





[web2py] Re: Problems with forms and firefox

2011-11-28 Thread DenesL
Seems to be a problem with the encoding/decoding of multi-part form
data.
The POST source shows:

Content-Type: multipart/form-data;
boundary=---265001916915724
Content-Length: 464
-265001916915724
Content-Disposition: form-data; name=comment_text
 p test by Denes using Firefox 8.0.1 on Win XP/p
-265001916915724
Content-Disposition: form-data; name=_formkey
51d0905f-1ba0-4f3d-96c2-5dc38178dd36
-265001916915724
Content-Disposition: form-data; name=_formname
article_comments/create
-265001916915724--

but Firebug only lists two parts:

Parts multipart/form-data

_formkey51d0905f-1ba0-4f3d-96c2-5dc38178dd36
_formname   article_comments/create


[web2py] Fwd: [PSF-Members] Python.org redesign RFP: Request for Comments

2011-11-28 Thread Massimo Di Pierro
Anybody interested?

Begin forwarded message:

 From: Jesse Noller jnol...@gmail.com
 Date: November 28, 2011 8:54:38 AM CST
 To: PSF-Members psf-memb...@python.org, pydotorg pydot...@python.org
 Subject: [PSF-Members] Python.org redesign RFP: Request for Comments
 
 Dear Members/Pydotorg staff: 
 
 Attached to this email, and below this message (.rst format) you will find a 
 draft of a RFP (request for proposals) for the redesign/overhaul of the 
 Python.org website and properties. This has been in the works/being discussed 
 on the board level for some time, with input from a variety of parties.
 
 The intention is to issue this RFP to the community/public after a two week 
 request for comments, starting today (November 28th, 2011) and ending Monday, 
 December 5th 2011.
 
 Comments can be sent to: psf-redes...@python.org
 
 Notes on comments:
 
 - Comments are collected by the committee/team, and will not be openly 
 discussed. The committee and team will not reply to any comments prior to the 
 deadline for comments.
 
 - Once the RFC is completed, the board and committee will take into account 
 comments and modify the RFP as required. Once this draft is completed, the 
 PSF board will vote on the final version of the RFP, again taking comments 
 into account.
 
 I look forward to hearing from all of the volunteers and members we have - 
 I'm very excited about this project, and I am looking forward to what it will 
 bring.
 
 Thank you.
 
 Jesse Noller
 Directory, Python Software Foundation
 jnol...@python.org
 
 = RFP Follows =
 
 
 
 Request for Proposal
 
 
 
 Summary
 ===
 
 The Python Software Foundation (PSF) is accepting proposals for
 architecture, design and development of the primary web site for the
 Python programming language, python.org.
 
 The existing Python web site was originally discussed at PyCon 2003.
 The site was then designed, developed and deployed in Spring 2006. The
 site is currently maintained by a team of community volunteers using a
 custom suite of tools. To get a better understanding of the current
 system, you can review the redesign proposal, slideshow and system
 usage guide by checking out the following code through subversion:
 
   svn co https://svn.python.org/www/trunk/beta.python.org/resources/docs/ 
 beta-python-docs
 
 Python has grown significantly in the last few years, both in terms of
 audience and the amount of topical information about it. This
 (welcome) abundance of information has outgrown the current website's
 taxonomy. The key goal of this project is to update Python's official
 web presence with an eye to better organizing the information we have
 today (and expect to add in the future). The end result should aid the
 various audience roles in locating the information relevant to their
 needs.
 
 
 Proposal guidelines
 ===
 
 Proposals should be submitted by XX:XXpm EST, XX/XX/ via email to
 psf-redesign in PDF format. Proposals received after this date and
 time will not be considered. Proposals should be comprehensive,
 covering all aspects of this RFP.
 
 Note: Bids submitted by a collaborative team of professionals are
 acceptable as long as there is a single signatory to the contract. We
 encourage teams and individuals to collaborate on this project as we
 feel it will enrich the final product and reflects the Python
 community's ethos.
 
 Proposals should include:
 
 * An overview of your company's recommended process for the project
 
 * A draft timeline with staggered deliverables for the project
 
 * Sketches of potential layouts which express the team's vision for
  ``python.org`` are extremely helpful in proposal selection, but are
  not required for submission.
 
 * Your suggestions for each of the points identified in *purpose*
 
 * Your qualifications for the areas identified in *scope*
 
 Proposals must contain the following information about the proposer:
 
 * Company name, contact information and website URL
 
 * Background, including company history, team members, services
 
 * Which company resources would be dedicated to the project
 
 * Samples and designer portfolios of work similar in size and scope
 
 * Contact information for referrals:
 
 
 Purpose
 ===
 
 Although the current implementation of the Python web site has served
 a key purpose over the years, the time has come for the site to
 progress and become a compliment to the growth and maturity of the
 language itself as well as the vibrancy of the community.
 
 This project represents an opportunity to revamp the Python web site
 from the ground up.
 
 The next implementation of the site should:
 
 * Boast a modern design and experience
 
 * Provide concise and intuitive navigation
 
 * Showcase the simplicity and elegance of the language
 
 * Attract and convert potential Python users and Python Software
  Foundation sponsors
 
 * Represent the vibrant, active community
 
 * Make it easy 

[web2py] Re: Quick Question about Wiki Tutorial: .default attribute for db foreign-key field

2011-11-28 Thread Anthony


 For the Wiki Tutorial, In the show(): controller in default.py there
 is the following statement:

 db.comment.page_id.default = this_page.id

 I can't quite figure out what it means. Are we setting the default
 value of the page_id field for the comment table to be 'this_page.id?
 However, in this case, this_page is being fetched from the database,
 so potentially this default value could change everytime the show()
 controller is called. This defeats the point of defining a default
 value.

Actually, that's exactly the idea. The default will be different for each 
unique page. That way, when someone submits a comment on a given page, the 
page_id will automatically be the id of the page being viewed. There's no 
reason the default value specified for a field has to be universally 
constant across all requests. The default value can be changed 
programmatically at any time. In fact, it can even be a lambda function 
that calculates a new value for each insert.

Anthony
 


Re: [web2py] Re: Problems with forms and firefox

2011-11-28 Thread Bruno Rocha
It happens even if I remove the ckeditor widget.

and happens also on the edit article form.

Denes found the problem but I cant understand why the problem is only with
firefox.

http://zerp.ly/rochacbruno
Em 28/11/2011 13:02, DenesL denes1...@yahoo.ca escreveu:

 Seems to be a problem with the encoding/decoding of multi-part form
 data.
 The POST source shows:

 Content-Type: multipart/form-data;
 boundary=---265001916915724
 Content-Length: 464
 -265001916915724
 Content-Disposition: form-data; name=comment_text
  p test by Denes using Firefox 8.0.1 on Win XP/p
 -265001916915724
 Content-Disposition: form-data; name=_formkey
 51d0905f-1ba0-4f3d-96c2-5dc38178dd36
 -265001916915724
 Content-Disposition: form-data; name=_formname
 article_comments/create
 -265001916915724--

 but Firebug only lists two parts:

 Parts multipart/form-data

 _formkey51d0905f-1ba0-4f3d-96c2-5dc38178dd36
 _formname   article_comments/create



[web2py] Re: routes.py to remove default from url

2011-11-28 Thread lyn2py
Thank you very much!

Here's the feedback, I've tried both your suggestions.

Massimo's solution works if there is only default.py. Other controller
routes are not possible.

Anthony's solution is very neat. Although you can't have a controller
going by the name of a function in default.py. I think this is a
reasonable solution.

Appreciate the replies and help!

On Nov 28, 10:38 pm, Anthony abasta...@gmail.com wrote:
 Look at router.example.py in the /web2py root folder. I think this should
 do it:

 routers = dict(
     BASE = dict(
         default_controller = 'default',
         default_function = 'index'
     )
 )

 Goes in routes.py, which goes in the /web2py root folder.

 Anthony







 On Monday, November 28, 2011 9:27:04 AM UTC-5, lyn2py wrote:

  I would like to add that other than index function, I wish to map
   localhost/app/default/any_function
  to
   localhost/app/any_function

  Thank you!

  On Nov 28, 5:47 pm, lyn2py lyn...@gmail.com wrote:
   I know routes.py has been brought up many times, but I haven't been
   able to get it to work for me.

   Here's what I want to do:
   I would like to remove default from the URL in
  localhost/app/default/index

   so that it appears as

localhost/app/index

   I have referenced the posts in google groups and athttp://
  web2py.com/book/default/chapter/04#URL-Rewrite

   I have reloaded routes in the admin before testing.

   Where should I put routes.py and what code should I put inside it to
   make this work?

   Thanks!


[web2py] Re: simulate a sub-domain from localhost?

2011-11-28 Thread GoldenTiger
You can do it my friend
I have my DNS servers configurated of way that I can use all local
subdomains I need.

http://www.local.web2py.es/
http://sub2.local.web2py.es/
http://acme.local.web2py.es:8000/

Instead 127.0.0.1, I use real subdomains resolved at 127.0.0.1  :P
 ping www.local.web2py.es
Resolved at 127.0.0.1: bytes=32 tiempo1m TTL=128


All subdomains of local.web2py.es are resolved at 127.0.0.1
http://*.local.web2py.es:*/

You are free to use for your local tests.
For your production server, instead local.web2py.es use
yourdomain.com



[web2py] Re: multi-tenant app tables

2011-11-28 Thread GoldenTiger
Are you talking about domains on a remote server?

On 28 nov, 12:39, Nik Go nikolai...@gmail.com wrote:
 I've already set the request_tenant field and each domain can only see the
 data they create.

 However, from the localhost, I can only see auth_user data, and data
 created from localhost. How do I allow access to all data from the
 localhost administrators?

 Also, how to I allow tenants to access to common/shared tables between them.


[web2py] Re: SQLFORM.factory and custom HTML form radio boxes

2011-11-28 Thread Constantine Vasil
Assuming [condition] is evaluated dynamically as the code runs 
through SQLFORM.factory
definition, yes, this part will do it.
Field('primary_email_choice', ..., default='Home' if [condition] else 
'Work')

But I need custom formatting. Formatting directly in HTML is easier.





[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Constantine Vasil
 the default can be a lambda function if needed.

That explains it - it would be evaluated dynamically. Yes, this is powerful.

Now question remains about the design side, it seems directly in 
HTML is easier, you can see it visually how it would be rendered.


[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Anthony
On Monday, November 28, 2011 11:19:52 AM UTC-5, Constantine Vasil wrote:

 Now question remains about the design side, it seems directly in 
 HTML is easier, you can see it visually how it would be rendered.


It's not really display logic, though -- to me it makes more sense for the 
controller to handle.


[web2py] Re: SQLFORM.factory and custom HTML form radio boxes

2011-11-28 Thread Anthony
You can do custom formatting without hand-coding all the HTML -- 
see http://web2py.com/book/default/chapter/07#Custom-forms.

On Monday, November 28, 2011 11:17:44 AM UTC-5, Constantine Vasil wrote:

 Assuming [condition] is evaluated dynamically as the code runs 
 through SQLFORM.factory
 definition, yes, this part will do it.
 Field('primary_email_choice', ..., default='Home' if [condition] else 
 'Work')

 But I need custom formatting. Formatting directly in HTML is easier.





Re: [web2py] Re: Access remote oracle database

2011-11-28 Thread Humberto Ferreira da Luz Junior
I solved the problem in cx_oracle mailing list.
That was happening because the Oracle Client wasn't installed (I was using
only the SQL Developer to access the remote database).
I installed the oracle client (instantclient-basic-windows.x64-11.2.0.2.0),
set the ORACLE_HOME variable and added it to PATH.
Now everything is working as should be.

Massimo, thanks by your help and patience.

Humberto Ferreira da Luz Junior
Mestrado - Ciência da Computação / UEL
Analista de Informática - ATI / UEL


[web2py] Re: some ideas on built-in emphasis on client-side processing for web2py

2011-11-28 Thread Ross Peoples
Out of curiosity, what is the benefit of having the browser compile the 
view for display? Web2py's template engine is very fast. I could understand 
building the view in Python code (like Pyjamas or Qooxdoo), since they 
provide widgets that make interacting with an application better. But I 
don't understand why we would want to hop on the JS does everything 
bandwagon just to offload view processing.

I'm not putting down the idea, I am genuinely curious if there is some kind 
of major benefit to something like this that I missed.


[web2py] Re: Error in custom_import and Pyforum

2011-11-28 Thread mikech
I'm on Windows and the json library is there, but I will take Massimo's 
advice and replace it.  

Thanks!

Mike


[web2py] Re: Error in custom_import and Pyforum

2011-11-28 Thread Anthony
Are you using the Windows binary or the source version with your own Python 
installation?

On Monday, November 28, 2011 12:08:04 PM UTC-5, mikech wrote:

 I'm on Windows and the json library is there, but I will take Massimo's 
 advice and replace it.  

 Thanks!

 Mike



[web2py] Fwd: How disable date widget?

2011-11-28 Thread viniciusban
I found this thread in archives and I have some thoughts about this
theme.

1) I need only one date field in just one of my tables to use
SQLFORM.widgets.string.widget. All the others, I'd like to use the
widget. How can I do this?

Anyway, I think that if I set db.my_table.my_date_field.widget =
SQLFORM.widgets.string.widget, web2py has to obbey me. Or not?


2) Another thought is: how could we translate the date picker widget?
I'm Brazilian and my users don't need to know any English. So, it
would be nice if months and days names were translated using the
language files.


--
Vinicius Assef.



-- Forwarded message --
From: Thadeus Burgess thade...@thadeusb.com
Date: Jan 19 2010, 5:46 pm
Subject: How disable date widget?
To: web2py-users


If this is the case, then take a look at web2py_ajax.html in the views
file, and remote the jquery code that creates the calendar popup.

-Thadeus


On Tue, Jan 19, 2010 at 1:45 PM, Thadeus Burgess
thade...@thadeusb.com wrote:
 I believe he is referring to the jQuerydatewidgetand he does not
 want to use it ?

 -Thadeus

 On Tue, Jan 19, 2010 at 7:39 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 Can you explain it does not work What error or incorrect behavior do
 you get?

 On Jan 19, 5:20 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  Field('data_assinatura','date', requires=data,
widget=SQLFORM.widgets.string.widget),

 db.convenio.data_assinatura.widget= SQLFORM.widgets.string.widget

 and

  Field('data_assinatura','date', requires=data,widget=None),

 doesn't works.

 change thefieldtostringwill make loose all functionalities of web2py do
 work with dates.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web2py@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group 
 athttp://groups.google.com/group/web2py?hl=en.


Re: [web2py] Error in custom_import and Pyforum

2011-11-28 Thread Jonathan Lundell
On Nov 27, 2011, at 6:57 PM, mikech wrote:

 Hi:  I downloaded Pyforums in order to study some code in what looks like a 
 very well done application.  When I try to look at the default index view I 
 get the following error:
 
 Traceback (most recent call last):
   File gluon/restricted.py, line 194, in restricted
   File C:\web2py\applications\pyforum\controllers/default.py, line 6, in 
 module
   File gluon/custom_import.py, line 294, in __call__
   File gluon/custom_import.py, line 78, in __call__
 ImportError: No module named json
 
 Running Version 1.99.2 (2011-09-26 06:55:33) stable

pyforum does: import json

...but json is new in Python 2.6. If you're running 2.6, change import json to 
something like this:

try:
import json
except ImportError:
try:
import simplejson as json
except:
import contrib.simplejson as json

...and send a patch to pyforum.

[web2py] Re: Adding custom fields or virtual fields to rows object

2011-11-28 Thread villas
 The virtualfield is computed after the select. It cannot be something 
you want to select from the db.

The unexpected behaviour is this:  
1)  I select all the fields and the framework adds the virtual fields for 
me.
2)  I select some of the fields but the framework does NOT add the virtual 
fields. 

Why doesn't the framework add virtual fields in 2)  ?


[web2py] fedora, pip, web2py, virtualenv, and mysql

2011-11-28 Thread David Watson
I've installed web2py via pip in a virtualenv with the --no-site-
packages option:

virtualenv --no-site-packages env

pip install web2py

which gives me version 1.98.2. I added a VERSION file in the root and
this got web2py running.

I copied admin and my application, which depends on mysql, into the
applications directory. I start web2py and admin is working, but my
app fails when it tries to connect to the database.

I've installed both MySQLdb and pymysql into the virtualenv:

(env)[watson@watson-thinkpad web2py_heroku (master)]$ python
Python 2.7.1 (r271:86832, Apr 12 2011, 16:15:16)
[GCC 4.6.0 20110331 (Red Hat 4.6.0-2)] on linux2
Type help, copyright, credits or license for more information.
 import MySQLdb
 import pymysql

but web2py refuses to recognize either at startup:

(env)[watson@watson-thinkpad web2py_heroku (master)]$ env/bin/w2p_run
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
1.98.2
Database drivers available: SQLite3

Does anybody know why web2py doesn't see the database drivers? I'm
pretty close to having a working web2py on heroku.

Thanks,
David


[web2py] Re: Adding custom fields or virtual fields to rows object

2011-11-28 Thread Anthony
Ideally, you would only need to select the fields actually need to 
calculate the virtual fields.

On Monday, November 28, 2011 12:47:48 PM UTC-5, villas wrote:

  The virtualfield is computed after the select. It cannot be something 
 you want to select from the db.

 The unexpected behaviour is this:  
 1)  I select all the fields and the framework adds the virtual fields for 
 me.
 2)  I select some of the fields but the framework does NOT add the virtual 
 fields. 

 Why doesn't the framework add virtual fields in 2)  ?



Re: [web2py] Error in custom_import and Pyforum

2011-11-28 Thread mikech
Thanks, this must be it.  I'm running under 2.5 using the web2py standard 
binary distribution.  

Mike


[web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
I using the trunk version, GAE. In my models/0.py I have *settings.
email_server = 'gae'.* 
When I try to use *request_reset_password *
*on Email send I got: *Exception: Server address not specified
The line 327-328: is looking for *settings.server.* if not isinstance(self.*
settings.server*, str):
raise Exception('Server address not specified') This is something new, 
shouldn't it be *settings.**email_server*?
2011-11-28 09:45:13.147Traceback (most recent call last):
 File /base/data/home/apps/s~***/***/gluon/restricted.py, line 204, in 
restricted
   exec ccode in environment
 File /base/data/home/apps/s~***/***/applications/***/controllers/default
.py:user, line 14538, in module
 File /base/data/home/apps/s~***/***/gluon/globals.py, line 162, in 
lambda
   self._caller = lambda f: f()
 File 
/base/data/home/apps/s~***/***/applications/***/controllers/default.py:user, 
line 516, in user
 File /base/data/home/apps/s~***/***/gluon/tools.py, line 1139, in 
__call__
   return getattr(self,args[0])()
 File /base/data/home/apps/s~***/***/gluon/tools.py, line 2235, in 
request_reset_password
   dict(key=reset_password_key)):
 File /base/data/home/apps/s~***/***/gluon/tools.py, line 328, in send
   raise Exception('Server address not specified')
Exception: Server address not specified


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Bruno Rocha
Are you sure you have

from gluon.tools import Mail
mail = Mail()
mail.settings.server = gae

??

On Mon, Nov 28, 2011 at 4:27 PM, Constantine Vasil thst...@gmail.comwrote:

 I using the trunk version, GAE. In my models/0.py I have *settings.
 email_server = 'gae'.*
 When I try to use *request_reset_password *
 *on Email send I got: *Exception: Server address not specified
  The line 327-328: is looking for *settings.server.* if not
 isinstance(self.*settings.server*, str):
 raise Exception('Server address not specified') This is something new,
 shouldn't it be *settings.**email_server*?
 2011-11-28 09:45:13.147 Traceback (most recent call last):
  File /base/data/home/apps/s~***/***/gluon/restricted.py, line 204, in
 restricted
exec ccode in environment
  File /base/data/home/apps/s~***/***/applications/***/controllers/default
 .py:user, line 14538, in module
  File /base/data/home/apps/s~***/***/gluon/globals.py, line 162, in
 lambda
self._caller = lambda f: f()
  File
 /base/data/home/apps/s~***/***/applications/***/controllers/default.py:user,
 line 516, in user
  File /base/data/home/apps/s~***/***/gluon/tools.py, line 1139, in
 __call__
return getattr(self,args[0])()
  File /base/data/home/apps/s~***/***/gluon/tools.py, line 2235, in
 request_reset_password
dict(key=reset_password_key)):
  File /base/data/home/apps/s~***/***/gluon/tools.py, line 328, in send
raise Exception('Server address not specified')
 Exception: Server address not specified




-- 

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


[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Constantine Vasil
It depends from the development environment. I am working with GAE and it 
is very tricky to debug when using GAE.

Controller will be fine for me after I generate the HTML to see what it is 
doing.
To understand it how it works we need more examples in the doc.

Before that I need to work with the debugger to see what happens.
















[web2py] Instructions: Setting up Eclipse+PyDev+GAE SDK, Windows

2011-11-28 Thread Constantine Vasil
I hope this will save time to others wich struggle with setting up 
Eclipse+PyDev+GAE SDK, Windows environment and ot be able to step up in *
default.py* with the PyDev debugger.

Using GAE, setting up a development environment is very tricky but I 
managed to set it up. That is what I came out with up to now.

Instructions: Setting up Eclipse+PyDev+GAE, Windows

1) web2py trunk source, install under root/app, app.yaml - configure for 
you GAE app.
2) your app - build under root/*app*/applications/*myapp. I*t is a matter 
of copy/paste to add/replace your app there. Copy *myapp *at separate 
folder like backup/*myapp *and you can use bitbucket for source control. It 
has a free private hosting for up to 5 collaborators.
3) download GAE SDK source copy *google.appengine* directory on the same 
level as gluon - web2py will find for example *import google.appengine.ext * 
only 
that way.
in your app.yaml exclude *google.appengine* directory explicitly.
4) set all GAE dependencies in *db.py *- when you fire up the debugger, the 
breakpoints stop in *db.py* but nowhere else ( a few places actually).
5) make function in *db.py:*
def *MyHook()*: 
  pass  -- set up a breakpoint in your Eclipse here.
6) in your *default.py* place *MyHook() *where you want a breakpoint to 
stop.
Breakpoints doesn't stop anywhere else but a few places like *db.py. *I 
suppose
default.py is run time compiled and does not works with source code.
7) in Eclipse point to root/*app - right click Debug As,* Properties - find 
the directory paths - add root/*app*/applications/*myapp *- so Eclipse can 
find your app source to stop in debugging.
8) run * Debug As,* Eclipse fires, your debugger stops at 
def *MyHook()*: 
  pass --
click with F5 to follow the link and you are in default.py, from there with 
F5 you can follow your code in default.py.


Running with the debugger you can see where your code can be optimized. For 
example I mentioned 0.py, db.py, all files under models/ are loaded every 
time a link is visited. 
This slows down the execution and you will need to place everything db GAE 
related in db.py
and 0.py. In 0.py you place the constants, in db.py - GAE db stuff. This is 
the most code separating wise can be made under web2py. Otherwise loading 
all these /models files every time slows things up in real usage mode.





Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
if you look at the code at /gluon/tools.py, line 2235, in 
request_reset_password it is *settings.server*, not 
*mail.settings.server. *Also if set it up in 0.py it is available globally 
I suppose?
*
*
The line 327-328: is looking for *settings.server.* if not isinstance(self.*
settings.server*, str):
raise Exception('Server address not specified')


[web2py] sub-domain in routers?

2011-11-28 Thread Constantine Vasil
Is it possible to have sub-domain in routers?

webapp2 has this capability.


[web2py] Implementing tornado chat server with web2py

2011-11-28 Thread Saurabh Kumar
 Hi,

We are planning to implement an omegle.com like chatting server. We have 
decided to use webpy for the same. Which out of tornado or twisted 
framework would be advisable? Is there any other framework especially 
suitable for this particular application?


Thanks

Saurabh


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Bruno Rocha
Look here: http://code.google.com/p/web2py/source/browse/gluon/tools.py#327

This is inside the Mail.send method:

 if not isinstance(self.settings.server, str):

 raise Exception('Server address not specified')

it refers as *self.settings.server.* In Python 'self' is the convention to
refer the instance of a class
So, when having an instance of Mail class

from gluon.tools import Mail
 mail = Mail() # here we create the instance of Mail class


Now you do not have to use 'self' you have to use your instance to refer to
the instance attributes..

mail.settings.server = 'gae'


Re: [web2py] sub-domain in routers?

2011-11-28 Thread Bruno Rocha
Look http://code.google.com/p/web2py/source/browse/router.example.py#23

 domains = {   domain.com : app,
  x.domain.com : appx,
   },
On Mon, Nov 28, 2011 at 5:07 PM, Constantine Vasil thst...@gmail.comwrote:

 Is it possible to have sub-domain in routers?

 webapp2 has this capability.




-- 

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


Re: [web2py] sub-domain in routers?

2011-11-28 Thread Constantine Vasil
and that is great! we need it in the book!

Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
Probably the name was was changed in trunk, my code used to work in the 
stable version.

If I add settings.server = 'gae' in the 0.py, would it be available 
globally to Mail()?


Re: [web2py] sub-domain in routers?

2011-11-28 Thread Anthony
On Monday, November 28, 2011 2:31:16 PM UTC-5, Constantine Vasil wrote:

 and that is great! we need it in the book!


It's in router.example.py 
(http://code.google.com/p/web2py/source/browse/router.example.py), which is 
linked directly from the book. But yes, the parameter-based rewrite system, 
in particular, could use more coverage in the book.


[web2py] Re: Implementing tornado chat server with web2py

2011-11-28 Thread Massimo Di Pierro
Look into this:

http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_messaging.py

I would go with tornado or gevent. They seems much simpler then
twisted and more in line with the web2py keep-it-simple phylosophy.

Massimo

On Nov 28, 1:06 pm, Saurabh Kumar saurabh.ca...@gmail.com wrote:
  Hi,

 We are planning to implement an omegle.com like chatting server. We have
 decided to use webpy for the same. Which out of tornado or twisted
 framework would be advisable? Is there any other framework especially
 suitable for this particular application?

 Thanks

 Saurabh


[web2py] Re: routes.py to remove default from url

2011-11-28 Thread Constantine Vasil
myapps = ['app'] # assuming your app is called app

if my app name is mycoolapp it usually is the domain I host it:
mycoolapp.com

so I want to access it like:

mycoolapp.com/contact_us
mycoolapp.com/terms
etc.

How to do that efficiently? I am hard coding the link to redirect to 
default counterpart. Also running on GAE I see in the logs all routes 
definitions execute every time I hit a page. Could it they be precompiled? 
There is a no need to be dynamic at run-time?

Also I have this issue:

for example I am here:
mycoolapp.com, then hit the mycoolapp.com/contact_us
and routes forward to default/contact_us which is good.
Then after filling the form in mycoolapp.com/contact_us
I want to redirect back to mycoolapp.com, I have a hard coded
rule in routes which redirects '/' to default/index. I got the redirect
but at the browser address I still see mycoolapp.com/contact_us,
it should be mycoolapp.com. If I do browser refresh this causes 
the browser to go back to mycoolapp.com/contact_us.

How to solve it?












[web2py] Re: Implementing tornado chat server with web2py

2011-11-28 Thread Anthony
Are you aware of comet_messaging.py 
(http://code.google.com/p/web2py/source/browse/gluon/contrib/comet_messaging.py)
 
-- it uses Tornado? Here's a three part tutorial on using it with Socket.IO 
for a chat 
application: 
http://greg.thehellings.com/2011/04/web2py-websockets-and-socket-io-part-i-basic-display/

Anthony

On Monday, November 28, 2011 2:06:47 PM UTC-5, Saurabh Kumar wrote:

  Hi,

 We are planning to implement an omegle.com like chatting server. We have 
 decided to use webpy for the same. Which out of tornado or twisted 
 framework would be advisable? Is there any other framework especially 
 suitable for this particular application?


 Thanks

 Saurabh



Re: [web2py] sub-domain in routers?

2011-11-28 Thread Constantine Vasil
Thank you Antony - parameter system is what  a real world will use so 
definitely it needs more examples.

[web2py] Re: routes.py to remove default from url

2011-11-28 Thread Anthony
Add default_application = 'mycoolapp' to the BASE router to remove the 
appname from the URL.

On Monday, November 28, 2011 2:56:31 PM UTC-5, Constantine Vasil wrote:

 myapps = ['app'] # assuming your app is called app

 if my app name is mycoolapp it usually is the domain I host it:
 mycoolapp.com

 so I want to access it like:

 mycoolapp.com/contact_us
 mycoolapp.com/terms
 etc.

 How to do that efficiently? I am hard coding the link to redirect to 
 default counterpart. Also running on GAE I see in the logs all routes 
 definitions execute every time I hit a page. Could it they be precompiled? 
 There is a no need to be dynamic at run-time?

 Also I have this issue:

 for example I am here:
 mycoolapp.com, then hit the mycoolapp.com/contact_us
 and routes forward to default/contact_us which is good.
 Then after filling the form in mycoolapp.com/contact_us
 I want to redirect back to mycoolapp.com, I have a hard coded
 rule in routes which redirects '/' to default/index. I got the redirect
 but at the browser address I still see mycoolapp.com/contact_us,
 it should be mycoolapp.com. If I do browser refresh this causes 
 the browser to go back to mycoolapp.com/contact_us.

 How to solve it?












[web2py] Python27.dll?

2011-11-28 Thread mikech
I know that we can run the source version under 2.7 by specifying the 
version at the command line.  Is it possible to replace the 
Python25.dll in the binary distribution with the 2.7 dll and have it use 
this instead?   Also where would I find this file?


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Bruno Rocha
On Mon, Nov 28, 2011 at 5:34 PM, Constantine Vasil thst...@gmail.comwrote:

 If I add settings.**server = 'gae' in the 0.py, would it be available
 globally to Mail()?


No.

every variable defined in models are only global to another models,
controllers and views.


-- 

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


Re: [web2py] Re: Problems with forms and firefox

2011-11-28 Thread Bruno Rocha
I am trying to think it is a problem with web2py session vars in
current.session.


[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Anthony
You might find it useful to run web2py in a shell so you can experiment and 
see what objects and HTML are generated with forms.

python web2py.py -S myapp/default -M -N

That will start a Python shell in the environment of the default.py 
controller of myapp (including running the models). You can then call any 
of the functions in default.py to inspect their output, as well as access 
the entire web2py API to experiment. To see the html generated by a helper 
object (including a FORM or SQLFORM object), just 'print' it (or call it's 
.xml() method). For example:

 form = SQLFORM.factory(Field('primary_email_choice_new', 
widget=SQLFORM.widgets.radio.widget,
requires=IS_IN_SET({'Work' : 'Work', 'Home' : 'Home'}), default='Work'))
 print form
form action= enctype=multipart/form-data method=posttabletr 
id=no_table_primary_email_ch
oice_new__rowtd class=w2p_fllabel 
for=no_table_primary_email_choice_new id=no_table_primar
y_email_choice_new__labelPrimary Email Choice New: /label/tdtd 
class=w2p_fwtable class=s
tring id=no_table_primary_email_choice_new 
name=primary_email_choice_newtrtdinput id=pri
mary_email_choice_newHome name=primary_email_choice_new type=radio 
value=Home /label for=p
rimary_email_choice_newHomeHome/label/td/trtrtdinput 
checked=checked id=primary_emai
l_choice_newWork name=primary_email_choice_new type=radio value=Work 
/label for=primary_em
ail_choice_newWorkWork/label/td/tr/table/tdtd 
class=w2p_fc/td/trtr id=submit_r
ecord__rowtd class=w2p_fl/tdtd class=w2p_fwinput type=submit 
value=Submit //tdt
d class=w2p_fc/td/tr/table/form

Anthony

On Monday, November 28, 2011 1:46:57 PM UTC-5, Constantine Vasil wrote:

 It depends from the development environment. I am working with GAE and it 
 is very tricky to debug when using GAE.

 Controller will be fine for me after I generate the HTML to see what it is 
 doing.
 To understand it how it works we need more examples in the doc.

 Before that I need to work with the debugger to see what happens.
















Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
would this do it?

def user(): 

 from gluon.tools import Mail
 mail = Mail()
mail.settings.server = gae

return dict(form=auth(), auth=auth)


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Bruno Rocha
You have two options

def user():
 from gluon.tools import Mail
 mail = Mail()
 mail.settings.server = gae
* auth.settings.mailer = mail # needs to bind mail to auth*

 return dict(form=auth(), auth=auth)

or in models (or anywhere)

 mail=auth.settings.mailer
 mail.settings.server = 'gae'


[web2py] Re: GAE and 'cannot set memcache' error

2011-11-28 Thread howesc
SDK or production environment?  how are you calling it?  if production, is 
it an intermittent failure?  (occasionally the memcache service does go 
down)


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
Here is what I do have in *db.py* already:
mail=auth.settings.mailer
mail.settings.server = settings.email_server

are already set up from 0.py where I have:
settings.email_server = 'gae'
so they are already set up.

Please not again that on GAE logs I have this 
information which is referring to *settings.server,*
not *mail.settings.server* 

The line 327-328 in gluon/tools.py: is looking for *settings.server.* if 
not isinstance(self.*settings.server*, str):
raise Exception('Server address not specified')

==

db.define_table('auth_user',
Field('username', type='string',
  label=T('Username')),
Field('first_name', type='string',
  label=T('First Name')),
Field('last_name', type='string',
  label=T('Last Name')),
Field('email', type='string',
  label=T('Email')),
Field('password', type='password',
  readable=False,
  label=T('Password')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
Field('registration_key',default='',
  writable=False,readable=False),
Field('reset_password_key',default='',
  writable=False,readable=False),
Field('registration_id',default='',
  writable=False,readable=False),
format='%(username)s',
migrate=settings.migrate)


db.auth_user.first_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.auth_user.last_name.requires = 
IS_NOT_EMPTY(error_message=auth.messages.is_empty)
db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key)
db.auth_user.username.requires = IS_NOT_IN_DB(db, db.auth_user.username)
db.auth_user.registration_id.requires = IS_NOT_IN_DB(db, 
db.auth_user.registration_id)
db.auth_user.email.requires = 
(IS_EMAIL(error_message=auth.messages.invalid_email),
   IS_NOT_IN_DB(db, db.auth_user.email))
auth.define_tables(migrate = settings.migrate) 

## configure email
mail=auth.settings.mailer
mail.settings.server = settings.email_server
mail.settings.sender = settings.email_sender
mail.settings.login = settings.email_login

## configure auth policy
auth.settings.registration_requires_verification = False
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

#auth.settings.login_next = URL('index')
auth.settings.login_next = '/'

#auth.settings.logout_next = URL('index')
auth.settings.logout_next = '/'

#auth.settings.profile_next = URL('index')
auth.settings.profile_next =  '/'

#auth.settings.register_next = URL('user', args='login')
auth.settings.register_next = '/'

#auth.settings.retrieve_username_next = URL('index')
auth.settings.retrieve_username_next = '/'

#auth.settings.retrieve_password_next = URL('index')
auth.settings.retrieve_password_next = '/'

#auth.settings.change_password_next = URL('index')
auth.settings.change_password_next = '/'

#auth.settings.request_reset_password_next = URL('user', args='login')
auth.settings.request_reset_password_next = '/'

#auth.settings.reset_password_next = URL('user', args='login')
auth.settings.reset_password_next = '/'

#auth.settings.verify_email_next = URL('user', args='login')
auth.settings.verify_email_next = '/'



[web2py] Re: GAE + Web2py

2011-11-28 Thread howesc

email on GAE:
 * note that the sender *must* be an email address that at least has access 
to the GAE console.  so you must invite the sender, even if it is 
noreply.  check your logs you will see errors if this is your problem.
 * in db.py:

mail.settings.server = 'gae'  # your SMTP server
mail.settings.sender='som...@domain.com' # your email

Load time:
 * check what your models are doing, they get re-executed on each request.  
slow things in the model files take a long time
 * careful with the web2py shortcuts that cause queries.  remember that if 
you have a row that has a foreign key and you do row.foreign_key.name you 
are running a query.  if you have 100 such rows that is 100 queries.  this 
can take a long time
 * careful that your grid is not doing excess queries to display data 
pretty (ie using names instead of IDs in the grid)
 * memcache is your friend when the data is pickleable.

i haven't used the other items so i have no comments.  sorry. :(


Re: [web2py] GAE: request_reset_password - Exception: Server address not specified

2011-11-28 Thread Constantine Vasil
No It didn't work - got the same error.

Re: [web2py] Python27.dll?

2011-11-28 Thread Vasile Ermicioi
download web2py source distribution  and use http://www.py2exe.org/ to
create a web2py for python2/7


[web2py] How place the standard Register form in my front page?

2011-11-28 Thread Constantine Vasil
I want to place the standard Register form in my front page.

the front page will have a text Join Us, below the standard Register form 
plus
the links to Forgot your username? Forgot your password? :

How to do that?

mydomain.com front page:
=
Join Us:

Username
  First Name:
  Last Name:
  Email:
  Password:

 Sign Up
 
  Forgot your username?
 Forgot your password?
=



[web2py] computed field: update and images

2011-11-28 Thread Pepe Araya
Hi!!

I have 3 computed fields that call a resize_image function to make 3 
versions of a uploaded image.
The definition of one of these fields:

Field('foto_portada_detalle', 'upload',
uploadfolder=request.folder+'static/uploads/actividades',
compute=lambda r: resize_image(r['foto_portada'], (200,200), 'detalle', 
'actividades'),
autodelete=True,
readable=False)


When I delete the record, all is ok and the images are deleted but when I 
update the record with another image one good thing occur: all the other 3 
versions get updated BUT one bad thing occur too: the old images stay on 
the disk although autodelete=True

I think that the resize_image function need to manage the delete of old 
images but I don't know how. can you help me? Thank a lot!

The function:

def resize_image(image, size, path, folder, rotate=0):
import os.path

from PIL import Image, ImageOps

if image:
try:
img = Image.open('%sstatic/uploads/%s/%s' % (request.folder, 
folder, image))
img = img.convert(RGB)
img = ImageOps.fit(img, size, Image.ANTIALIAS, centering=(0.5, 
0.5))
#img.resize(size, Image.ANTIALIAS)
img = img.rotate(rotate)
root, ext = os.path.splitext(image)
filename = '%s_%s%s' %(root, path, ext)
img.save('%sstatic/uploads/%s/%s' % (request.folder, folder, 
filename))
return filename
except Exception, e:
return e
else:
return None


[web2py] Re: How place the standard Register form in my front page?

2011-11-28 Thread Anthony
auth.register() produces a registration form -- so you could return that to 
the view and use it as is, or use it to generate a custom form layout.

For the other two links, look at the output of auth.navbar() (which is 
included in the header of the 'welcome' app).

See http://web2py.com/book/default/chapter/08#Authentication.

Anthony

On Monday, November 28, 2011 4:51:12 PM UTC-5, Constantine Vasil wrote:

 I want to place the standard Register form in my front page.

 the front page will have a text Join Us, below the standard Register form 
 plus
 the links to Forgot your username? Forgot your password? :

 How to do that?

 mydomain.com front page:
 =
 Join Us:

 Username
   First Name:
   Last Name:
   Email:
   Password:

  Sign Up
  
   Forgot your username?
  Forgot your password?
 =



[web2py] Re: Book typo

2011-11-28 Thread Andrew

Thanks.


On Nov 28, 7:10 pm, Johann Spies johann.sp...@gmail.com wrote:
 Inhttp://www.web2py.com/book/default/chapter/06?search=form.process

 ret = db(query).vaidate_and_update(field='value')

 should probably be

 ret = db(query).validate_and_update(field='value')

 Regards
 Johann
 --
 Because experiencing your loyal love is better than life itself,
 my lips will praise you.  (Psalm 63:3)


[web2py] Re: simulate a sub-domain from localhost?

2011-11-28 Thread Pepe Araya
I think that you can make it through the HOSTS file of your system

127.0.0.1:8000 site1.web2py.local
127.0.0.1:8000 site2.web2py.local




[web2py] Re: How place the standard Register form in my front page?

2011-11-28 Thread Constantine Vasil
Thank I did it but there is this issue:

Got a message next to 
Verify Password: please input your password again

How to prevent this and also how to place 
please input your password again under 
Verify Password input field?





[web2py] Re: fedora, pip, web2py, virtualenv, and mysql

2011-11-28 Thread Christopher Steel
To change db backends you need to edit the db.py file and that should do it.



[web2py] Re: How place the standard Register form in my front page?

2011-11-28 Thread Anthony
You might try setting auth.settings.formstyle = 'divs'. You can also use 
the usual custom form functionality -- the second password field widget is 
form.custom.widget.password_two.

Note, I think the auth.register() function does some automatic redirecting 
if the user is already logged in, so you might want to make sure the 
function is called (and therefore the form displayed) only for non-logged 
in users. Otherwise, you could simply build your own registration form (the 
usual way) based on the db.auth_user table.

Anthony

On Monday, November 28, 2011 5:34:04 PM UTC-5, Constantine Vasil wrote:

 Thank I did it but there is this issue:

 Got a message next to 
 Verify Password: please input your password again

 How to prevent this and also how to place 
 please input your password again under 
 Verify Password input field?





[web2py] Re: How place the standard Register form in my front page?

2011-11-28 Thread Constantine Vasil
make sure the function is called (and therefore the form displayed) only 
for non-logged in users. 

This I do but the message next to 
Verify Password: please input your password again
is showing up when the form builds up. It does not 
have to show. It seems some code is executed
when showing it up. How to prevent that?

Also - how to set up the next link where the user goes
after register? Now it goes to profile but I want to go 
to my own My Info page. How to do that?


[web2py] Re: GAE and 'cannot set memcache' error

2011-11-28 Thread Constantine Vasil
It is in GAE production. Things are always different on the cloud.
Everything can go down.

 (occasionally the memcache service does go down)
This confirms it. The issue is big because it happens on Register
or Login form and my users cannot do it.

I use memcache a lot but if it is down there has to be a way to 
check it and use it if on.

How to do it?






[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Constantine Vasil
Hi Anthony,

Yes I learned the shell system and it is excellent.

But when I added the GAE dependencies it broke up.
There is no way to tell it where google.appengine.ext
is located to use the GAE classes. I spend a lot of time
to figure out but it is not worth partly because via the 
browser bigger files are slow to load and work with 
and also there are bugs in the editor - for example 
it shows a line but actually edits the line below (sometimes).

So Eclipse+PyDev environment is better suited for bugger 
projects. Also I want this combination for the debugger mostly.
made a separate post for setting up in this environment
especially when using GAE. When I add logging.info
it shows up in the integrated environment without a need
to place debugging points everywhere.

It is very tricky bit now it works excellent.

BUT web2py is hats down the best system for what is designed
for. Just excellent.







[web2py] Re: How to preselect radio check box with checked=yes using SQLFORM.factory?

2011-11-28 Thread Constantine Vasil
bugger projects = bigger projects ;)

(there is a unintentional sublime message here)


[web2py] Re: routes.py to remove default from url

2011-11-28 Thread Constantine Vasil
but I am using the parameter system which don't has this option.

[web2py] Re: routes.py to remove default from url

2011-11-28 Thread lyn2py
Constantine, Use Anthony's method (post above) and you should be able
to resolve your issue. Comment out your current parameter system and
try it

On Nov 29, 7:40 am, Constantine Vasil thst...@gmail.com wrote:
 but I am using the parameter system which don't has this option.


  1   2   >