[web2py] onaccept vs next (auth.register)

2012-08-12 Thread lyn2py
Hi, 

I want to customize the user registration, and encountered "onaccept" vs 
"next". 

   1. May I know what is the difference between the two?
   2. I want the user to be redirected to another form upon 
*successful*registration (and logged in), will "next" overwrite "onaccept"?

Thanks!

-- 





[web2py] authentification,registration fails

2012-08-12 Thread ctrlSoft
hi, my web2py app is hosted on webfaction. everything worked fine. about 3 
weeks ago authentification,registration stopped working. first in chrome 
not worked after a few days in firefox  
http://agsystem.md/welcome/default/user/register?_next=/welcome/default/index
 
does anybody has the same problem?

-- 





[web2py] Re: Trouble with pickling session

2012-08-12 Thread Web2py Newbie

It seems to be caused by the presence of:
nlIter = re.finditer('\n',self.raw) 
in one of the methods of one of the class methods. 

So, I moved the work to a separate function (not method):
def initNewLines(self):
self.newLines = findNewLines(self.raw)


def findNewLines( searchIn):
''' given a string return a list with the indices of each \n character 
'''
result = []
for nl in  re.finditer('\n', searchIn):
result.append(nl.start) 
return result

But it still doesn't seem to work.  If I change it to self.newlines = [], 
web2py pickles the session fine. 
confused... 

-- 





[web2py] Re: Requiring password on registration

2012-08-12 Thread Yarin
db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5))
did not fix it on it's own, but
db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key,min_length
=4)
did fix it. Thanks a lot for your help.

On Saturday, August 11, 2012 11:42:35 PM UTC-4, Anthony wrote:
>
> Note also that it DOES allow logging in with no password subsequent to the 
>> registration.
>
>
> Right, it looks like login will allow no password if password length is 
> enforced only by CRYPT (it actually overrides the CRYPT min_length 
> attribute). I don't think it will override IS_STRONG or IS_LENGTH, though.
>  
>
>> Adding the requires.insert(0,IS_LENGTH(minsize=5)) has no effect.
>
>
> I'm not able to unpack/install the app you attached (seems to be 
> corrupted), but when I insert IS_LENGTH in my own test app as you have 
> above, it works fine. Would have to see your code to figure out what's 
> wrong.
>
> Anthony
>

-- 





[web2py] 500 Error at http://www.web2py.org/

2012-08-12 Thread Terrence Brannon
this needs to be fixed pronto.

-- 





Re: [web2py] 500 Error at http://www.web2py.org/

2012-08-12 Thread Marin Pranjić
You can use http://web2py.com/

Marin

On Sun, Aug 12, 2012 at 1:50 PM, Terrence Brannon wrote:

> this needs to be fixed pronto.
>
> --
>
>
>
>

-- 





[web2py] Re: onaccept vs next (auth.register)

2012-08-12 Thread Alan Etkin
> May I know what is the difference between the two?

Not sure in this case, but for crud, *onaccept* is "... *a function* to be 
called after the form submission is accepted
and acted upon, but before redirection. ...", and *next* is "...*the URL*to 
redirect to after success ..."

> will "next" overwrite "onaccept"

Next and onaccept should not overwrite each other, because they do 
different things (code to run after form submission and set redirection in 
response)

-- 





Re: [web2py] 500 Error at http://www.web2py.org/

2012-08-12 Thread Bruno Rocha
I never knew about web2py.org (what is that? is it a web2py foundation web
site?)

-- 





Re: [web2py] 500 Error at http://www.web2py.org/

2012-08-12 Thread Marin Pranjić
According to web.archive.org:

http://web.archive.org/web/20100829120211/http://www.web2py.org/

It just redirects to web2py.com

Marin

On Sun, Aug 12, 2012 at 2:24 PM, Bruno Rocha  wrote:

> I never knew about web2py.org (what is that? is it a web2py foundation
> web site?)
>
> --
>
>
>
>

-- 





[web2py] Re: AttributeError: 'Rows' object has no attribute 'append'

2012-08-12 Thread Alan Etkin

>
> When I comment out row.append(row) and return rows and morerows rows 
> contains 3 records and morerows 5. Why doesn't this work?
>
> If you want a unified Rows class instance to be handled by the action 
view, I think that you need a complete db query as input before calling 
.select, because, I'm almost sure that adding rows on the fly to a Rows 
instance is not supported.

An alternative would be to use a list object as result instead of Rows to 
add the Row instances, in that case you will be able to do .append(row).

-- 





[web2py] Re: Electronic voting anybody?

2012-08-12 Thread Alan Etkin
I like it. I'd consider as a new feature (if not implemented yet) the 
option of submitting a new vote replacing the previous before deadline.

El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro escribió:
>
> Demo service:
>
>https://tests.web2py.com/evote/default/index
>
> Source:
>
>https://github.com/mdipierro/evote
>
> I could use some help checking it. Specifically usability and security.
>
> Massimo
>

-- 





Re: [web2py] Re: Electronic voting anybody?

2012-08-12 Thread António Ramos
i have a phone voting system with web2py and asterisk

http://www.youtube.com/watch?v=vCNoAyKN86o



2012/8/12 Alan Etkin 

> I like it. I'd consider as a new feature (if not implemented yet) the
> option of submitting a new vote replacing the previous before deadline.
>
> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro
> escribió:
>
>> Demo service:
>>
>>https://tests.web2py.com/evote/default/index
>>
>> Source:
>>
>>https://github.com/mdipierro/evote
>>
>> I could use some help checking it. Specifically usability and security.
>>
>> Massimo
>>
> --
>
>
>
>

-- 





[web2py] Re: onaccept vs next (auth.register)

2012-08-12 Thread lyn2py
Thanks Alan, on 

> will "next" overwrite "onaccept"

I meant to use onaccept as a redirect to another form.
Will the redirect in "next" overwrite onaccept's redirect?

On Sunday, August 12, 2012 8:22:05 PM UTC+8, Alan Etkin wrote:
>
> > May I know what is the difference between the two?
>
> Not sure in this case, but for crud, *onaccept* is "... *a function* to 
> be called after the form submission is accepted
> and acted upon, but before redirection. ...", and *next* is "...*the URL*to 
> redirect to after success ..."
>
> > will "next" overwrite "onaccept"
>
> Next and onaccept should not overwrite each other, because they do 
> different things (code to run after form submission and set redirection in 
> response)
>
>

-- 





[web2py] Re: Trouble with pickling session

2012-08-12 Thread Web2py Mostly Newbie
Replaced method by: 
def initNewLines(self):
self.newlines = []
for i in range(len(self.raw)):
if self.raw[i:i+1]=='\n':
self.newlines.append(i)

And no more complaints from web2py. 
Would like to know what the problem is though. 

-- 





[web2py] Re: onaccept vs next (auth.register)

2012-08-12 Thread Anthony
On Sunday, August 12, 2012 9:51:20 AM UTC-4, lyn2py wrote:
>
> Thanks Alan, on 
>
> > will "next" overwrite "onaccept"
>
> I meant to use onaccept as a redirect to another form.
> Will the redirect in "next" overwrite onaccept's redirect?
>

The call to onaccept happens before the redirect to "next". If the onaccept 
function itself calls redirect(), that will immediately end the current 
request and do the redirect, so the redirect to "next" will not happen in 
that case. Technically, nothing is being "overwritten", but yes, onaccept 
will override "next" (assuming onaccept does a redirect).

Anthony

-- 





[web2py] Re: Trouble with pickling session

2012-08-12 Thread Anthony
Are you able to pickle the object outside of web2py (i.e., is the object 
generally pickleable, but fails only in web2py)?

http://docs.python.org/library/pickle.html#what-can-be-pickled-and-unpickled

Anthony

On Sunday, August 12, 2012 9:59:15 AM UTC-4, Web2py Mostly Newbie wrote:
>
> Replaced method by: 
> def initNewLines(self):
> self.newlines = []
> for i in range(len(self.raw)):
> if self.raw[i:i+1]=='\n':
> self.newlines.append(i)
>
> And no more complaints from web2py. 
> Would like to know what the problem is though. 
>

-- 





[web2py] Re: AttributeError: 'Rows' object has no attribute 'append'

2012-08-12 Thread Anthony
Instead of rows.append(morerows), you can do:

rows &= morerows

rows1 & rows2 will append rows2 to rows1, and rows1 | rows2 does the same 
but removes from rows2 any duplicates of rows that appear in rows1. In 
addition to & and |, you can also use &= and |=, as in the above example.

This information is top secret, so please don't tell anyone. ;-)

Anthony

