Re: [web2py] Re: Is it me or what?

2012-01-21 Thread Farsheed Ashouri
you had another option! to mail me and ask me to solve your problem instead 
of marking Ourway emails as spam! Ourway NEVER spams! just when you have 
new comment or private message.  btw, I disabled your account cause all 
passwords are encrypted in database and recover option won't be ready till 
next month. You can re register if you want.
As you know Ourtway is in it's beta and there is long way to be a 
production ready and public tool. The only thing I need is to get people 
test it as much as they can so i can find bugs and fix them.
Thanks for your support and using my tool.


[web2py] Re: Sending simplified email from web2py

2012-01-21 Thread LightDot
The code itself works, mails get properly sent. The problem is on the other 
side - I need to send mails to a pretty aged interface that parses them and 
over which I have no control. It doesn't accept and parse anything that 
isn't plain text, so mails with Content-Type: multipart/mixed and encoded 
contents get rejected.

I solved the problem temporarily by using smtplib directly. As soon as I 
manually send messages with body simply consisting of:

 /n Some simple text here. /n/n

everything works fine, they get parsed properly on the other end.

Is there is any way to trick web2py's Mail class into sending emails with 
absolutely no body encoding? I looked at the gluon/tools.py in the mean 
time and it seems that what I'm looking for is impossible to achieve trough 
web2py's Mail class. Unless I'm mistaken...

Anyway, Thanks for looking into this!


[web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Phyo Arkar
Nobody knows? ah sucks. Nobody tries to do Login using AJAX ? Without
traditional login page?

On Fri, Jan 20, 2012 at 8:15 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 To keep it simple.

 How can i login (without using form) to web2py Auth  via AJAX?

 Thanks

 Phyo.


 On Fri, Jan 20, 2012 at 7:45 PM, Phyo Arkar phyo.arkarl...@gmail.comwrote:

 hello web2py.

 I am trying to get auth working with qooxdoo , can i know how should i
 login using ajax and (ofcoz use session) of webpy?

 Thanks

 Phyo.





[web2py] Re: Sending simplified email from web2py

2012-01-21 Thread Alan Etkin
the gluon Mail class supports customized headers:

In .send(), the headers kwarg is a ...dictionary of headers to refine
the headers just before sending mail, e.g. ...

Have you tried to set the mail header to text/plain? Is the email
still being sent as multipart?

Maybe there should be a Mail.send() mail kwarg to pass an
email.message.Mail instance.

On 21 ene, 07:12, LightDot light...@gmail.com wrote:
 The code itself works, mails get properly sent. The problem is on the other
 side - I need to send mails to a pretty aged interface that parses them and
 over which I have no control. It doesn't accept and parse anything that
 isn't plain text, so mails with Content-Type: multipart/mixed and encoded
 contents get rejected.

 I solved the problem temporarily by using smtplib directly. As soon as I
 manually send messages with body simply consisting of:

  /n Some simple text here. /n/n

 everything works fine, they get parsed properly on the other end.

 Is there is any way to trick web2py's Mail class into sending emails with
 absolutely no body encoding? I looked at the gluon/tools.py in the mean
 time and it seems that what I'm looking for is impossible to achieve trough
 web2py's Mail class. Unless I'm mistaken...

 Anyway, Thanks for looking into this!


[web2py] Re: web2py components and browser history

2012-01-21 Thread LightDot
It seems that nobody cares much for web2py, ajax and browser back buttons 
:) Nevertheless, I made some progress and thought I'd post some findings 
here If anyone searches the group with a similar goal.

Let me describe the problem once again. Imagine a scenario:

1) visitor is on Google, searches for a web2py powered site, finds it, 
follows the link
2) site loads
3) visitor sees an internal link which loads a web2py component (ajax call) 
with new content, follows the link, component loads
4) visitor reads the content, wants to go back, uses the browser back 
button...
5) KABOOM, user is back on Google instead on the first page of the site

which is pretty bad as far as user experience goes.

Anyway, our site has a number of components that can work as regular pages 
(.load and .html do the same thing) so what I really need is a way for a 
component to tell the browser it has loaded. To solve this, i need to 
manipulate the browser history manually.

Sadly, current state of things is pretty messy on the browser side. After 
looking at what's available, I found several solutions but none of them 
perfect. I decided to give up on Internet Explorer 8 and 9 completely. 
Sorry folks, you're on your own. IE 10 *should* work as it comes out... 
yes, I believe in Santa. :)

So, the first thing I tried was using the native browser's history API [1], 
which all modern HTML5 browsers have (yes, forget IE9). It looks fine on 
paper, but the implementation has some problems. Chromium / Chrome behaves 
differently than Firefox/Opera/Safari in one crucial point (fires initial 
onpopstate, I even managed to crash Chromium) [2], so I had to abandon 
using this API directly. If it wasn't for this Chromium issue, it would be 
the perfect solution.

Then I tried using the history.js [3]. This project has a long history of 
successfully coping with ajax/browser history issues, so I was optimistic. 
But sadly, history.js's master branch (version 1.7.1) also works in a way 
that pushState and replaceState will immediately trigger onpopstate, which 
is not what I wanted [4]. Luckily, the devel branch (1.8.0-dev) got an 
additional State.internal [5] with this commit [6], so I can tell if 
onpopstate is triggered by the browser's buttons or not.

Ok, long story is coming to an end. It's time for some code. This is what 
I'm currently at:

- set the history entry in the component's controller:
response.js = 
History.pushState({isMyPageName:1},'','+URL('some','thing',extension=False)+')

-at the end of layout.html:
script
   (function(window,undefined){
var History = window.History;
if ( !History.enabled ) {
return false;
}
History.Adapter.bind(window,'statechange',function(){
var State = History.getState();
if (( State.data.isMyPageName == 1 )  ( State.internal == 
false )) {
//alert(data:  + JSON.stringify(State.data) +  
title:  + State.title +  url:  + State.url +  internal:  + 
State.internal);
window.location = State.url;
}
});
})(window);
/script

Ok, that's about it... The solution is flaky at times and I still need to 
manipulate document.title, haven't gotten to that yet. But it works, web2py 
components can silently change the browser url as they load. And no #%/ 
URL hashes and hashbangs...

[1] https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history
[2] 
https://github.com/balupton/history.js/wiki/The-State-of-the-HTML5-History-API
[3] https://github.com/balupton/history.js
[4] https://github.com/balupton/history.js/issues/47
[5] https://github.com/balupton/history.js/tree/dev
[6] 
https://github.com/balupton/history.js/commit/c79c17f9801373f5218f144088c387f1935f3462


[web2py] Re: DAL IMAPAdapter

2012-01-21 Thread Alan Etkin
I changed the IMAPAdapter again to add this new options:

- set.select(limitby=int) to limit extense email sequences to be
fetched
- DAL(query, ignore_common_filters=True) and
imapdb.mailbox.common_filter = lambda query: ... common filters
weren't being read by the adapter.
- set.count() this isn't new really (it was there a couple of versions
before) but I didn't mentioned it.
- Now all the mail text parsed is pre-encoded as UTF-8 to avoid errors
when the output is processed by helpers.

I'll send the new diff to the issues list (although the issue was
marked as fixed).

On 19 ene, 13:37, LightDot light...@gmail.com wrote:
 Sounds really good. I guess webmail application would also be an
 interesting web2py project.

 Eh, if work days had about 49 hours, I'd be on it right now...


[web2py] Re: Two questions: 1. empty SQLFORM.grid 2. Represent question

2012-01-21 Thread Eino Mäkitalo
I had the issue with SQLFORM.grid and   left join

I have Contact table (Kontakti)  and  Bank reference number (finnish bank 
anomality)   Viitteet.

It seems that it is not enough to introduce extra table in left join 
only... so I made query (ugly) where I show both tables *
(db.Kontakti.id0)(db.Viitteet.id0)*


records=SQLFORM.grid((db.Kontakti.id0)(db.Viitteet.id0),fields=fields,headers=shheaders,left=db.Viitteet.on(db.Kontakti.id==db.Viitteet.id_Kontakti))

I don't think this is the right way.  I think grid should also check all 
tables introduced in left -parameter too.




[web2py] Re: passing navigational links in the header and ajax woes

2012-01-21 Thread web-dev-m
Dear Massimo,

Thank you in advance for your time just looking.  If I can write a
functional web application, you must be brilliant to have created this
software.

I am essentially trying to write a google docs clone with the ability
to add notes.

My users upload documents which a python function uses, modifies, and
then stores the text in the database.  The view displays the text from
the page in a set of divs.  I then use AJAX to create a note on the
side via a form.

The text from the document and the document title/file are in
different tables.  Also, there is not guaranteed to be file text yet,
as not every user that uploads a file will need to see the text, so I
upload the file and get the text in two separate functions.

My workflow is:

1.) check to see if file exists in database
2.) IF it doesnt, make it, and store the text in a table, then get the
text fields.
3.) IF it does, get the text fields from one table and the filename
from another
4.) Display file text in the view

I then use AJAX to add a form which allows the user to add a note next
to the text.


Re: [web2py] Re: writable depending on another field

2012-01-21 Thread Martin Weissenboeck
Sorry, I think I have asked the wrong question.

The whole idea:
Every user sees a lot of checkfields he can check or not.

But there is a administrator, which can allow these changes or disallow it
for every field independently. If a user is not allowed to change a
specific checkbox he should only see the checkbox

If there is a new record there could be a default value.

The number of checkboxes is variable, so these boolean fields have their
own table.
I thought I could use a grid or a smartgrid.

Now I have used a FORM and the controller sets, if necessary, disabled.
It works as expected.

2012/1/21 Massimo Di Pierro massimo.dipie...@gmail.com


 It does not work because this db.t.f1 is a field (a column) not a
 value (true or false).