On Sunday, August 12, 2012 2:46:52 AM UTC-4, Annet wrote:
>
> I have the following function:
>
> def classes():
> response.view='site/classes.html'
> alert=''
> if session[request.args(0)].tab_1:
> weekday=request.now.weekday()+1
> 
> query1=db((db.Timetable.nodeID==session[request.args(0)].id)&(db.Timetable.dayID==
> db.Day.id)&\
> 
> (((db.Timetable.dayID==weekday)&(db.Timetable.startTime>request.now))|(db.Timetable.dayID>weekday)))
> if int(query1.count())<8:
> i=query1.count()
> rows=query1.select(db.Timetable.ALL,db.Day.name
> ,orderby=db.Timetable.dayID|db.Timetable.startTime,limitby=(0,i))
> 
> morerows=db((db.Timetable.nodeID==session[request.args(0)].id)&(db.Timetable.dayID==
> db.Day.id)&(db.Timetable.dayID>=1))\
> .select(db.Timetable.ALL,db.Day.name
> ,orderby=db.Timetable.dayID|db.Timetable.startTime,limitby=(0,8-i))
> for row in morerows:
> rows.append(row)
> else:
> rows=query1.select(db.Timetable.ALL,db.Day.name
> ,orderby=db.Timetable.dayID|db.Timetable.startTime,limitby=(0,8))
> if not rows:
> response.flash='Geen informatie over lessen beschikbaar'
> alert='alert-info' # to set alert class for flash
> return dict(rows=rows,alert=alert)
>
> When I run this function I get the following error:
>
> Traceback (most recent call last):
>   File "/Library/Python/2.5/site-packages/web2py/gluon/restricted.py", line 
> 205, in restricted
> exec ccode in environment
>   File 
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/site.py"
>  , 
> line 190, in 
>   File "/Library/Python/2.5/site-packages/web2py/gluon/globals.py", line 173, 
> in 
> self._caller = lambda f: f()
>   File 
> "/Library/Python/2.5/site-packages/web2py/applications/bootstrap/controllers/site.py"
>  , 
> line 146, in classes
> rows.append(row)
> AttributeError: 'Rows' object has no attribute 'append'
>
> When I comment out row.append(row) and return rows and morerows rows 
> contains 3 records and morerows 5. Why doesn't this work?
>
>
> Kind regards,
>
> Annet
>

-- 





Re: [web2py] Re: GAE datastore: how to unindex a field?

2012-08-12 Thread Felipe Meirelles
Just reviving this topic. Its not setable via index.yaml.

On Wednesday, May 16, 2012 1:07:10 PM UTC-3, howesc wrote:
>
> actually the question at hand here i think is whether or not web2py can 
> support indexed=False in the property constructor when defining GAE 
> models: 
>
> https://developers.google.com/appengine/docs/python/datastore/propertyclass 
>
> class Property(verbose_name=None, name=None, default=None, 
> required=False, validator=None, choices=None, indexed=True) 
>
> i was hoping there was a way to specify that in index.yaml so that we 
> didn't have to do extra work in the web2py GAE dal.  i have not found 
> that there is or is not a way to specify that in index.yaml. 
>
> cfh 
>
> On 5/16/12 8:39 , Wikus van de Merwe wrote: 
> > This is really a GAE question, not related to web2py. By default the 
> > indexes are set automatically when you run your app in dev environment 
> > depending on what queries you use. But you can do it manually to by 
> editing 
> > the index.yaml (above the #AUTOGENERATED line). On the next deploy the 
> > indexes will be updated. 
> > 
> > To disable the autogenerated indexes and test your index definitions, 
> you 
> > can run your app locally with: 
> > dev_appserver.py --require_indexes 
> > 
> > Read this article for more details: 
> > https://developers.google.com/appengine/articles/indexselection 
> > 
> > 
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-12 Thread Felipe Meirelles
Just a last update about the tests, my overall application cost (in dolars 
from appengine) droped 25% with the change, so, at least in appengine lazy 
models are a must.

On Wednesday, August 8, 2012 12:24:37 PM UTC-3, Jonathan Lundell wrote:
>
> On 8 Aug 2012, at 7:59 AM, Massimo Di Pierro 
> > 
> wrote:
>
> It is likely Django uses simplejson binary while web2py (for portability) 
> only ships with simplejson in pure python. This may be another performance 
> loss if you use json a lot. We need to fix this at the web2py level.
>
>
> This is fixed in at least some places in web2py, where we try to import 
> json from the standard library before falling back on python solutions. But 
> not everywhere, I think.
>

-- 





[web2py] Re: authentification,registration fails

2012-08-12 Thread Anthony
The problem appears to be with the session. When the form is submitted, the 
session cookies is sent with the request, but for some reason, web2py is 
creating a new session on the server instead of using the existing session 
(it's sending back a new session cookie with the response). web2py uses the 
session for CSRF protection during form submissions -- it compares the 
hidden _formkey value submitted with the form to the _formkey value stored 
in the session -- if they don't match, submission fails (with no 
error/feedback reported in the browser, as in this case). I'm not sure 
what's happening with the sessions/cookies on the server that would cause 
this -- perhaps others have some ideas. Have you made any changes to your 
code recently?

Anthony

On Sunday, August 12, 2012 6:56:10 AM UTC-4, ctrlSoft wrote:
>
> hi, my web2py app is hosted on webfaction. everything worked fine. about 3 
> weeks ago authentification,registration stopped working. first in chrome 
> not worked after a few days in firefox  
>
> http://agsystem.md/welcome/default/user/register?_next=/welcome/default/index
>  
> does anybody has the same problem?
>

-- 





[web2py] Re: authentification,registration fails

2012-08-12 Thread Massimo Di Pierro
Which version are you running? was the change caused by a change of your 
code or an upgrade?

On Sunday, 12 August 2012 05:56:10 UTC-5, ctrlSoft wrote:
>
> hi, my web2py app is hosted on webfaction. everything worked fine. about 3 
> weeks ago authentification,registration stopped working. first in chrome 
> not worked after a few days in firefox  
>
> http://agsystem.md/welcome/default/user/register?_next=/welcome/default/index
>  
> does anybody has the same problem?
>

-- 





[web2py] Re: Store DB connection information in private/ folder

2012-08-12 Thread lyn2py
You could create a any_name.py file in the private folder and then import 
the file into your model db.py

On Saturday, August 11, 2012 6:26:52 AM UTC+8, Gian Luca Decurtins wrote:
>
> Hi all
>
> How do I store the DB connection information (db = DAL(...)) in the 
> private/ folder?
>
> I would like to sync the application using Mercurial. The local DB 
> information should not be shared.
> The .hgignore file already includes "private/*".
>
> Cheers
> -Luca.
>

-- 





[web2py] Re: AttributeError: 'Rows' object has no attribute 'append'

2012-08-12 Thread Annet
Hi Anthony,

Thanks for your reply. Problem solved!

This information is top secret, so please don't tell anyone. ;-)
>

My lips are sealed ;-)


Best regards,

Annet. 

-- 





[web2py] Re: Requiring password on registration

2012-08-12 Thread Anthony
Note, this has now been fixed in trunk: 
http://code.google.com/p/web2py/source/detail?r=73b2137eb32e61abc47b491786643d46c199

On Saturday, August 11, 2012 11:21:12 PM UTC-4, Anthony wrote:
>
> Looks like a bug in the wizard:
>
> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key)
>
> should be:
>
> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_key,min_length
> =4)
>
> Actually, maybe the wizard should simply use auth.define_tables() instead 
> of manually creating the auth_user table -- would be easier to keep the 
> wizard consistent with standard apps.
>
> Anthony
>
> On Saturday, August 11, 2012 8:40:12 PM UTC-4, Yarin wrote:
>>
>> Anthony- I'm on 1.99.7 stable. Just tried it it with a fresh basic app 
>> and there the problem doesn't exist. However, if you use the *app wizard*, 
>> and just click through accepting all the defaults, it will recreate the 
>> issue. Note also that it DOES allow logging in with no password subsequent 
>> to the registration. Adding the requires.insert(0,IS_LENGTH(minsize=5)) has 
>> no effect.
>>
>> I've attached the app I just generated with the wizard on all default 
>> settings.
>>
>>
>> On Saturday, August 11, 2012 7:10:29 PM UTC-4, Anthony wrote:
>>>
>>> Anthony's correct- this is in Auth, but is not being respected: 
 settings.password_min_length = 4

>>>
>>> I just created a fresh app using trunk, and when I try to register 
>>> without a password, I get a "too short" error message on the password 
>>> field. What version of web2py are you using? Can we see your Auth related 
>>> code? Or maybe you can pack and attach a simple app that exhibits the 
>>> behavior.
>>>  
>>>
 Massimo - "For security reason it will not be accepted for logging 
 anyway." - Not sure what you meant but it registered me and logged me in 
 with an empty pass.

>>>
>>> By default, when you first register, you are automatically logged in 
>>> upon registration (this can be disabled). I think Massimo meant that 
>>> subsequently you will not be able to continue to login with an empty 
>>> password.
>>>  
>>>
 I also tried inserting:
 db.auth_user.password.requires.insert(0,IS_LENGTH(minsize=5))

>>>
>>> What happens whey you try that -- does it generate an error, or simply 
>>> allow you to register without a password?
>>>
>>> Anthony 
>>>
>>>

-- 





[web2py] Record versioning in web2py 2.0

2012-08-12 Thread apps in tables
Hi,

The feature of record versioning is very important to know the history of 
the record.

is it possible to go back and forward (in the history)?

is it possible to merge two histories of the same (logical data), and end 
up with one record ?

is it possible to have an offline application that will synch later, by 
merging the revisions?

Regards,

Ashraf


-- 





[web2py] trouble ... call a model and a module by the same name?

2012-08-12 Thread weheh
Am I going to get myself into big trouble if I call a model and a module by 
the same name?

-- 





[web2py] SQLFORM.grid: export csv/tsv, but only without hidden fields

2012-08-12 Thread Martin Weissenboeck
Hi,

nice feature to select cvs, htm, tcs when exporting from sqlform.grid.
But how to turn off the options "csv (hidden fields)" and "tsv (hidden
fields)" - I do not want my users to see all hidden fields.

Regards, Martin

-- 





[web2py] Re: authentification,registration fails

2012-08-12 Thread ctrlSoft
version is 1.99.7,  i have 10 websites (10 apps in applications/ folder) in 
4 from its, i periodicaly make chages, but i dont think that code from one 
application can affect all applications. in web2py code i didn't made any 
changes or upgrades. 

-- 





[web2py] Re: authentification,registration fails

2012-08-12 Thread Anthony
Any changes to the server software or configuration?

On Sunday, August 12, 2012 1:33:38 PM UTC-4, ctrlSoft wrote:
>
> version is 1.99.7,  i have 10 websites (10 apps in applications/ folder) 
> in 4 from its, i periodicaly make chages, but i dont think that code from 
> one application can affect all applications. in web2py code i didn't made 
> any changes or upgrades. 

-- 





[web2py] Re: trouble ... call a model and a module by the same name?

2012-08-12 Thread Anthony
I don't think so. Have you tried it?

On Sunday, August 12, 2012 1:11:05 PM UTC-4, weheh wrote:
>
> Am I going to get myself into big trouble if I call a model and a module 
> by the same name?

-- 





Re: [web2py] Re: Giving a talk promoting web2py over Django

2012-08-12 Thread Alec Taylor
Hi gm, they're mostly just things promoting my project; but happy to share.

http://goo.gl/gnyWP