I used it only to describe my problem.


 I guess what you want is make the second field readable or writable
 depending on which record you are looking at. For example it makes no
 sense if you are inserting a new record, should the second field be
 editable or not?

 That requires that you do it in controllers for example:

 def edit_t():
 record = db.t(request.args(0))
 if record: db.t.f2.writable = record.f1
 else db.t2.writable = true
 form =  SQLFORM(db.t, record).process()
 return dict(form=form)



 On Jan 20, 5:12 pm, Martin Weissenboeck mweis...@gmail.com wrote:
  Hi,
 
  I want to have a model like
 
  db.define_table(t,
  Field('f1', 'boolean'),
  Field('f2', 'boolean', writable = db.t.f1),
)
 
  Of course, this does not work, but how could it be written?
 
  Regards, Martin



[web2py] option to move smartgrid buttons to the left side

2012-01-21 Thread Adi

is there a possibility to choose if smartgrid buttons (edit, delete, ...) 
display on the left or far right side? would be useful lock in buttons, but 
let the grid grow on the right side if user wants horizontal scroll for 
rarely used data.

thanks,
Adi


[web2py] Re: CUSTOMIZE SQLFORM.grid

2012-01-21 Thread Adi
yes, you can use it like this (in smart grid)

links=dict(purchase_order=[lambda row: A('Duplicate',
_class='button', 
_href=URL('duplicate_order',args=[row.id])),
lambda row: A('Print', _class='button', 
_href=URL('print_all',args=[row.id]))]),





[web2py] Re: Sending simplified email from web2py

2012-01-21 Thread LightDot
Good catch, didn't think of that... Didn't work though. :)

For the sake of completeness, here is the relevant code:

if form.process().accepted:
response.flash = T('form accepted')
mail.send(to='xxx...@xx.xxx',
  subject='Simply',
  message='just some plain ol text',
  headers = {'Content-Type' : 'text/plain'}
  )
elif form.errors:
response.flash = T('form has errors')
return dict(form=form)

and what comes trough now:

Content-Type: multipart/mixed; 
boundary8561316457798710179==
MIME-Version: 1.0
From: xxx...@xx.xxx
To: xxx...@xx.xxx
Subject: Simple
Date: sat, 21 jan 2012 14:24:25 +
X-Invalid-Content-Type: multipart/mixed;
 boundary8561316457798710179==
Message-ID: x...@xxx.xx.xxx


--===8561316457798710179==
Content-Type: multipart/alternative; 
boundary5206004524625423259==
MIME-Version: 1.0


--===5206004524625423259==
Content-Type: text/plain; charset=utf-8
MIME-Version: 1.0
Content-Transfer-Encoding: base64

anVzdCBzb21lIHBsYWluIG9sIHRleHQ= 

--===5206004524625423259==--

--===8561316457798710179==--


[web2py] Re: option to move smartgrid buttons to the left side

2012-01-21 Thread szimszon
Or the buttons in the right side could be next to the data fields and not 
in the scrollable area...


[web2py] Re: Sending simplified email from web2py

2012-01-21 Thread Alan Etkin
I think that next versions of the class could be able to read a
standard Python mail.message.Mail instance
and compose the the message accordingly as for example with this
command:

mail.send_from_message(message)

Would be possible to add that feature?

Perhaps a simpler way would be to add a send method argument like (no-
multipart or something similar)

On 21 ene, 11:35, LightDot light...@gmail.com wrote:
 Good catch, didn't think of that... Didn't work though. :)

 For the sake of completeness, here is the relevant code:

     if form.process().accepted:
         response.flash = T('form accepted')
         mail.send(to='xxx...@xx.xxx',
                   subject='Simply',
                   message='just some plain ol text',
                   headers = {'Content-Type' : 'text/plain'}
                   )
     elif form.errors:
         response.flash = T('form has errors')
     return dict(form=form)

 and what comes trough now:

 Content-Type: multipart/mixed;
 boundary8561316457798710179==
 MIME-Version: 1.0
 From: xxx...@xx.xxx
 To: xxx...@xx.xxx
 Subject: Simple
 Date: sat, 21 jan 2012 14:24:25 +
 X-Invalid-Content-Type: multipart/mixed;
  boundary8561316457798710179==
 Message-ID: x...@xxx.xx.xxx

 --===8561316457798710179==
 Content-Type: multipart/alternative;
 boundary5206004524625423259==
 MIME-Version: 1.0

 --===5206004524625423259==
 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: base64

 anVzdCBzb21lIHBsYWluIG9sIHRleHQ=

 --===5206004524625423259==--

 --===8561316457798710179==--


[web2py] Re: Problem with DB2 and text field type when accessing db2 using ODBC ...

2012-01-21 Thread Omi Chiba
David,

My AS400 is located in Tokyo so I thought that's why it's slower than MS 
SQL Server located in my office. But it's possible native driver is faster 
than ODBC.