On Sat, Aug 11, 2012 at 1:27 AM, gm01  wrote:
> Love to see your slides you presented.  Are they available somewhere on
> line?
> Thanks,
> gm
>
>
> On Wednesday, August 1, 2012 11:46:48 AM UTC-4, Alec Taylor wrote:
>>
>> Tonight I'm going to present my little social-network to a user-group.
>>
>> I'm going to show them my code, some slides, the website, the mobile apps
>> and tell them when Django isn't as good as web2py.
>>
>> Are there any particular features of web2py you would recommend I
>> highlight? - Also, are there any major drawbacks in Django that web2py has
>> that is easily advertisable?
>>
>> (I have a slide or two on this, but I'm sure as longtime users/developers
>> of web2py you'd have more to pitch-in)
>>
>> Thanks for all information,
>>
>> Alec Taylor
>
> --
>
>
>

-- 





[web2py] Re: Electronic voting anybody?

2012-08-12 Thread Christopher Steel
I really like this app Massimo. I will see if I have some time to play 
around with it this week.

Very nice,

C.

On Friday, August 10, 2012 5:24:10 PM UTC-4, Massimo Di Pierro wrote:
>
> Demo service:
>
>https://tests.web2py.com/evote/default/index
>
> Source:
>
>https://github.com/mdipierro/evote
>
> I could use some help checking it. Specifically usability and security.
>
> Massimo
>

-- 





[web2py] Random Records From Database

2012-08-12 Thread Hassan Alnatour
Dear ALL,

How Can i get random records for a database table ?

Best Regards,

-- 





[web2py] Connecting with database that has tables in it

2012-08-12 Thread Hassan Alnatour
Dear ALL ,

I have a database that is running under Microsoft SQL server ,  i want to 
connect to that database and use its tables , but i dont want to define any 
tables in my db.py , how can i do that ?

Best Regards,

-- 





Re: [web2py] trouble ... call a model and a module by the same name?

2012-08-12 Thread Bruno Rocha
No problem!

Thats how plugins works

models/plugin_foo.py
modules/plugin_foo.py

*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: web2py routes 
  Get a signature like this.

Click
here.



On Sun, Aug 12, 2012 at 2:11 PM, weheh  wrote:

> Am I going to get myself into big trouble if I call a model and a module
> by the same name?
>
> --
>
>
>
>

-- 





Re: [web2py] Random Records From Database

2012-08-12 Thread Bruno Rocha
db(db.table).select(orderby="")  # does not works on GAE

*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: web2py routes 
  Get a signature like this.

Click
here.



On Sun, Aug 12, 2012 at 3:38 PM, Hassan Alnatour  wrote:

> Dear ALL,
>
> How Can i get random records for a database table ?
>
> Best Regards,
>
> --
>
>
>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-12 Thread Bruno Rocha
That feature exists only for Mysql and Postgres under
scripts/extract_mysql_models.py

You can try to rewrite this for SQLserver, or you can use
db.executesql("RAW SQL")

 *Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: web2py routes 
  Get a signature like this.

Click
here.



On Sun, Aug 12, 2012 at 3:41 PM, Hassan Alnatour  wrote:

> Dear ALL ,
>
> I have a database that is running under Microsoft SQL server ,  i want to
> connect to that database and use its tables , but i dont want to define any
> tables in my db.py , how can i do that ?
>
> Best Regards,
>
> --
>
>
>
>

-- 





Re: [web2py] Re: Janrain fails (yes I did RTFM!) — too many values to unpack

2012-08-12 Thread Alec Taylor
Thanks, got it to work (well; beat that error anyway).

Forgot to run a git add on the relevant files.

On Sun, Aug 12, 2012 at 4:27 AM, Anthony  wrote:
> According to the ticket, the problem is with your janrain.key file. The code
> does a split on ":" and expects two values -- if it's complaining about too
> many values to unpack, you must have more than one colon in the string in
> that file. The file contents should look like:
>
> [domain]:[API key]
>
> Note, the domain is the name that comes before rpxnow.com (e.g., if your
> application domain is mysite.rpxnow.com, then the domain in the file should
> simply be "mysite").
>
> Anthony
>
>
> On Saturday, August 11, 2012 1:27:06 PM UTC-4, Alec Taylor wrote:
>>
>> Unfortunately I cannot get Janrain to work.
>>
>> (After Facebook and LinkedIn failed the regular way, I though to try with
>> Janrain)
>>
>> Here is my ticket: http://fiddle.jshell.net/AlecTaylor/xeLg6/show/
>>
>> Documentation: http://web2py.com/books/default/chapter/29/9
>>
>> The problem is on the `request` variable:
>>
>> auth.settings.login_form = RPXAccount(request,
>>...
>>)
>>
>>
>> Gives:  too many values to unpack
>>
>> How do I get Janrain working?
>>
>> Thanks for all suggestions,
>>
>> Alec Taylor
>
> --
>
>
>

-- 





[web2py] Janrain redirects successfully, but I'm not logged in?

2012-08-12 Thread Alec Taylor
After I click the login with facebook with Janrain I am redirected to my 
page.

Here is the response as an HAR file (Google Chrome): 
http://pastebin.com/62pj90Ku
[with hashes slightly modified to prevent abuse]

Feel free to attempt to login yourself at http://giantpicnic.com

What am I doing wrong?

Thanks for all suggestions,

Alec Taylor


-- 





[web2py] Re: Electronic voting anybody?

2012-08-12 Thread Massimo Di Pierro
Cannot be done without keeping some link between voter and vote and that is 
what this app tries hard to avoid by ensuring complete anonymity  even if 
the database were to be stolen.

On Sunday, 12 August 2012 08:00:12 UTC-5, Alan Etkin wrote:
>
> I like it. I'd consider as a new feature (if not implemented yet) the 
> option of submitting a new vote replacing the previous before deadline.
>
> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro 
> escribió:
>>
>> Demo service:
>>
>>https://tests.web2py.com/evote/default/index
>>
>> Source:
>>
>>https://github.com/mdipierro/evote
>>
>> I could use some help checking it. Specifically usability and security.
>>
>> Massimo
>>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-12 Thread Khalil KHAMLICHI
I once had to do the same, I created all the tables in my db.py with option :


migrate=False.

 a tedious task but with the DAL syntax it took only a few minutes, when
finised it worked like a charm (although I was on Windows)



On Sun, Aug 12, 2012 at 6:46 PM, Bruno Rocha  wrote:

> That feature exists only for Mysql and Postgres under
> scripts/extract_mysql_models.py
>
> You can try to rewrite this for SQLserver, or you can use
> db.executesql("RAW SQL")
>
>  *Bruno Cezar Rocha** - @rochacbruno*
> rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
> www.CursoDePython.com.br | www.rochacbruno.com.br
> Blog: web2py routes 
>   Get a signature like this.
> 
>  Click
> here.
>
>
>
> On Sun, Aug 12, 2012 at 3:41 PM, Hassan Alnatour <
> halna...@gardeniatelco.com> wrote:
>
>> Dear ALL ,
>>
>> I have a database that is running under Microsoft SQL server ,  i want to
>> connect to that database and use its tables , but i dont want to define any
>> tables in my db.py , how can i do that ?
>>
>> Best Regards,
>>
>> --
>>
>>
>>
>>
>
>  --
>
>
>
>

-- 





Re: [web2py] Re: Requiring password on registration

2012-08-12 Thread Yarin Kessler
Grazie

On Sun, Aug 12, 2012 at 12:09 PM, Anthony  wrote:

> Note, this has now been fixed in trunk:
> http://code.google.com/p/web2py/source/detail?r=73b2137eb32e61abc47b491786643d46c199
>
>
> On Saturday, August 11, 2012 11:21:12 PM UTC-4, Anthony wrote:
>>
>> Looks like a bug in the wizard:
>>
>> db.auth_user.password.requires = CRYPT(key=auth.settings.hmac_**key)
>>
>> should be:
>>
>> db.auth_user.password.requires = 
>> CRYPT(key=auth.settings.hmac_**key,min_length
>> =4)
>>
>> Actually, maybe the wizard should simply use auth.define_tables() instead
>> of manually creating the auth_user table -- would be easier to keep the
>> wizard consistent with standard apps.
>>
>> Anthony
>>
>> On Saturday, August 11, 2012 8:40:12 PM UTC-4, Yarin wrote:
>>>
>>> Anthony- I'm on 1.99.7 stable. Just tried it it with a fresh basic app
>>> and there the problem doesn't exist. However, if you use the *app wizard
>>> *, and just click through accepting all the defaults, it will recreate
>>> the issue. Note also that it DOES allow logging in with no password
>>> subsequent to the registration. Adding the requires.insert(0,IS_**LENGTH
>>> (minsize=5)) has no effect.
>>>
>>> I've attached the app I just generated with the wizard on all default
>>> settings.
>>>
>>>
>>> On Saturday, August 11, 2012 7:10:29 PM UTC-4, Anthony wrote:

 Anthony's correct- this is in Auth, but is not being respected:
> settings.password_min_length = 4
>

 I just created a fresh app using trunk, and when I try to register
 without a password, I get a "too short" error message on the password
 field. What version of web2py are you using? Can we see your Auth related
 code? Or maybe you can pack and attach a simple app that exhibits the
 behavior.


> Massimo - "For security reason it will not be accepted for logging
> anyway." - Not sure what you meant but it registered me and logged me in
> with an empty pass.
>

 By default, when you first register, you are automatically logged in
 upon registration (this can be disabled). I think Massimo meant that
 subsequently you will not be able to continue to login with an empty
 password.


> I also tried inserting:
> db.auth_user.password.requires**.insert(0,IS_LENGTH(minsize=5)**)
>

 What happens whey you try that -- does it generate an error, or simply
 allow you to register without a password?

 Anthony

  --
>
>
>
>

-- 





Re: [web2py] Connecting with database that has tables in it

2012-08-12 Thread Anthony
I think the newer 
extract_pgsql_models.pymight
 be a little better, and it can be tweaked to work with other db's. 
Note, if you have defined the models already in one app and simply want to 
access them from a different app, see 
http://web2py.com/books/default/chapter/29/6#Using-DAL-without-define-tables
.

Anthony

On Sunday, August 12, 2012 2:46:32 PM UTC-4, rochacbruno wrote:
>
> That feature exists only for Mysql and Postgres under 
> scripts/extract_mysql_models.py
>
> You can try to rewrite this for SQLserver, or you can use 
> db.executesql("RAW SQL")
>
>  *Bruno Cezar Rocha** - @rochacbruno*
> rocha...@gmail.com  | Mobile: +55 (11) 99210-8821
> www.CursoDePython.com.br | www.rochacbruno.com.br
> Blog: web2py routes 
>   Get a signature like this. 
> 
>  Click 
> here.
>
>
>
>
> On Sun, Aug 12, 2012 at 3:41 PM, Hassan Alnatour <
> haln...@gardeniatelco.com > wrote:
>
>> Dear ALL ,
>>
>> I have a database that is running under Microsoft SQL server ,  i want to 
>> connect to that database and use its tables , but i dont want to define any 
>> tables in my db.py , how can i do that ?
>>
>> Best Regards,
>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: authentification,registration fails

2012-08-12 Thread Michele Comitini
Is your session dir too full?  Make sure it gets cleaned periodically from
old session pickles.

mic
Il giorno 12/ago/2012 20:08, "Anthony"  ha scritto:

> Any changes to the server software or configuration?
>
> On Sunday, August 12, 2012 1:33:38 PM UTC-4, ctrlSoft wrote:
>>
>> version is 1.99.7,  i have 10 websites (10 apps in applications/ folder)
>> in 4 from its, i periodicaly make chages, but i dont think that code from
>> one application can affect all applications. in web2py code i didn't made
>> any changes or upgrades.
>
>  --
>
>
>
>

-- 





[web2py] Re: Scheduler: help us test it while learning

2012-08-12 Thread Niphlod
Uhm, serializing part of the output to the table every n seconds - with the 
output being a stream - would require a buffer/read/flush to update the 
scheduler_run table that I'm not sure it's feasible: I'll look into that 
but ATM I'm more concerned with other small issues of the Scheduler.
I'll definitely add to the feature-list the possibility to "recover" the 
output from TIMEOUTted tasks.
Aaanyway - for both issues - the logging module (and not some random 
prints) is the right tool for the job ^_^ .

BTW: as of now I saw only a queue/task processor for node.js that reports 
the "percentage" (i.e. every small bit of change "intra-execution" of the 
task in the workers "bubbles" up to the queue manager). Could you pinpoint 
me to a queue/task messaging implementation with this feature, if you saw 
this feature implemented already ? 

On Wednesday, August 8, 2012 3:25:13 PM UTC+2, Daniel Haag wrote:
>
> Hi Niphlod,
>
> thanks for the great work with the scheduler, I'm using it in a project 
> where it handles lots of big data imports into a database and the migration 
> to your version was without any problems.
>
> On thing catched my eye in the old version and it still seems to be a 
> "problem/missing feature" in the new one. When a long running process gets 
> executed and produces output (print etc.) this output is written to the 
> database only after the task was run (and finished). It would be really 
> great if the output gets written into the task table while the task runs as 
> this would be a possible feedback mechanism (and we would not need another 
> table etc. just for that) just thinking of a progress meter for example.
>
> What I really miss though is the output of the task when it produces a 
> timeout - nothing in the task table about the output...
>
> Daniel
>
>

-- 





[web2py] Re: Trouble with pickling session

2012-08-12 Thread Web2py Mostly Newbie


On Monday, August 13, 2012 12:35:05 AM UTC+10, Anthony wrote:
>
> Are you able to pickle the object outside of web2py (i.e., is the object 
> generally pickleable, but fails only in web2py)?
>
> Didn't occur to me, but have now tested it - Yes, I can pickle it with the 
re.finditer line. 


 

-- 





Re: [web2py] Re: web2py 2.0 almost done

2012-08-12 Thread Andrew
IE7 is looking "normal" !
Great work Angelo.  Thanks.


On Saturday, August 11, 2012 3:11:39 AM UTC+12, AngeloC wrote:
>
> Hi Massimo,
>
> I fixed compatibility with IE and reverted to a non mobile first approach. 
> I reverted because bootstrap is not mobile first (so we add too little) and 
>  for the sake of compatibility with IE.
>
> Patch is attached to issue 
> http://code.google.com/p/web2py/issues/detail?id=896 which I cannot 
> reopen.
>
> Hope this helps!
>
> Angelo
>
> 2012/8/10 Angelo Compagnucci >
>
>> Hi Massimo,
>>
>> I'm writing it right now to fix ie issues! Please be patient until fixed!
>>
>>
>> 2012/8/9 Massimo Di Pierro >
>>
>>> This may be ok but where do I get bootswatch_ie.css from?
>>>
>>>
>>> On Thursday, 9 August 2012 11:43:28 UTC-5, AngeloC wrote:
>>>
 Hi Massimo,

 I think I cannot complete the bootstrap/web2py css merging in time for 
 2.0, it's really a lot of work and I'm a bit busy these days.

 Btw, i'm fixing the bug I introduced with issue 896 and I want to share 
 a thought with you.

 Actually, there is no way to maintain a mobile first approach and make 
 it working on IE other than add something like this to the scaffolding:

 
 

 This will make speedier the whole css on not IE browsers because we 
 remove IE specific rules (smaller css), but has the downside to require an 
 extra http get on IE.

 What do you think?


 2012/8/9 Alec Taylor 

> It would be good to have OAuth working for web2py 2
>
> Facebook and LinkedIn still have some issues
>
> LinkedIn: https://groups.google.com/**forum/#!topic/web2py/**
> SbnQEnXEcOg
>
> Facebook: (will add bug report once I've gotten LinkedIn login to work)
>
> On Thu, Aug 9, 2012 at 11:25 PM, Massimo Di Pierro
>  wrote:
> > Can you help us fix the CSS?
> >
> >
> > On Thursday, 9 August 2012 00:29:58 UTC-5, Andrew wrote:
> >>
> >> Just a note on IE7 navbar behaviour:
> >>
> >> The Menu has taken a turn for the worse:
> >> Initially the Welcome App Sub Menus dissapeared in :  "welcome css 
> pathc,
> >> issue 896, thanks Angelo"
> >> They then returned in "fixed issue qith clicking on toplevel menus" 
> except
> >> all of the submenus are displayed when the menu first appears and 
> they are
> >> all on top of each other.
> >>
> >> The login options are still blue, and the space between the navbar 
> and
> >> "Welcome" isn't there.
> >> See screen shot.
> >>
> >>
> >> On Thursday, August 9, 2012 9:17:17 AM UTC+12, Massimo Di Pierro 
> wrote:
> >>>
> >>> more issues have been addressed. In order to fix an issue I had to
> >>> introduce a slight change of behavior and I am not sure what is 
> the best way
> >>> to handle it.
> >>>
> >>> If you login using a third party service (for example janrain using
> >>> facebook) and the service sends info about you, if web2py has 
> corresponding
> >>> fields in auth_user, it stores them. If you edit your profile, 
> logout,
> >>> change your facebook profile, login again using janrain, should 
> web2py keep
> >>> the current local profile or update it? The bug report suggested 
> that web2oy
> >>> should always give preference to the local profile.
> >>>
> >>> I changed web2py accordingly. In practice this change will 
> probably not
> >>> affect anybody because none of the services sends any information 
> stored by
> >>> auth_user.
> >>>
> >>> Yet, please check it.
> >>>
> >>> Massimo
> >>>
> >>>
> >>>
> >>> On Monday, 6 August 2012 23:33:48 UTC-5, Massimo Di Pierro wrote:
> 
>  Web2py 2.0 is almost done.
>  Please try the nightly build.
>  Let us know if it breaks anything.
> 
>  massimo
> >
> > --
> >
> >
> >
>
> --
>
>
>
>


 -- 
 Profile: 
 http://it.linkedin.com/in/**compagnucciangelo
  
>>>  -- 
>>>  
>>>  
>>>  
>>>
>>
>>
>>
>> -- 
>> Profile: http://it.linkedin.com/in/compagnucciangelo
>>  
>
>
>
> -- 
> Profile: http://it.linkedin.com/in/compagnucciangelo
>  

-- 





Re: [web2py] Re: Electronic voting anybody?

2012-08-12 Thread Changju
Hi Ramos.

Asterisk is really interesting to me. I'd like to know more about Asterisk.
What would it be good for beginner for understanding Asterisk?
(I had already read the articles on the Asterisk but I didn't get big 
picture of Asterisk.)
And could you explain how your phone voting system works?

Thanks,
Changju.

On Sunday, August 12, 2012 10:15:09 PM UTC+9, Ramos wrote:
>
> i have a phone voting system with web2py and asterisk
>
> http://www.youtube.com/watch?v=vCNoAyKN86o
>
>
>
> 2012/8/12 Alan Etkin >
>
>> I like it. I'd consider as a new feature (if not implemented yet) the 
>> option of submitting a new vote replacing the previous before deadline.
>>
>> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro 
>> escribió:
>>
>>> Demo service:
>>>
>>>https://tests.web2py.com/evote/default/index
>>>
>>> Source:
>>>
>>>https://github.com/mdipierro/evote
>>>
>>> I could use some help checking it. Specifically usability and security.
>>>
>>> Massimo
>>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





[web2py] Re: Triggering LOAD

2012-08-12 Thread Alan Etkin
Hi
Is it possible to trigger the LOAD component when a user clicks on 
something, or can it only be used when a page is first loaded?
I have been using the ajax function to do this but would prefer the extra 
flexibility of LOAD if it is possible.

web2py.js comes with this function:

web2py_component(action, target, timeout, times)

*action* is a url from where the html is loaded into the document
*target* is the id of the element to use as container
*timeout* and *times* are optional timing parameters to use repeated or 
continuous loading with time intervals

You can use something like this in the view:

=SCRIPT("jQuery().click(function(){web2py_component(,);});")

-- 





Re: [web2py] Re: Electronic voting anybody?

2012-08-12 Thread Khalil KHAMLICHI
Asterisk is a telephony platform that works incredibly well, its a bit
intimidating for starters but once you find out that there are mainly only
 two important files : extensions.conf, sip.conf to make it work things
become clearer.

On Mon, Aug 13, 2012 at 12:43 AM, Changju  wrote:

> Hi Ramos.
>
> Asterisk is really interesting to me. I'd like to know more about Asterisk.
> What would it be good for beginner for understanding Asterisk?
> (I had already read the articles on the Asterisk but I didn't get big
> picture of Asterisk.)
> And could you explain how your phone voting system works?
>
> Thanks,
> Changju.
>
> On Sunday, August 12, 2012 10:15:09 PM UTC+9, Ramos wrote:
>
>> i have a phone voting system with web2py and asterisk
>>
>> http://www.youtube.com/watch?**v=vCNoAyKN86o
>>
>>
>>
>> 2012/8/12 Alan Etkin 
>>
>> I like it. I'd consider as a new feature (if not implemented yet) the
>>> option of submitting a new vote replacing the previous before deadline.
>>>
>>> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro
>>> escribió:
>>>
 Demo service:


 https://tests.web2py.com/**evote/default/index

 Source:

https://github.com/mdipierro/**evote

 I could use some help checking it. Specifically usability and security.

 Massimo

>>> --
>>>
>>>
>>>
>>>
>>
>>  --
>
>
>
>

-- 





Re: [web2py] Triggering LOAD

2012-08-12 Thread Bruno Rocha
/views/default/index.html

 Click to load content1 
 Click to load content2 
 Click to load content3 
 Click to load content4 


  


$(function () {
   $('.load_content').on('click', function (e) {
elem = $(this);
url = elem.attr("data-url");
target = elem.attr("data-target");
web2py_ajax_page("GET", url, "", target)
return false; // e.preventDefault()
  });
})




*Bruno Cezar Rocha** - @rochacbruno*
rochacbr...@gmail.com | Mobile: +55 (11) 99210-8821
www.CursoDePython.com.br | www.rochacbruno.com.br
Blog: Sending emails with Python and
Gmail
  Get a signature like this.

Click
here.



On Fri, Aug 10, 2012 at 6:08 AM, Rob Goldsmith wrote:

> Hi
> Is it possible to trigger the LOAD component when a user clicks on
> something, or can it only be used when a page is first loaded?
> I have been using the ajax function to do this but would prefer the extra
> flexibility of LOAD if it is possible.
>
> thanks
> Rob.
>
>  --
>
>
>
>

-- 





[web2py] Connecting with database that has tables in it

2012-08-12 Thread pbreit
In order to use DAL query syntax, you have to define the tables.

-- 





[web2py] Re: DAL belongs() fails on App Engine

2012-08-12 Thread spiffytech
I tested with your suggested orderby, but the outcome was the same.

I tested with the query as you wrote it below, with no common_filter, and 
the query still failed. Since that's a pretty straightforward query that 
should work, this seems like a bug to me, so I filed a web2py bug report: 
http://code.google.com/p/web2py/issues/detail?id=930


On Thursday, August 9, 2012 5:39:14 PM UTC-4, howesc wrote:
>
> i had to look up common_filters.based on your experience i would 
> assume that this is being implemented as a query filter rather than getting 
> results from the DB and then filtering them.  so what is must be causing in 
> your case is:
>
> posts = db((db.posts.id.belongs(post_ids)) & 
> (db.posts.post_date<=request.now)).select(db.posts.ALL,orderby=db.posts.post_date,
>  cache
> =(cache.ram, 60))
>
> it *might* work if you put an orderby on that is 
> db.posts.id|db.posts.post_date  
> i'm not sure.  you might have to remove the common filter for this query 
> and then filter the results. (i don't have experience with common filters 
> and how they are implemented)
>
> GAE has a restriction on IN queries (web2py belongs queries) that they 
> have no more than 30 items in the list.  "because i said so" says google.
>
>
>
> On Thursday, August 9, 2012 1:57:13 PM UTC-7, spiffytech wrote:
>>
>> I've narrowed the problem down further- the exception is caused by a 
>> common_filter attached to my posts table:
>>
>> common_filter = lambda query: db.posts.post_date <= request.now
>>
>> I'm not sure why that would trigger the orderby error, though. 
>>
>> Also, is there some significance to limiting the belongs lists to 30 
>> items?
>>
>>
>>
>> On Thursday, August 9, 2012 4:24:13 PM UTC-4, howesc wrote:
>>>
>>> the query and the error message do not match.  your query has no 
>>> orderby, yet the error message suggests there is an orderby property set.  
>>> this confuses me.
>>>
>>> i do:
>>>
>>> db(db.table.id.belongs([list of items not more than 30 long])).select()
>>>
>>> all the time on GAE and it works for me (latest stable web2py, and the 
>>> last time i checked trunk though that was a few weeks ago)
>>>
>>> note that cache does nothing on selects on GAE due to the inability to 
>>> serialize Rows objects to memcache (at least i think that is the limitation)
>>>
>>> cfh
>>>
>>> On Thursday, August 9, 2012 10:40:33 AM UTC-7, spiffytech wrote:

 I'm trying to use the DAL belongs clause on App Engine and am getting 
 an error. 

 posts = db(db.posts.id.belongs(post_ids)).select(db.posts.ALL, cache=(
 cache.ram, 60))

 Produces:

 BadArgumentError: First ordering property must be the same as 
 inequality filter property, if specified for this query; received __key__, 
 expected post_date

 Some Googling suggests this can be due to not providing a sort key. I 
 tried orderby=db.posts.post_date with no success. What could be going 
 wrong?

 I'm using the latest trunk web2py, but tested all the way back to 
 1.99.3.

>>>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-12 Thread Khalil KHAMLICHI
I have only made very little tests on gae, but I could clearly see that
web2py was too heavy to be profitable on gae,
 it just consumes too much resources, running models.py on every request
looks like a crazy thing to me..

-- 





[web2py] Re: Triggering LOAD

2012-08-12 Thread Anthony
Note, 

{{=LOAD('default','myaction', ajax=True)}}

is just a helper that produces the following HTML:

loading...

So, you can trigger a component loading in a div by manually calling the 
web2py_component() function in the browser and specifying a target div. 
Note, if you want the component to load initially via LOAD() and then make 
subsequent calls to web2py_component() to load other content into the div, 
you can specify your own id for the div instead of having LOAD() generate a 
random id as above:

{{=LOAD('default','myaction', ajax=True, target='mydiv')}}

yields:

loading...

Bruno mentioned the use of web2py_ajax_page() -- that function is 
ultimately called by web2py_component(), so either will work, but 
web2py_component() is probably easier.

Anthony

On Friday, August 10, 2012 5:08:49 AM UTC-4, Rob Goldsmith wrote:
>
> Hi
> Is it possible to trigger the LOAD component when a user clicks on 
> something, or can it only be used when a page is first loaded?
> I have been using the ajax function to do this but would prefer the extra 
> flexibility of LOAD if it is possible.
>
> thanks
> Rob.
>
>

-- 





Re: [web2py] Re: Appengine CPU cycles

2012-08-12 Thread Anthony

>
> I have only made very little tests on gae, but I could clearly see that 
> web2py was too heavy to be profitable on gae,
>  it just consumes too much resources, running models.py on every request 
> looks like a crazy thing to me..
>

Which is why this discussion has largely been about ways to avoid running 
all models on every request if they're not needed.

-- 





[web2py] Re: DAL belongs() fails on App Engine

2012-08-12 Thread Anthony

>
> Also, is there some significance to limiting the belongs lists to 30 items?
>

>From Google:

*Note:* The IN and != operators use multiple queries behind the scenes. For 
example, the IN operator executes a separate underlying datastore query for 
every item in the list. The entities returned are a result of the 
cross-product of all the underlying datastore queries and are 
de-duplicated. A maximum of 30 datastore queries are allowed for any single 
GQL query. 

-- 





Re: [web2py] Re: authentification,registration fails

2012-08-12 Thread Anthony
On Sunday, August 12, 2012 5:23:05 PM UTC-4, Michele Comitini wrote:
>
> Is your session dir too full?  Make sure it gets cleaned periodically from 
> old session pickles.
>
I'm not sure that's the problem. On regular requests, the same session 
cookie gets passed back and forth, but when an Auth form is submitted, a 
different session cookie comes back (implying a new session was created 
only in that case).

Anthony 

-- 





[web2py] Re: DAL belongs() fails on App Engine

2012-08-12 Thread Anthony
How would you do the query in GQL? Have you confirmed that it can be done?

Anthony

On Sunday, August 12, 2012 9:23:39 PM UTC-4, spiffytech wrote:
>
> I tested with your suggested orderby, but the outcome was the same.
>
> I tested with the query as you wrote it below, with no common_filter, and 
> the query still failed. Since that's a pretty straightforward query that 
> should work, this seems like a bug to me, so I filed a web2py bug report: 
> http://code.google.com/p/web2py/issues/detail?id=930
>
>
> On Thursday, August 9, 2012 5:39:14 PM UTC-4, howesc wrote:
>>
>> i had to look up common_filters.based on your experience i would 
>> assume that this is being implemented as a query filter rather than getting 
>> results from the DB and then filtering them.  so what is must be causing in 
>> your case is:
>>
>> posts = db((db.posts.id.belongs(post_ids)) & 
>> (db.posts.post_date<=request.now)).select(db.posts.ALL,orderby=db.posts.post_date,
>>  cache
>> =(cache.ram, 60))
>>
>> it *might* work if you put an orderby on that is 
>> db.posts.id|db.posts.post_date  
>> i'm not sure.  you might have to remove the common filter for this query 
>> and then filter the results. (i don't have experience with common filters 
>> and how they are implemented)
>>
>> GAE has a restriction on IN queries (web2py belongs queries) that they 
>> have no more than 30 items in the list.  "because i said so" says google.
>>
>>
>>
>> On Thursday, August 9, 2012 1:57:13 PM UTC-7, spiffytech wrote:
>>>
>>> I've narrowed the problem down further- the exception is caused by a 
>>> common_filter attached to my posts table:
>>>
>>> common_filter = lambda query: db.posts.post_date <= request.now
>>>
>>> I'm not sure why that would trigger the orderby error, though. 
>>>
>>> Also, is there some significance to limiting the belongs lists to 30 
>>> items?
>>>
>>>
>>>
>>> On Thursday, August 9, 2012 4:24:13 PM UTC-4, howesc wrote:

 the query and the error message do not match.  your query has no 
 orderby, yet the error message suggests there is an orderby property set.  
 this confuses me.

 i do:

 db(db.table.id.belongs([list of items not more than 30 long])).select()

 all the time on GAE and it works for me (latest stable web2py, and the 
 last time i checked trunk though that was a few weeks ago)

 note that cache does nothing on selects on GAE due to the inability to 
 serialize Rows objects to memcache (at least i think that is the 
 limitation)

 cfh

 On Thursday, August 9, 2012 10:40:33 AM UTC-7, spiffytech wrote:
>
> I'm trying to use the DAL belongs clause on App Engine and am getting 
> an error. 
>
> posts = db(db.posts.id.belongs(post_ids)).select(db.posts.ALL, cache=(
> cache.ram, 60))
>
> Produces:
>
> BadArgumentError: First ordering property must be the same as 
> inequality filter property, if specified for this query; received 
> __key__, 
> expected post_date
>
> Some Googling suggests this can be due to not providing a sort key. I 
> tried orderby=db.posts.post_date with no success. What could be going 
> wrong?
>
> I'm using the latest trunk web2py, but tested all the way back to 
> 1.99.3.
>


-- 





[web2py] NoneType object is not callable error when returning Storage type from controller

2012-08-12 Thread Jaymin Oh
def show_event():
event_id = request.vars['event_id']
event_record = db.event(event_id)

# Check if event exists
if not event_record:
raise HTTP(400, 'No event found')

# Check if it's member 
return Storage(event=event_record.as_dict())

---

http://localhost:8000/test/show_event.json?event_id=4 

When I call the above address, it says

('NoneType' object is not callable) 

If I change the last line to "return dict(event=event_record.as_dict())", 
then it works.

I want to use event_record as Storage in my view.

Please help me with this issue.

-- 





[web2py] Re: NoneType object is not callable error when returning Storage type from controller

2012-08-12 Thread Anthony
What you return from your function does not get passed to the view. Rather, 
if your function returns a dict, then the items in the dict are added to 
the global environment available to the view. If you want to create a 
storage object and pass it to the view, then the storage object should be 
an item within a dict:

def myfunc():
mystorage = Storage(...)
return dict(mystorage=mystorage)

Then in the view, you can refer to the mystorage object. From your code, 
it's not clear what you're trying to make into a Storage object or why, so 
I'm not sure how this translates onto what you are doing.

Anthony

On Sunday, August 12, 2012 9:57:48 PM UTC-4, Jaymin Oh wrote:
>
> def show_event():
> event_id = request.vars['event_id']
> event_record = db.event(event_id)
> 
> # Check if event exists
> if not event_record:
> raise HTTP(400, 'No event found')
> 
> # Check if it's member 
> return Storage(event=event_record.as_dict())
>
> ---
>
> http://localhost:8000/test/show_event.json?event_id=4 
>
> When I call the above address, it says
>
> ('NoneType' object is not callable) 
>
> If I change the last line to "return dict(event=event_record.as_dict())", 
> then it works.
>
> I want to use event_record as Storage in my view.
>
> Please help me with this issue.
>

-- 





[web2py] Re: Janrain redirects successfully, but I'm not logged in?

2012-08-12 Thread Cliff Kachinske
Google Chrome SSL error.

Server identified itself as *.rhcloud.com not giantpicnic.com

Needless to say I did not go there.

On Sunday, August 12, 2012 2:53:38 PM UTC-4, Alec Taylor wrote:
>
> After I click the login with facebook with Janrain I am redirected to my 
> page.
>
> Here is the response as an HAR file (Google Chrome): 
> http://pastebin.com/62pj90Ku
> [with hashes slightly modified to prevent abuse]
>
> Feel free to attempt to login yourself at http://giantpicnic.com
>
> What am I doing wrong?
>
> Thanks for all suggestions,
>
> Alec Taylor
>
>
>

-- 





[web2py] Re: DAL belongs() fails on App Engine

2012-08-12 Thread spiffytech
Yes, I've verified that this can be done. The below query works in the App 
Engine Datastore Viewer (note that it only worked once I manually created 
the index in index.yaml and deployed it; web2py did not automatically 
create the appropriate index:

SELECT * FROM posts WHERE __key__ IN (KEY('posts', 3), KEY('posts', 4), 
KEY('posts', 1003)) and post_date <= DATETIME('2012-08-12 00:00:00') ORDER 
BY post_date DESC


On Sunday, August 12, 2012 9:56:20 PM UTC-4, Anthony wrote:
>
> How would you do the query in GQL? Have you confirmed that it can be done?
>
> Anthony
>
> On Sunday, August 12, 2012 9:23:39 PM UTC-4, spiffytech wrote:
>>
>> I tested with your suggested orderby, but the outcome was the same.
>>
>> I tested with the query as you wrote it below, with no common_filter, and 
>> the query still failed. Since that's a pretty straightforward query that 
>> should work, this seems like a bug to me, so I filed a web2py bug report: 
>> http://code.google.com/p/web2py/issues/detail?id=930
>>
>>
>> On Thursday, August 9, 2012 5:39:14 PM UTC-4, howesc wrote:
>>>
>>> i had to look up common_filters.based on your experience i would 
>>> assume that this is being implemented as a query filter rather than getting 
>>> results from the DB and then filtering them.  so what is must be causing in 
>>> your case is:
>>>
>>> posts = db((db.posts.id.belongs(post_ids)) & 
>>> (db.posts.post_date<=request.now)).select(db.posts.ALL,orderby=db.posts.post_date,
>>>  cache
>>> =(cache.ram, 60))
>>>
>>> it *might* work if you put an orderby on that is 
>>> db.posts.id|db.posts.post_date  
>>> i'm not sure.  you might have to remove the common filter for this query 
>>> and then filter the results. (i don't have experience with common filters 
>>> and how they are implemented)
>>>
>>> GAE has a restriction on IN queries (web2py belongs queries) that they 
>>> have no more than 30 items in the list.  "because i said so" says google.
>>>
>>>
>>>
>>> On Thursday, August 9, 2012 1:57:13 PM UTC-7, spiffytech wrote:

 I've narrowed the problem down further- the exception is caused by a 
 common_filter attached to my posts table:

 common_filter = lambda query: db.posts.post_date <= request.now

 I'm not sure why that would trigger the orderby error, though. 

 Also, is there some significance to limiting the belongs lists to 30 
 items?



 On Thursday, August 9, 2012 4:24:13 PM UTC-4, howesc wrote:
>
> the query and the error message do not match.  your query has no 
> orderby, yet the error message suggests there is an orderby property set. 
>  
> this confuses me.
>
> i do:
>
> db(db.table.id.belongs([list of items not more than 30 long])).select()
>
> all the time on GAE and it works for me (latest stable web2py, and the 
> last time i checked trunk though that was a few weeks ago)
>
> note that cache does nothing on selects on GAE due to the inability to 
> serialize Rows objects to memcache (at least i think that is the 
> limitation)
>
> cfh
>
> On Thursday, August 9, 2012 10:40:33 AM UTC-7, spiffytech wrote:
>>
>> I'm trying to use the DAL belongs clause on App Engine and am getting 
>> an error. 
>>
>> posts = db(db.posts.id.belongs(post_ids)).select(db.posts.ALL, cache
>> =(cache.ram, 60))
>>
>> Produces:
>>
>> BadArgumentError: First ordering property must be the same as 
>> inequality filter property, if specified for this query; received 
>> __key__, 
>> expected post_date
>>
>> Some Googling suggests this can be due to not providing a sort key. I 
>> tried orderby=db.posts.post_date with no success. What could be 
>> going wrong?
>>
>> I'm using the latest trunk web2py, but tested all the way back to 
>> 1.99.3.
>>
>

-- 





[web2py] Trouble adding lxml module to application

2012-08-12 Thread Mike Girard
I am attempting to use lxml in my app. I am using Mac OS X. I placed the 
lxml files in web2py/Content/Resources/applications//modules.  

I attempted to import lxml into default.py with this:

from lxml import etree


I am getting a module-not-found error. 

I anticipated problems because lxml required some TLC just to get it 
installed and working on my Mac. 

While it would be helpful to know how to get it working from the 
application's local modules folder, my preference would be for web2py to 
have all the Python modules in the system site-packages directory available 
for import, rather than local copies.  Is there some way I can set this up?

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-12 Thread Massimo Di Pierro
Are you using the web2[y binary distribution. It will not work with the osx 
distribiution which comes with its own python/


On Sunday, 12 August 2012 22:39:56 UTC-5, Mike Girard wrote:
>
> I am attempting to use lxml in my app. I am using Mac OS X. I placed the 
> lxml files in web2py/Content/Resources/applications//modules.  
>
> I attempted to import lxml into default.py with this:
>
> from lxml import etree
>
>
> I am getting a module-not-found error. 
>
> I anticipated problems because lxml required some TLC just to get it 
> installed and working on my Mac. 
>
> While it would be helpful to know how to get it working from the 
> application's local modules folder, my preference would be for web2py to 
> have all the Python modules in the system site-packages directory available 
> for import, rather than local copies.  Is there some way I can set this up?
>
>

-- 





Re: [web2py] Re: Electronic voting anybody?

2012-08-12 Thread Massimo Di Pierro
Nice. Is this posted somewhere or private?

On Sunday, 12 August 2012 08:15:09 UTC-5, Ramos wrote:
>
> i have a phone voting system with web2py and asterisk
>
> http://www.youtube.com/watch?v=vCNoAyKN86o
>
>
>
> 2012/8/12 Alan Etkin >
>
>> I like it. I'd consider as a new feature (if not implemented yet) the 
>> option of submitting a new vote replacing the previous before deadline.
>>
>> El viernes, 10 de agosto de 2012 18:24:10 UTC-3, Massimo Di Pierro 
>> escribió:
>>
>>> Demo service:
>>>
>>>https://tests.web2py.com/evote/default/index
>>>
>>> Source:
>>>
>>>https://github.com/mdipierro/evote
>>>
>>> I could use some help checking it. Specifically usability and security.
>>>
>>> Massimo
>>>
>> -- 
>>  
>>  
>>  
>>
>
>

-- 





Re: [web2py] Re: GAE Cloud SQL local dev server problem

2012-08-12 Thread Massimo Di Pierro
Can you try replace

self.folder = folder or '$HOME/'+thread.folder.split('/applications/',1)[1]

with

self.folder = thread.folder.split('/applications/',1)[1]





On Wednesday, 8 August 2012 18:11:04 UTC-5, Alexei Vinidiktov wrote:
>
> Ok. I've managed to connect to MySQL from GAE local dev server on Windows 
> if I change line 3845 in dal.py to this:
>
> self.folder = ""
>
> instead of (self.folder = folder or 
> '$HOME/'+thread.folder.split('/applications/',1)[1])
>
> I don't know if it breaks anything though.
>
> On Thu, Aug 9, 2012 at 6:03 AM, Alexei Vinidiktov 
> 
> > wrote:
>
>> The problem is still not resolved in trunk.
>>
>>
>> On Mon, Aug 6, 2012 at 12:56 PM, Alexei Vinidiktov 
>> 
>> > wrote:
>>
>>> Here it is: db = DAL('google:sql://vocabilisproject:vocabilis/vocabilis')
>>>
>>> I pass the password and the user name via App Launcher parameters as 
>>> suggested in the GAE SDK docs: --mysql_user=root --mysql_password=xx 
>>> --mysql_host=localhost --mysql_port=3306 
>>>
>>>
>>> On Mon, Aug 6, 2012 at 7:59 AM, Massimo Di Pierro 
>>> 
>>> > wrote:
>>>
 Can you show your complete connection string (masking any password of 
 course)?


 On Saturday, 4 August 2012 02:11:30 UTC-5, Alexei Vinidiktov wrote:
>
>
>
> On Sat, Aug 4, 2012 at 1:56 PM, Alexei Vinidiktov <
> alexei.v...@gmail.com > wrote:
>
>> Hello,
>>
>> I'm need hep figuring out how to set up a local GAE development 
>> server with MySQL.
>>
>> MySQL connection parameters are specified via App Launcher 
>> application settings: --mysql_user=root --mysql_password=xx 
>> --mysql_host=localhost --mysql_port=3306 
>>
>> When I launch my web2py app with GAE Launcher on my local Windows 
>> box I get this erorr message:
>>
>> 
>> ERROR2012-08-04 06:28:43,515 dal.py:5962] DEBUG: connect attempt 
>> 0, connection error:
>> Traceback (most recent call last):
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 5955, in __init__
>> self._adapter = ADAPTERS[self._dbname](*args)
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 3310, in __init__
>> self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1]
>> IndexError: list index out of range
>> #
>>
>> What does the following line do? 
>>
>> self.folder = folder or '$HOME/'+thread.folder.split('**
>> /applications/',1)[1]
>>
>> If I comment out "or 
>> '$HOME/'+thread.folder.split('**/applications/',1)[1]" 
>> in DAL.py and relaunch the dev server, the application appears to be 
>> able 
>> to connect to MySQL but then I get a different error message:
>>
>> 
>> INFO 2012-08-04 06:42:35,142 rdbms_mysqldb.py:102] Connecting to 
>> MySQL with kwargs {'passwd': 'xx', 'unix_socket': '', 'host': 
>> 'localhost', 'port': 3306, 'user': 'root'}
>> ERROR2012-08-04 06:42:35,153 warnings.py:29] 
>> C:\Users\alexei\Dev\web2py\voc**abilis.net 
>> \gluon\dal.py:1386: 
>> Warning: Can't create database 'vocabilis'; database exists
>>   ret = self.cursor.execute(*a, **b)
>>
>> ERROR2012-08-04 06:42:35,575 restricted.py:155] Traceback (most 
>> recent call last):
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\main.py",
>>  
>> line 510, in wsgibase
>> session._try_store_in_db(**request, response)
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\globals.py",
>>  
>> line 561, in _try_store_in_db
>> record_id = table.insert(**dd)
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 6829, in insert
>> return self._db._adapter.insert(self,**self._listify(fields))
>>   File 
>> "C:\Users\alexei\Dev\web2py\vo**cabilis.net\gluon\dal.py",
>>  
>> line 928, in insert
>> raise e
>> ProgrammingError: (1146, "Table 'vocabilis.web2py_session_**vocabilis' 
>> doesn't exist")
>> #
>>
>> The vocabilis database does exist. It was created earlier when I 
>> connected to MySQL from a non GAE environment.
>>
>> If I specify a different non-existent database in the connection 
>> string, then after relaunching the application vith the GAE Launcher I 
>> get 
>> this error message:
>>
>> ###
>> INFO 2012-08-04 06:44:45,415 rdbms_mysqldb.py:102] Connecting to 
>> MySQL with kwargs {'passwd': 'xx', 'unix_socket': '', 'host': 
>> 'localhost', 'port': 3306, 'user': 'root'}
>> ERROR2012-08-04 06:44:45,828 restricted.py:155] Traceback