[web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Anthony
I haven't tried it, but maybe something along these lines:

def login():
form = auth.login(next=URL('default', 'login'))
if not request.post_vars:
return form.formkey

On the client side, you would make an initial Ajax request to login() when 
setting up your login form/widget -- in that case, login() will return a 
formkey as a string (which it will also store in the session). Upon login, 
send an Ajax post request to login() with the formkey value in a '_formkey' 
field. Once the login is processed, it should redirect back to login(), 
which will then return a new formkey value.

Anthony

On Friday, January 20, 2012 8:45:39 AM UTC-5, Phyo Arkar wrote:

 To keep it simple.

 How can i login (without using form) to web2py Auth  via AJAX?

 Thanks

 Phyo.

 On Fri, Jan 20, 2012 at 7:45 PM, Phyo Arkar phyo.ar...@gmail.com wrote:

 hello web2py.

 I am trying to get auth working with qooxdoo , can i know how should i 
 login using ajax and (ofcoz use session) of webpy?

 Thanks

 Phyo.




[web2py] Ho to implement a SignIn with multiple verified email addresses.

2012-01-21 Thread thstart

I need to implement the following. Basically a SignIn with multiple 
verified email addresses.

   1. A first time email/password SignUp.
   2. Registered emails - send verification to the email account and 
   verified from the user after click. (this is done).
   3. Each of the registered emails plus the initial SignUp email to be a 
   valid email address for email/password SignIn. The password - the same as 
   the initial Sign Up.

e.g. the user SignUp with ema...@...com/password, then he 
registers/verifies two more emails: ema...@...com, email3...com. when he 
logs in next time he can login with:

ema...@...com/password 
ema...@...com/password 
ema...@...com/password 

Security is OK because he is the owner of ema...@...com, 
ema...@...com and proves it by SignIn to these email accounts. 
ema...@...com is pending until he does the same as for other email 
addresses.


How to accomplish this?



[web2py] Re: Python for Android (any takers to run web2py)

2012-01-21 Thread JoeCodeswell
Dear Plumo,

Here's my use case(s). Easily developing single user GUI apps with
HTML as the GUI framework and the easily programmable Python back end
of web2py being able to access Android System Resources outside the
sandbox.

I would REALLY like it if there could be an Binary Executable
Packaging of web2py for Android similar to that which exists for
Windows (.exe) and Mac (.app).

I am VERY excited to watch the progress of this thread.

On Jan 9, 6:34 pm, Plumo richar...@gmail.com wrote:
 what is the use case for running a web framework on your Android phone?


[web2py] Re: Chunked downloads and corrupt files with Internet Explorer 8 (IE8)

2012-01-21 Thread Timothy Farrell
https://github.com/explorigin/Rocket/issues/1

On Dec 9 2011, 8:02 pm, Timothy Farrell explori...@gmail.com wrote:
 David,

 Thanks for your offer to help with this.  The best way to help right
 now would be to provide me a smallish pcap file that records it
 happening so I can see which parts of the files are missing.

 Thanks,
 Timothy Farrell

 On Dec 5, 9:07 pm, David Tse muka...@gmail.com wrote:







  I'm experiencing this problem as well, and signs on my side are also
  pointing to Rocket.  Although my case is a little different because I'm not
  currently experiencing this problem with web2py, but I'm using Rocket by
  itself to serve a light-weight service using a smaller micro-framework.
   However, I have experience this in the past with web2py, and I forgot what
  I did at the time but the problem went away somehow.

  Back to the issue at hand.  I'm current using Rocket to serve a tiny WSGI
  app and using bottle.py as the framework, and I've seen large file
  downloads (100MB+) missing anywhere between 8 to 32 KB, usually 8K.  I've
  tested with serving directly with Rocket and also proxy-ing Rocket behind
  Nginx.  I'm also using SSL when serving directly with Rocket, and Nginx
  doing the SSL when running behind it.  The issue is somewhat intermittent,
  and for some reason it seems to happen less behind Nginx but still does.  I
  primarily use curl for my testing, and when it does happen curl would get
  stuck near the very end and times out after a while.

  I'm running with Rocket 1.2.4, on Ubuntu 10.04.  The problem goes away if I
  change to cherrypy or gevent, which is what leads me to think it might be
  Rocket.  I found this thread when googling to see if anyone else was
  experiencing this in the web2py community.  I'd be happy to help track this
  down.


[web2py] Re: Python for Android (any takers to run web2py)

2012-01-21 Thread Massimo Di Pierro
+1

On Jan 21, 11:57 am, JoeCodeswell joecodesw...@gmail.com wrote:
 Dear Plumo,

 Here's my use case(s). Easily developing single user GUI apps with
 HTML as the GUI framework and the easily programmable Python back end
 of web2py being able to access Android System Resources outside the
 sandbox.

 I would REALLY like it if there could be an Binary Executable
 Packaging of web2py for Android similar to that which exists for
 Windows (.exe) and Mac (.app).

 I am VERY excited to watch the progress of this thread.

 On Jan 9, 6:34 pm, Plumo richar...@gmail.com wrote:







  what is the use case for running a web framework on your Android phone?


[web2py] Re: Sending simplified email from web2py

2012-01-21 Thread Alan Etkin
I requested a change in Mail to support unencoded and no multipart
messages.
http://code.google.com/p/web2py/issues/detail?id=630

On 21 ene, 11:35, LightDot light...@gmail.com wrote:
 Good catch, didn't think of that... Didn't work though. :)

 For the sake of completeness, here is the relevant code:

     if form.process().accepted:
         response.flash = T('form accepted')
         mail.send(to='xxx...@xx.xxx',
                   subject='Simply',
                   message='just some plain ol text',
                   headers = {'Content-Type' : 'text/plain'}
                   )
     elif form.errors:
         response.flash = T('form has errors')
     return dict(form=form)

 and what comes trough now:

 Content-Type: multipart/mixed;
 boundary8561316457798710179==
 MIME-Version: 1.0
 From: xxx...@xx.xxx
 To: xxx...@xx.xxx
 Subject: Simple
 Date: sat, 21 jan 2012 14:24:25 +
 X-Invalid-Content-Type: multipart/mixed;
  boundary8561316457798710179==
 Message-ID: x...@xxx.xx.xxx

 --===8561316457798710179==
 Content-Type: multipart/alternative;
 boundary5206004524625423259==
 MIME-Version: 1.0

 --===5206004524625423259==
 Content-Type: text/plain; charset=utf-8
 MIME-Version: 1.0
 Content-Transfer-Encoding: base64

 anVzdCBzb21lIHBsYWluIG9sIHRleHQ=

 --===5206004524625423259==--

 --===8561316457798710179==--


[web2py] Re: Fedora setup script problems

2012-01-21 Thread SallyG
I am now able to answer my own question. The messages about
__init.py__ are unimportant output of the script I used to install
web2py on sci linux. The install worked fine.

I was confused about how to invoke the admin interface and one idea
was that my install was imperfect.  I hooked web2py with apache and
didn't realize that I must use the built-in web-server for development
and the admin interface.  All is well.



[web2py] SQLFORM errors with custom id fields

2012-01-21 Thread Alan Etkin
I recently updated my web2py source code from the mercurial repository

I think that something has changed in SQLFORM that is incompatible
with custom id field names declared with:

Field(other_id, ...)

On form processing, record updates stop the app with this error:

Traceback (most recent call last):
  File /home/alan/gestionlibre/gestionlibre_gui-hg/controllers/
appadmin.py, line 178, in update
if session.form.accepts(evt.args, formname=None, keepvalues=False,
dbio=False):
  File /home/alan/web2py-hg/gluon/sqlhtml.py, line 1050, in accepts
(formname_id, record_id) = (self.record[id_fieldname],
  File /home/alan/web2py-hg/gluon/dal.py, line 4987, in __getitem__
return dict.__getitem__(self, key)

I managed to solve the problem for updates by changing sqlhtml.py in
this way:

(Line 1039)
# retrieve the actual id name (for legacy databases)
try:
id_fieldname = self.table.id.name
except (IndexError, AttributeError):
# could not retrieve the table id value
id_fieldname = id
# former notation was self.record.id Check for
compatibility
(formname_id, record_id) = (self.record[id_fieldname],
request_vars.get('id',
None))

The problem seems to be related to SQLFORM trying to get the default
id key from table records, and may reproduce in other instances, since
I see that the record.id property is being called in other sections of
the module.

I'd continue with the fix to provide a complete modification of the
module if the solution provided has no backward compatibility or other
problems.

Thanks


[web2py] web2py with Plesk Control Panel ?

2012-01-21 Thread Ben Tammetta
Hello,

I have a VPS running on CentOS that comes with Plesk.  It seems there
are instructions to setup web2py with apache in the online book, but I
am afraid making config file changes could mess up the Plesk
management system.

So can anyone provide any guidance or links to instructions to setup
web2py to integrate smoothly with the Plesk control panel?

It is great that web2py can be downloaded and running in just a couple
of minutes.. but we need an easily to deploy solution that plays well
with 90% of the most common hosting environments hosting providers
provide.
Namely Cpanel and Plesk. If this were easier to deploy in such
environments I think we would see a whole lot more web2py
deployments.   At least in my world as I could slowly transition
current and new client websites to a web2py setup.



[web2py] Re: SQLFORM errors with custom id fields

2012-01-21 Thread Alan Etkin
A similar error is generated on validators.py at IS_NOT_IN_DB on form
delete processing.

...
  File /home/alan/web2py-hg/gluon/validators.py, line 553, in
__call__
elif str(rows[0].id) != str(self.record_id):
  File /home/alan/web2py-hg/gluon/dal.py, line 4996, in __getattr__
return self[key]
  File /home/alan/web2py-hg/gluon/dal.py, line 4987, in __getitem__
return dict.__getitem__(self, key)
KeyError: 'id'


Here are the changes to validators.py i made to avoid the exception:

(from line 542)
...
table = self.dbset.db[tablename]
...
elif str(rows[0][table.id.name]) != str(self.record_id):
...

First the special attribute id.name is retrieved to store the actual
id field name, and then, the Row.id syntax is replaced with dict
element notation

On 21 ene, 19:00, Alan Etkin spame...@gmail.com wrote:
 I recently updated my web2py source code from the mercurial repository

 I think that something has changed in SQLFORM that is incompatible
 with custom id field names declared with:

 Field(other_id, ...)

 On form processing, record updates stop the app with this error:

 Traceback (most recent call last):
   File /home/alan/gestionlibre/gestionlibre_gui-hg/controllers/
 appadmin.py, line 178, in update
     if session.form.accepts(evt.args, formname=None, keepvalues=False,
 dbio=False):
   File /home/alan/web2py-hg/gluon/sqlhtml.py, line 1050, in accepts
     (formname_id, record_id) = (self.record[id_fieldname],
   File /home/alan/web2py-hg/gluon/dal.py, line 4987, in __getitem__
     return dict.__getitem__(self, key)

 I managed to solve the problem for updates by changing sqlhtml.py in
 this way:

 (Line 1039)
                 # retrieve the actual id name (for legacy databases)
                 try:
                     id_fieldname = self.table.id.name
                 except (IndexError, AttributeError):
                     # could not retrieve the table id value
                     id_fieldname = id
                 # former notation was self.record.id Check for
 compatibility
                 (formname_id, record_id) = (self.record[id_fieldname],
                                             request_vars.get('id',
 None))

 The problem seems to be related to SQLFORM trying to get the default
 id key from table records, and may reproduce in other instances, since
 I see that the record.id property is being called in other sections of
 the module.

 I'd continue with the fix to provide a complete modification of the
 module if the solution provided has no backward compatibility or other
 problems.

 Thanks


[web2py] Re: PyCharm for web2py development -- interest in a third-party plugin?

2012-01-21 Thread monotasker
Yeah, I'm not sure either. And I'm not sure it matters as much as having 
good interactions going forward.


Re: [web2py] PyCharm for web2py development -- interest in a third-party plugin?

2012-01-21 Thread monotasker
Well, I heard back about plugin development and it turns out that plugins 
can only be written in Java. That rules me out. I'm still trying to get my 
mind around Python. But the plugin API is available at 
http://confluence.jetbrains.net/display/IDEADEV/PluginDevelopment if you or 
anyone else wants to take a swing. Too bad that they don't have Python 
bindings.

Ian



[web2py] Re: Ho to implement a SignIn with multiple verified email addresses.

2012-01-21 Thread Alan Etkin
Don't know if there is something already provided by the web2py Auth
class, but I think this could be accomplished with custom auth_user
fields (The book has examples for auth tables customization in 9.1.4)

One way would be to inspect the form returned by auth.login() and
search the user account related to the email specified to replace the
login email value with the default user's email before processing the
form.

Maybe you could use a list:string field type for storing extra email
accounts with unique value validator.

On registration, extra email fields could be configured as non
readable and shown only in the profile form

So the workflow could be:
Send a login standard form to the user
If a query for email fields in auth_user returns a user, change the
login value with the user's default email.
Continue login with auth.login_bare


On 21 ene, 14:12, thstart thst...@gmail.com wrote:
 I need to implement the following. Basically a SignIn with multiple
 verified email addresses.

    1. A first time email/password SignUp.
    2. Registered emails - send verification to the email account and
    verified from the user after click. (this is done).
    3. Each of the registered emails plus the initial SignUp email to be a
    valid email address for email/password SignIn. The password - the same as
    the initial Sign Up.

 e.g. the user SignUp with ema...@...com/password, then he
 registers/verifies two more emails: ema...@...com, email3...com. when he
 logs in next time he can login with:

 ema...@...com/password
 ema...@...com/password
 ema...@...com/password

 Security is OK because he is the owner of ema...@...com,
 ema...@...com and proves it by SignIn to these email accounts.
 ema...@...com is pending until he does the same as for other email
 addresses.

 How to accomplish this?


[web2py] Re: Python for Android (any takers to run web2py)

2012-01-21 Thread Changju
AirDroid is a good example.
https://market.android.com/details?id=com.sand.airdroidfeature=search_resulthl=en


On Jan 10, 11:34 am, Plumo richar...@gmail.com wrote:
 what is the use case for running a web framework on your Android phone?


Re: [web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Bruno Rocha
session.auth.user = auth.login_bare(someusername, somepassword)

On Sat, Jan 21, 2012 at 1:38 PM, Anthony abasta...@gmail.com wrote:

 I haven't tried it, but maybe something along these lines:

 def login():
 form = auth.login(next=URL('default', 'login'))
 if not request.post_vars:
 return form.formkey

 On the client side, you would make an initial Ajax request to login() when
 setting up your login form/widget -- in that case, login() will return a
 formkey as a string (which it will also store in the session). Upon login,
 send an Ajax post request to login() with the formkey value in a '_formkey'
 field. Once the login is processed, it should redirect back to login(),
 which will then return a new formkey value.

 Anthony


 On Friday, January 20, 2012 8:45:39 AM UTC-5, Phyo Arkar wrote:

 To keep it simple.

 How can i login (without using form) to web2py Auth  via AJAX?

 Thanks

 Phyo.


 On Fri, Jan 20, 2012 at 7:45 PM, Phyo Arkar phyo.ar...@gmail.com wrote:

 hello web2py.

 I am trying to get auth working with qooxdoo , can i know how should i
 login using ajax and (ofcoz use session) of webpy?

 Thanks

 Phyo.





-- 

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


Re: [web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Anthony
Thanks, Bruno -- completely forgot about login_bare.

On Saturday, January 21, 2012 7:21:53 PM UTC-5, rochacbruno wrote:

 session.auth.user = auth.login_bare(someusername, somepassword)

 On Sat, Jan 21, 2012 at 1:38 PM, Anthony abas...@gmail.com wrote:

 I haven't tried it, but maybe something along these lines:

 def login():
 form = auth.login(next=URL('default', 'login'))
 if not request.post_vars:
 return form.formkey

 On the client side, you would make an initial Ajax request to login() 
 when setting up your login form/widget -- in that case, login() will return 
 a formkey as a string (which it will also store in the session). Upon 
 login, send an Ajax post request to login() with the formkey value in a 
 '_formkey' field. Once the login is processed, it should redirect back to 
 login(), which will then return a new formkey value.

 Anthony


 On Friday, January 20, 2012 8:45:39 AM UTC-5, Phyo Arkar wrote:

 To keep it simple.

 How can i login (without using form) to web2py Auth  via AJAX?

 Thanks

 Phyo.


 On Fri, Jan 20, 2012 at 7:45 PM, Phyo Arkar phyo@gmail.com wrote:

 hello web2py.

 I am trying to get auth working with qooxdoo , can i know how should i 
 login using ajax and (ofcoz use session) of webpy?

 Thanks

 Phyo.





 -- 

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



Re: [web2py] Re: Web2py auth and Qooxdoo

2012-01-21 Thread Bruno Rocha
Thats what I have in http://movu.ca

def loginbare(self):
username = self.request.vars.email
password = self.request.vars.password
user = auth.login_bare(username, password)
if user:
redirect(URL('person', 'show'))
else:
redirect(URL('home', 'index', args=[username, 'loginerror']))

So I have a form that posts username and password to /loginbare action (it
can be done in ajax)


-- 

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


Re: [web2py] web2py with Plesk Control Panel ?

2012-01-21 Thread Bruno Rocha
Plesk does allow overriding vhost directives and also Plesk has mod python
(verify if it is installed)

So you can try to create or edit a vhost.conf file in the right directory;

*sudo vim /home/www/vhosts/yourdomain.com/conf/vhost.conf*

Then simply add your vhost directives:

*ServerAdmin y...@yourdomain.com
 DocumentRoot /var/www/vhosts/yourdomain.com/httpdocs/web2py
 SetHandler python-program
 PythonHandler modpythonhandler
 PythonPath \['/path/to/web2py/'] + sys.path\
 PythonOption SCRIPT_NAME /yourappname*
 ...


Then you just have to refresh Plesk's config and restart apache:

*/usr/local/psa/admin/sbin/websrvmng --reconfigure-vhost --vhost-name=
yourdomain.com
/etc/init.d/httpd graceful*




On Sat, Jan 21, 2012 at 8:32 PM, Ben Tammetta b...@clubelite.com wrote:

 Hello,

 I have a VPS running on CentOS that comes with Plesk.  It seems there
 are instructions to setup web2py with apache in the online book, but I
 am afraid making config file changes could mess up the Plesk
 management system.

 So can anyone provide any guidance or links to instructions to setup
 web2py to integrate smoothly with the Plesk control panel?

 It is great that web2py can be downloaded and running in just a couple
 of minutes.. but we need an easily to deploy solution that plays well
 with 90% of the most common hosting environments hosting providers
 provide.
 Namely Cpanel and Plesk. If this were easier to deploy in such
 environments I think we would see a whole lot more web2py
 deployments.   At least in my world as I could slowly transition
 current and new client websites to a web2py setup.




-- 

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


[web2py] Re: passing navigational links in the header and ajax woes

2012-01-21 Thread Massimo Di Pierro
In your code you have many calls to this:

   db(db.mydb.id==request.args(0)).select().first()

which could be simplified into the equivalent expression

   db.mydb(request.args(0))

You also have this:

records=db(db.mydb.id==request.args(0)).select()
...
counter=len(records)

but id is unique so counter is always only 1 or 0.

You also have:

check=db(db.mydb.id==request.args(0)).select().first()
if check !=None:

else:
row = db(db.mydb.id==request.args(0)).select().first()

so row is exactly like check and therefore always None.

Basically you code is equivalent to this:

def my_func():
    if request.args:
        row = db.mydb(request.args(0))
counter = 1 if row else 0
        if not row: # should be if row?
            my_id=row.id # always fails!
            (filename, stream)
= db.mydb.myfield.retrieve(row.resourcefield)
            myfunc(id,filename,stream)
    else:
        redirect(URL('mycontroller','this_function'))
records = [row] if row else []
    return(counter=counter, records=recods, row=row)

On Jan 21, 5:54 am, web-dev-m mgrave...@gmail.com wrote:
 Dear Massimo,

 Thank you in advance for your time just looking.  If I can write a
 functional web application, you must be brilliant to have created this
 software.

 I am essentially trying to write a google docs clone with the ability
 to add notes.

 My users upload documents which a python function uses, modifies, and
 then stores the text in the database.  The view displays the text from
 the page in a set of divs.  I then use AJAX to create a note on the
 side via a form.

 The text from the document and the document title/file are in
 different tables.  Also, there is not guaranteed to be file text yet,
 as not every user that uploads a file will need to see the text, so I
 upload the file and get the text in two separate functions.

 My workflow is:

 1.) check to see if file exists in database
 2.) IF it doesnt, make it, and store the text in a table, then get the
 text fields.
 3.) IF it does, get the text fields from one table and the filename
 from another
 4.) Display file text in the view

 I then use AJAX to add a form which allows the user to add a note next
 to the text.