[web2py] Re: autoincremente field with a specific first value

2012-08-12 Thread Massimo Di Pierro
Do you mean something like this?

db(query).update(field = db.table.field+value)

On Friday, 10 August 2012 10:46:54 UTC-5, tigmmi wrote:
>
> Is there a way to add an autoincremente field with a specific first value. 
> Compute won't work with id + number.

-- 





[web2py] Re: NoSQL Question Again!!!

2012-08-12 Thread Massimo Di Pierro
We think web2py supports mongo well but we need more people to help testing 
it.  We will mention in the 2.0 release as experimental because of lack of 
testers.

On Friday, 10 August 2012 11:16:30 UTC-5, gm01 wrote:
>
> Has there been any update with DAL supporting Mongo?  I haven't seen any 
> "official" mention in w2p docs.  Any information would be appreciated.
> Thanks,
> gm
>
> On Thursday, July 15, 2010 4:07:04 PM UTC-4, Pystar wrote:
>>
>> Hi guys, 
>> I am one of the proponents that web2py's DAL should support NoSQL 
>> datastores like Couchdb, Mongodb et al but since the DAL rewrite isn't 
>> quite completer yet, I would like to know how to use web2py and a 
>> NoSQL datastore without DAL and without loosing stuff like auto-gen 
>> forms and validation. 
>> Thanks Pystar
>
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-12 Thread Mike Girard
Yes, I was using the web2py binary. I have since opted to run from source 
and it works with one stipulation:

Your instructions say to run from source use python2.5. lxml is installed 
in 2.6 on my machine. Running from source with python rather than python2.5 
seems to be fine and the module not found error went away. 

Is it ok to run web2py with python 2.6 or am I likely to encounter problems 
down the road? 

Thanks for your help.  

On Sunday, August 12, 2012 11:39:56 PM UTC-4, Mike Girard wrote:
>
> I am attempting to use lxml in my app. I am using Mac OS X. I placed the 
> lxml files in web2py/Content/Resources/applications//modules.  
>
> I attempted to import lxml into default.py with this:
>
> from lxml import etree
>
>
> I am getting a module-not-found error. 
>
> I anticipated problems because lxml required some TLC just to get it 
> installed and working on my Mac. 
>
> While it would be helpful to know how to get it working from the 
> application's local modules folder, my preference would be for web2py to 
> have all the Python modules in the system site-packages directory available 
> for import, rather than local copies.  Is there some way I can set this up?
>
>

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-12 Thread pbreit
Web2py runs fine (better?) on 2.6 and 2.7.

-- 





[web2py] Re: Trouble adding lxml module to application

2012-08-12 Thread Mike Girard
Are you sure? I searched on this list and seemed that there had been some 
problems. In light of this I installed lxml in my 2.5 site-packages and ran 
web2py with the python2.5 command recommended on the installation page. 

Can someone confirm what Python version is best for running web2py as of 
now? 

Thanks. 

On Monday, August 13, 2012 2:01:35 AM UTC-4, pbreit wrote:
>
> Web2py runs fine (better?) on 2.6 and 2.7.

--