[web2py] Auth.registration_requires_invitation

2012-01-21 Thread Bruno Rocha
Hi,

I am planning to develop an registration requires invitation to my custom
Auth.

auth.settings.registration_requires_invitation = True
auth.messages.invitation = \
'HI, You have been invited to join X, click on the link
http://' + self.db.request.env.http_host + \
self.db.CURL('default', 'user', args=['invite']) + \
'?invitationkey=%(key)s to register'

The flow is:

Registered user goes to /default/user/invite, so the user puts the e-mail
of a friend and auth does:


   1. Store an invitation key in to auth_invitation table
   (user_id_who_invited, invitation_key, invited_id, signature)
   2. Send an email to the invited user with a link to the register page
   with   ?invitationkey=KFDNJFLDKNFJDLNFJDNF*9340540985
   3. Invited user clicks in the link, auth checks if invitation ID exists,
   so user are redirected to the register page, if sucess invitation_key is
   set to NULL, invited_id is set to the new user id.
   4. The user who invited receives an confirmation email The user you
   have invited registered!

Auth will have a function bulk_invitation(list_of_emails) so developers can
use to send mass invitation

Have somebody already implemented this? can share?
what are the chances to include it in Auth?


-- 

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


[web2py] Re: [w2py-dev] Auth.registration_requires_invitation

2012-01-21 Thread Massimo Di Pierro
I would include it in auth. It should be easy to implement as follows:

The inviter creates a new record for the invitee and triggers a request reset 
password request with an optional custom message.
You do not need an extra table for invitations. You may need an extra field for 
auth_user to store the the id of the person who created the record (invitation) 
if not self.


On Jan 21, 2012, at 11:40 PM, Bruno Rocha wrote:

 Hi,
 
 I am planning to develop an registration requires invitation to my custom 
 Auth.
 
 auth.settings.registration_requires_invitation = True
 auth.messages.invitation = \
 'HI, You have been invited to join X, click on the link 
 http://' + self.db.request.env.http_host + \
 self.db.CURL('default', 'user', args=['invite']) + \
 '?invitationkey=%(key)s to register'
 
 The flow is:
 
 Registered user goes to /default/user/invite, so the user puts the e-mail of 
 a friend and auth does:
 
 Store an invitation key in to auth_invitation table  (user_id_who_invited, 
 invitation_key, invited_id, signature)
 Send an email to the invited user with a link to the register page with   
 ?invitationkey=KFDNJFLDKNFJDLNFJDNF*9340540985
 Invited user clicks in the link, auth checks if invitation ID exists, so user 
 are redirected to the register page, if sucess invitation_key is set to NULL, 
 invited_id is set to the new user id.
 The user who invited receives an confirmation email The user you have 
 invited registered!
 Auth will have a function bulk_invitation(list_of_emails) so developers can 
 use to send mass invitation
 
 Have somebody already implemented this? can share?
 
 what are the chances to include it in Auth?
 
 
 -- 
 
 Bruno Rocha
 [http://rochacbruno.com.br]
 
 
 -- 
 mail from:GoogleGroups web2py-developers mailing list
 make speech: web2py-develop...@googlegroups.com
 unsubscribe: web2py-developers+unsubscr...@googlegroups.com
 details : http://groups.google.com/group/web2py-developers
 the project: http://code.google.com/p/web2py/
 official : http://www.web2py.com/



Re: [web2py] Guidence on using web2py for a facebook canvas app or tab page app

2012-01-21 Thread Ben Tammetta
Hello,

Thanks for the answer.  I have spent lots more time reading and testing but 
I am still having problems.  
The code example you link to is very old.   It is very different from the 
most recent code found here.
https://github.com/pythonforfacebook/facebook-sdk

I have read the online book here regarding OAuth and Facebook.
I tried getting something to work with this code but have not as well.

http://web2py.com/books/default/chapter/29/9?search=facebook#Integration-with-OpenID,-Facebook,-etc.

Looking here.
http://code.google.com/p/web2py/source/browse/gluon/contrib/login_methods/oauth20_account.py
The comments in the code say to override the get_user() method.  I have 
tried this using the code in the online book with no luck either.  

Pedro's answer on this page seems like the most sensible way to go about 
things but I 
have not got it working either.
http://stackoverflow.com/questions/2727118/getting-facebook-oauth-access-token-through-python-sdk-does-not-seem-to-be-worki

I had something working in PHP in no time but have spent days trying to get 
a user id from facebook with web2py and still nothing.  Very frustrating.  
:(

Any more suggestions? links or examples that might help me?