Re: [web2py] Re: Problem with .smartgrid on tables with links

2012-01-24 Thread Bruno Rocha
*I forgot to mention that the error was in /default/user/profile action*

On Wed, Jan 25, 2012 at 4:51 AM, rochacbruno  wrote:

> I just got the same error
>
>  '_id'
>
> Traceback (most recent call last
> ):
>   File "/home/bruce/projects/web2py/gluon/restricted.py", line 204, in 
> restricted
>
> exec ccode in environment
>   File 
> "/home/bruce/projects/web2py/applications/demo/controllers/appadmin.py" 
> , line 
> 466, in 
>
>   File "/home/bruce/projects/web2py/gluon/globals.py", line 172, in 
>
> self._caller = lambda f: f
> ()
>   File 
> "/home/bruce/projects/web2py/applications/demo/controllers/appadmin.py" 
> , line 
> 313, in update
>
> if form.accepts(request.vars, session):
>
>   File "/home/bruce/projects/web2py/gluon/sqlhtml.py", line 1088, in accepts
>
> hideerror=hideerror,
>   File "/home/bruce/projects/web2py/gluon/html.py", line 1807, in accepts
>
> status = self._traverse(status,hideerror)
>
>   File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
>
> newstatus = c._traverse(status,hideerror) and newstatus
>
>   File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
>
> newstatus = c._traverse(status,hideerror) and newstatus
>
>   File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
>
> newstatus = c._traverse(status,hideerror) and newstatus
>
>   File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
>
> newstatus = c._traverse(status,hideerror) and newstatus
>
>   File "/home/bruce/projects/web2py/gluon/html.py", line 756, in _traverse
>
> newstatus = self._validate()
>   File "/home/bruce/projects/web2py/gluon/html.py", line 1572, in _validate
>
> (value, errors) = validator(value)
>
>   File "/home/bruce/projects/web2py/gluon/validators.py", line 549, in 
> __call__
>
> elif str(rows[0]._id) != str(self.record_id):
>
>   File "/home/bruce/projects/web2py/gluon/dal.py", line 5466, in __getattr__
>
> return self[key]
>   File "/home/bruce/projects/web2py/gluon/dal.py", line 5457, in __getitem__
>
> return dict.__getitem__(self, key)
> KeyError: '_id'
>
> with default auth_user table and some extra_fields added
>
>
>


-- 

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


Re: [web2py] Re: Problem with .smartgrid on tables with links

2012-01-24 Thread rochacbruno
I just got the same error

 '_id'

Traceback (most recent call last):
  File "/home/bruce/projects/web2py/gluon/restricted.py", line 204, in 
restricted
exec ccode in environment
  File "/home/bruce/projects/web2py/applications/demo/controllers/appadmin.py" 
, line 
466, in 
  File "/home/bruce/projects/web2py/gluon/globals.py", line 172, in 
self._caller = lambda f: f()
  File "/home/bruce/projects/web2py/applications/demo/controllers/appadmin.py" 
, line 
313, in update
if form.accepts(request.vars, session):
  File "/home/bruce/projects/web2py/gluon/sqlhtml.py", line 1088, in accepts
hideerror=hideerror,
  File "/home/bruce/projects/web2py/gluon/html.py", line 1807, in accepts
status = self._traverse(status,hideerror)
  File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/home/bruce/projects/web2py/gluon/html.py", line 749, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
  File "/home/bruce/projects/web2py/gluon/html.py", line 756, in _traverse
newstatus = self._validate()
  File "/home/bruce/projects/web2py/gluon/html.py", line 1572, in _validate
(value, errors) = validator(value)
  File "/home/bruce/projects/web2py/gluon/validators.py", line 549, in __call__
elif str(rows[0]._id) != str(self.record_id):
  File "/home/bruce/projects/web2py/gluon/dal.py", line 5466, in __getattr__
return self[key]
  File "/home/bruce/projects/web2py/gluon/dal.py", line 5457, in __getitem__
return dict.__getitem__(self, key)
KeyError: '_id'

with default auth_user table and some extra_fields added




[web2py] Re: Error with ignore_common_filters when using a select string (instead of a DAL query)

2012-01-24 Thread Anthony
We recently discussed this 
here: https://groups.google.com/forum/?fromgroups#!topic/web2py/Ez_pxGFCsVE

The book implies passing a string as a query will 
work: http://web2py.com/books/default/chapter/29/7#Links-to-referencing-records 
(see the list_records function).

However, appadmin doesn't try to use the string as a query -- it execs the 
string to make it a 
query: 
http://code.google.com/p/web2py/source/browse/applications/welcome/controllers/appadmin.py#90

I suppose it could be a security risk if the string is coming from an 
untrusted source.

Anthony

On Tuesday, January 24, 2012 10:15:24 PM UTC-5, Massimo Di Pierro wrote:
>
> Can you check trunk? I have fixed that one line but not sure if this 
> should be supported and what the consequences. 
>
> On Jan 24, 8:40 pm, pbreit  wrote: 
> > I'm getting an error when using a string as a query instead of an actual 
> > DAL-style query object. This used to work. My guess is that it broke 
> around 
> > the time of this changeset which implemented "ignore_common_filters": 
> > ee791c9a6b9c<
> http://code.google.com/p/web2py/source/detail?path=/gluon/dal.py&r=ee...> 
> > 
> >   File "/Users/pbreit/web2py/gluon/dal.py", line 1194, in _select 
> > if query and not query.ignore_common_filters: 
> > AttributeError: 'str' object has no attribute 'ignore_common_filters' 
> > 
> > query"grouping!='test' AND status='active' AND title LIKE 
> '%newer%'"query.ignore_common_filtersundefined 
> > 
> > My code looks something like this: 
> > 
> > query = "status='active'" 
> > 
> > rows = db(query).select(db.item.ALL) 
> > 
> > I'm using a string as a query in order to do a Postgres full text search.



Re: [web2py] how we create admin password and placed in parameters_PORTNUM.py file manually

2012-01-24 Thread Bruno Rocha
sudo -u www-data python -c "from gluon.main import save_password;
save_password('somepassword', portnumber)"



On Wed, Jan 25, 2012 at 1:22 AM, blackshirt wrote:

> i just want to know, is it possible to reconstruct password entries on
> parameters_PORTNUM.py file manually ??
> if it possible, how we can build this password manually ??
>
> Thanks
>



-- 

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


[web2py] how we create admin password and placed in parameters_PORTNUM.py file manually

2012-01-24 Thread blackshirt
i just want to know, is it possible to reconstruct password entries on
parameters_PORTNUM.py file manually ??
if it possible, how we can build this password manually ??

Thanks


[web2py] Re: Error with ignore_common_filters when using a select string (instead of a DAL query)

2012-01-24 Thread Massimo Di Pierro
Can you check trunk? I have fixed that one line but not sure if this
should be supported and what the consequences.

On Jan 24, 8:40 pm, pbreit  wrote:
> I'm getting an error when using a string as a query instead of an actual
> DAL-style query object. This used to work. My guess is that it broke around
> the time of this changeset which implemented "ignore_common_filters":
> ee791c9a6b9c
>
>   File "/Users/pbreit/web2py/gluon/dal.py", line 1194, in _select
>     if query and not query.ignore_common_filters:
> AttributeError: 'str' object has no attribute 'ignore_common_filters'
>
> query"grouping!='test' AND status='active' AND title LIKE 
> '%newer%'"query.ignore_common_filtersundefined
>
> My code looks something like this:
>
> query = "status='active'"
>
> rows = db(query).select(db.item.ALL)
>
> I'm using a string as a query in order to do a Postgres full text search.


[web2py] Error with ignore_common_filters when using a select string (instead of a DAL query)

2012-01-24 Thread pbreit
I'm getting an error when using a string as a query instead of an actual 
DAL-style query object. This used to work. My guess is that it broke around 
the time of this changeset which implemented "ignore_common_filters":
ee791c9a6b9c



  File "/Users/pbreit/web2py/gluon/dal.py", line 1194, in _select
if query and not query.ignore_common_filters:
AttributeError: 'str' object has no attribute 'ignore_common_filters'


query"grouping!='test' AND status='active' AND title LIKE 
'%newer%'"query.ignore_common_filtersundefined


My code looks something like this:


query = "status='active'"

rows = db(query).select(db.item.ALL)


I'm using a string as a query in order to do a Postgres full text search.



[web2py] Re: view txt,pdf etc

2012-01-24 Thread Anthony
What problem are you having? Can you show the code you tried? What did you 
expect, and what did you see?

On Tuesday, January 24, 2012 4:10:57 PM UTC-5, davidjensen wrote:
>
> I am trying to write html that enables you to view pdf, etc in the 
> browser. This is easy to do in www.mydomain.com/mypdf.pdf 
> How do I do this? previous posts said I had to go to a non web2py 
> site. like app engine? If so, isn't this a bug that should be fixed 
> since displaying pdf, txt, etc is common?



[web2py] Re: using existing sqlite3 database in web2py without using DAL ?

2012-01-24 Thread Anthony
You don't have to use the DAL, but as Massimo pointed out, SQLFORM uses it 
(I suppose you could still use SQLFORM.factory and manually handle 
inserts/updates). Note, you don't necessarily have to create DAL models for 
every table in your db -- you can model just a subset that would be most 
helpful (e.g., those used with forms). There's also this script 
(http://code.google.com/p/web2py/source/browse/scripts/extract_pgsql_models.py) 
for automatically creating DAL models from an existing Postgres database -- 
perhaps you could adapt it for SQLite.

Anthony

On Tuesday, January 24, 2012 4:54:13 PM UTC-5, Nomad wrote:
>
> Im looking for feedback on if this is poor practice
>
> situation: i have an existing service that uses a sqlite3 database i was 
> asked to port to a webapp. Being semi-familiar with MVCs and web2py i 
> decided to give this a go. We have functions defined in python to return 
> the expected data already.the app itself has 18+ months worth of data
>
> problem: reading up on the pdf manual (we written btw) it seems like using 
> a DAL i have to define every naunce of the current database. Also, there is 
> strong change of data type changing based on the description.
>
> Is it bad practice just to import sqlite3 and call it a day ? Is there any 
> strong advantage to using a DAL ? or am i simply over thinking the problem ?
>
> feed back would be appreciated
>


[web2py] High memory usage in webfaction

2012-01-24 Thread Joseph Jude
Dear All,
I was expecting when I am going to get this message from webfaction team 
and I got it today. I have searched through this group and found that I 
could use uwsgi server. Before I go ahead and make changes on the site, I 
got few questions:
1. Currently it is running on apache. How do I make the switch to uwsgi and 
disable apache?
2. In the error message that webfaction sent, there are processes that 
running for 23 days (and there are many) and that adds to the memory. How 
do I know what are the unnecessary processes and kill them?
3. There is a expire_sessions.py in admin app. Does that help and if so, 
how?

Thank you,
Joseph
http://www.jjude.biz


[web2py] Re: Need help with selecting multiple rows into a single row

2012-01-24 Thread Adi
Thanks Alan for your advise, but I'm not sure how I would implement what 
you are suggesting? 

For now I use smartgrid's onpdate and oncreate events to update purchase 
order "items" field (type list:string) with all items for that particular 
order, but I hate this solution since it's computed value. This way I can 
product csv easier, but would rather flatten two tables into one at the 
time when the report is run. 

Thanks once again... and i'm still open for more suggestions, if anyone has 
any idea. 

Adi



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

2012-01-24 Thread thstart
the simplest way to implement without changing
auth table is:

1) user logs in with email/password

2) my app checks if login passed through

3) if not my app checks if the email entered 
in login matches a list in a different table.

4) if it matches, it checks the password if matches
in auth table and if it matches, the login is OK.

To make this working I need info on 2) and 4)



Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-24 Thread Bruno Rocha
Yes it is very nice, I am already using since the beta in http://movu.ca, I
am also developing a boostrap theme for the CMS

-- 

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


Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-24 Thread David J
Yeah setup bs2 today and its really sweet. Just need to make some class
changes from v1.4
On Jan 24, 2012 6:47 PM, "pbreit"  wrote:

> Looks like Twitter Bootstrap 2 is ready. I've seen some positive comments
> about it in regards to the switch to 12 columns and responsiveness.


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

2012-01-24 Thread pbreit
Interesting concept. It's not common but I have seen it at sites like 
PayPal. Might not be a bad addition to auth. As mentioned above, one 
approach may be to use list:string for the auth_user email field. Or maybe 
add a field for "secondary emails" since you probably want one email 
address to be "primary". But if you are going to want to store information 
about each email address (for example, suppress marketing messages), you'd 
probably need to create and email address table with references to 
auth_user.

Re: [web2py] Re: web2py with twitter bootstrap - very clean interface ...

2012-01-24 Thread pbreit
Looks like Twitter Bootstrap 2 is ready. I've seen some positive comments 
about it in regards to the switch to 12 columns and responsiveness.

[web2py] Re: How to get unencrypted auth password?

2012-01-24 Thread thstart
Hi Massimo,

Could you please comment on related question?

https://groups.google.com/forum/#!topic/web2py/DXQ9hBAuVDA 

Tanks in advance,
--Constantine


[web2py] Re: How to get unencrypted auth password?

2012-01-24 Thread thstart
it was not needed to decrypt I wanted to say.

[web2py] Re: How to get unencrypted auth password?

2012-01-24 Thread thstart
I needed to transfer accounts to a new server. 

It turns out it is not needed.


[web2py] Re: How to get unencrypted auth password?

2012-01-24 Thread Massimo Di Pierro
If that were possible web2py would have a vulnerability.

On Jan 24, 9:43 am, thstart  wrote:
> I need to unencrypt auth password having the key.
>
> How to do that?


[web2py] Re: using existing sqlite3 database in web2py without using DAL ?

2012-01-24 Thread Massimo Di Pierro
The reason you have to define tables in dal is that a string field in
the database may be just a string field but may be a password, or a
filename at the web2py level. web2py needs to know. If you do not care
and you have no plans to move to any other db engine, than there is
nothing wrong in using raw sql. SQLFORMs and grid will not work.


On Jan 24, 3:54 pm, Nomad  wrote:
> Im looking for feedback on if this is poor practice
>
> situation: i have an existing service that uses a sqlite3 database i was
> asked to port to a webapp. Being semi-familiar with MVCs and web2py i
> decided to give this a go. We have functions defined in python to return
> the expected data already.the app itself has 18+ months worth of data
>
> problem: reading up on the pdf manual (we written btw) it seems like using
> a DAL i have to define every naunce of the current database. Also, there is
> strong change of data type changing based on the description.
>
> Is it bad practice just to import sqlite3 and call it a day ? Is there any
> strong advantage to using a DAL ? or am i simply over thinking the problem ?
>
> feed back would be appreciated


[web2py] using existing sqlite3 database in web2py without using DAL ?

2012-01-24 Thread Nomad
Im looking for feedback on if this is poor practice

situation: i have an existing service that uses a sqlite3 database i was 
asked to port to a webapp. Being semi-familiar with MVCs and web2py i 
decided to give this a go. We have functions defined in python to return 
the expected data already.the app itself has 18+ months worth of data

problem: reading up on the pdf manual (we written btw) it seems like using 
a DAL i have to define every naunce of the current database. Also, there is 
strong change of data type changing based on the description.

Is it bad practice just to import sqlite3 and call it a day ? Is there any 
strong advantage to using a DAL ? or am i simply over thinking the problem ?

feed back would be appreciated


[web2py] Re: How to get unencrypted auth password?

2012-01-24 Thread pbreit
I don't think that's possible. It's one-way hashed specifically to prevent 
unencryption.

[web2py] view txt,pdf etc

2012-01-24 Thread davidjensen
I am trying to write html that enables you to view pdf, etc in the
browser. This is easy to do in www.mydomain.com/mypdf.pdf
How do I do this? previous posts said I had to go to a non web2py
site. like app engine? If so, isn't this a bug that should be fixed
since displaying pdf, txt, etc is common?


[web2py] Re: Stalling out early on... blank page in 'MyApp'

2012-01-24 Thread Monte Milanuk
Ack... missed the '='... whoops.  Sorry for the noise.






[web2py] Stalling out early on... blank page in 'MyApp'

2012-01-24 Thread Monte Milanuk
Hello all,

Getting started with the tutorial in the docs... edited default.py as directed
and things worked as expected.  Edited default/index.html to include the bare
html tags as shown in the tutorial... and nothing.  On reloading I get just a
blank browser window for a view.

After spending some time fussing with it, I deleted the web2py directory (on
Windows XP Professional, running from a folder on a USB stick) and unpacked the
downloaded zip file again.  Started over from scratch, but hit the same problem
again at the same point, looks the same whether using IE7 or FF9.

What am I missing here?

Thanks,

Monte



[web2py] Re: First chapter that should be useful to some web2py users

2012-01-24 Thread Willoughby
Awesome!  Can't wait to check this out...


Re: [web2py] Re: google code (mercurial) problem

2012-01-24 Thread Bruno Rocha
I am using Git
Em 24/01/2012 12:20, "Ross Peoples"  escreveu:

> Which one are we using as the primary repo now, is it Google Code or
> GitHub?


Re: [web2py] Re: book 4th edition in PDF

2012-01-24 Thread António Ramos
Well, i need a donation too :)

2012/1/24 Magnitus 

> If it helps, consider it a donation with benefits ;).
>


[web2py] First chapter that should be useful to some web2py users

2012-01-24 Thread ma...@rockiger.com
Hello,
the tutorial is making some progress:

Begining with chapter 5, it should be interesting for web2py users, that 
are already familiar with the basics of web2py and want
to learn about functional testing with selenium.

Some links to start: 
Selenium setup: http://killer-web-development.com/section/4/3
First tests: http://killer-web-development.com/section/5/1

Again this is very basic, but might be interesting to someone.

Best,
Marco


Re: [web2py] Re: book 4th edition in PDF

2012-01-24 Thread Magnitus
If it helps, consider it a donation with benefits ;).


Re: [web2py] Re: book 4th edition in PDF

2012-01-24 Thread António Ramos
i bought the 3rd edition from LULU.
can i get a free pdf of the 4th edition?


[web2py] Re: book 4th edition in PDF

2012-01-24 Thread Magnitus
I gave up on the first attempt after waiting over 10 minutes for a reply.

Second attempt worked and promptly.

Used Visa.

btw, thanks for the reasonable pricing on the pdf format.

I hate it when the price for the physical copy and the price for the pdf 
are almost the same.


[web2py] How to get unencrypted auth password?

2012-01-24 Thread thstart
I need to unencrypt auth password having the key.

How to do that?


[web2py] Re: email_auth works on web2py server, but not GAE

2012-01-24 Thread Alan Etkin
You could try printing this command's output to the console in
development:

...
server.login(email, password)
...

It is in line 29 of /gluon/contrib/
login_methods/email_auth.py

gluon/contrib/login_methods/email_auth.py

On 23 ene, 13:48, pattu  wrote:
> Hi -
>
> Fairly silently.  In the case of running the dev_appserver.py -
> submitting a correct email and password to login form just shows a
> very quick response of invalid login (flash message).  Compared to
> running the web2py built in web server the response is too fast to let
> me believe that my computer talked to the smtp server I am validating
> against.. i.e. the request just failed as a failed login.  But I am
> testing against my organization's smtp and against the gmail smtp,
> which work fine with the web2py built in server.
>
> I am not an experienced python debugger, and my attempts to try and
> step through the smtplib code fail with the GAE - funny errors like
> non-ascii characters in the source files, which make me think that
> debugger I tried (winpdb) didn't like the GAE environment.
>
> The deployed application also shares the same problem.
>
> Somehow debugging whether GAE is letting a TLS request go through
> correctly seems puzzling.  I was fairly interested in using the GAE
> because it came with an easy https access option, (I don't mind the
> appspot subdomain).  I have a short term app that I wanted security
> for.  Googling I've seen some mentions that sockets are not
> implemented fully on GAE, but I don't know if that is currently the
> case.  I would be delighted to get an error message or exception - let
> me know how to turn that on if it exists in inside the smtplib, for
> example.
>
> There could be some silly mistake I am making - I have made a few
> hundred so far, but because the implementation in this case seems so
> simple, I think that GAE might be at fault.  Is there a workaround do
> you think?  In anycase this development process has really been fun -
> web2py is a nice environment to work in.
>
> On Jan 23, 7:21 pm, Massimo Di Pierro 
> wrote:
>
> > Did you try it? How does it fail?
>
> > On Jan 23, 4:07 am, pattu  wrote:
>
> > > Hi -
>
> > > I have found 150 answers to different questions already by googling my
> > > way through this list, but I didn't find anything addressing
> > > email_auth (using an smtp server).  Here is code that works fine
> > > running the web2py server, but seems to fail both on the GAE
> > > development server and also deployed.  I might have missed something,
> > > but I have tried to be exhaustive here:
>
> > > ###
> > >  #
> > > #Test this out:  Doesn't work on GAE in development or on Appspot... =-
> > > (
> > > ###
> > >  #
> > > #
> > > #
> > > from gluon.contrib.login_methods.email_auth import email_auth
>
> > > #Try with default - same as auth.settings.login_methods =
> > > [email_auth(server="gmail.com:587", domain="@gmail.com")]
>
> > > auth.settings.login_methods = [email_auth()]
> > > auth.settings.actions_disabled=['register','change_password','request_reset
> > >  _password',
> > > 'profile']
>
> > > Has anybody used email_auth on gae?  Or does anyone know why it fails,
> > > and any ideas how to start debugging this?
>
> > > Patrick
>
>


[web2py] Re: accepts > KeyError: '_id', latest trunk with postgresql

2012-01-24 Thread Carlos
Thanks, just an update: I'm still getting this error, evern with latest 
trunk.



[web2py] Re: Some database related changes to web2py core

2012-01-24 Thread Massimo Di Pierro
Excellent! Thank you. Uploading your changes to trunk...

On Jan 24, 1:39 am, Ben Goosman  wrote:
> I'm not sure if these are actual bug fixes or simply misinformed hacks
> (please let me know), but I think they might be useful to the
> community. My notes are for version 1.99.2 so the line numbers may be
> a little off. Most of the changes are the result of trying to get
> Oracle and multiple key tables to work.
>
> I added values for 'reference FK' and 'reference 'TFK' in dal.py for
> the Oracle adapter.
> 'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%
> (field_name)s) REFERENCES %(foreign_key)s ON DELETE %
> (on_delete_action)s',
> 'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%
> (field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON
> DELETE %(on_delete_action)s',
>
> I changed line 1046 in sqlhtml.py perhttp://tinyurl.com/7wn8sjvwhich
> seems to allow the crud update page to display.
> # Before
> record_id = dict((k, request_vars[k]) for k in self.table._primarykey)
> # After
> record_id = dict((k, request_vars.get(k,None)) for k in
> self.table._primarykey)
>
> I changed line 761 in sqlhtml.py
> # Before
> self.record_id = dict([(k,record[k]) for k in table._primarykey])
> # After
> self.record_id = dict([(k,str(record[k])) for k in table._primarykey])
> which allows the crud update form to be submitted. The problem lied in
> the update form for dataSource. Since dataSource is keyed by
> source_id, SQLFORM uses source_id as the record_id for any record you
> edit. Web2py performs a security check on the value of the record_id
> before and after the form was submitted. If the record_id changes,
> web2py complains. Since source_id is an integer, web2py saved it as an
> integer into the record_id. Since source_id appears on the update
> form, it is converted to a string. Since num != 'num', a security
> error occurred. The temporary(?) solution is to convert every value in
> the record_id to a string before form submission.
>
> Changed line 3071 in tools.py
> # Before
> if not (isinstance(table, self.db.Table) or table in self.db.tables) \
>         or not str(record_id).isdigit():
>     raise HTTP(404)
> # After
> if not (isinstance(table, self.db.Table) or table in self.db.tables):
>     raise HTTP(404)
> This change should allow crud delete to work with keyed databases,
> since line 3090 can accept a dictionary of key assignments. Thus, for
> the dataSource table we can pass in dict(source_id=the_source_id) to
> crud.delete().


[web2py] Re: google code (mercurial) problem

2012-01-24 Thread Ross Peoples
Which one are we using as the primary repo now, is it Google Code or GitHub?

[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?

2012-01-24 Thread Anthony

>
> Also on Sign Up form I got a message 'too short' below the Password field 
> - in the book link there is not correspondent function to change it.


That's coming from the default CRYPT validator. Try:

db.auth_user.password.requires[-1].error_message = 'Your custom error 
message'

This assumes "requires" is a list (which it is by default when using 
auth.define_tables) -- if it is just a single CRYPT object, then no need 
for the [-1].

Anthony 


[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?

2012-01-24 Thread Anthony

>
> This is not working (it remains E-mail):
> auth.messages.label_email = 'Email'
>

Are you using the default auth.define_tables() to create you Auth models? 
You may need to show some code.
 

>
> Remember me (for 30 days works) - but there is a space above it up to 
> password - how to remove it?
>

Try inspecting the rendered HTML and figure out what the HTML/CSS should be 
-- then we can figure out how to generate it. 

Anthony


[web2py] Re: Output web2py Errors to stdout/shell/commandline

2012-01-24 Thread Alan Etkin
I cannot find a documented way of directing the traceback to the
console. A command line option to show traceback data in the console
might be useful.

On 23 ene, 13:13, Iwan Gabovitch  wrote:
> Hello,
>
> I run web2py locally, to develop a website. Whenever there is an error, I
> see a website that looks like this:
>
> *Internal errorTicket issued:
>
> > *vpp2py/127.0.0.1.2012-01-23.17-14-03.ef3e7489-1e25-4aaf-e143-9b27004c4a2c
>
> I would prefer to see the traceback in the shell.
>
> Is there a way to make web2py pass error messages to std output or a file
> (with human-readable formatting)?
>
> I can output the application/appname/error/* files (Thanks to the nice
> people of #bash at irc.freenode/net !):
>
> inotifywait . -m -e CLOSE_WRITE --format '%f' | while IFS= read -r f; do
> cat "$f" | sed -e 's/[^\]\\n/\n/g'; done
>
> but I have a bad feeling about this, especially because of strings like
> '\r' turning into '\\r' and '\n' being used in the file instead of
> proper(?) newlines. Here's an example of what the 3-rd last line of a log
> file looks like:
>
> S'Traceback (most recent call last):\n  File 
> "/home/qubodup/web/web2py/gluon/restricted.py", line 191, in restricted\n    
> ccode = compile2(code,layer)\n  File 
> "/home/qubodup/web/web2py/gluon/restricted.py", line 178, in compile2\n    
> return compile(code.rstrip().replace(\'\\r\\n\',\'\\n\')+\'\\n\', layer, 
> \'exec\')\n  File 
> "/home/qubodup/web/web2py/applications/vpp2py/models/db.py", line 38\n    
> plugins = PluginManager()x                      # for configuring plugins\n   
>                           ^\nSyntaxError: invalid syntax\n'
>
> Thanks for reading. If nobody knows a better solution, hopefully the 
> inotifywait line will come in handy to somebody else. :)


[web2py] Re: How to modify the look and text of: Remember me (for 30 days)?

2012-01-24 Thread Ross Peoples
There are settings for almost everything. Sometimes the book doesn't 
explain every single one though. The best way to figure out what's going on 
is to open the "gluon/tools.py" file, and find the Auth class. This class 
will have all the settings listed with their default values at the top of 
the class.

[web2py] Re: to the new user who posted a suggestions...

2012-01-24 Thread Anthony
On Tuesday, January 24, 2012 2:38:16 AM UTC-5, Ben Goosman wrote:
>
> Thanks Massimo, I didn't realize there was an approval stage. (hence 
> the 3 submissions :))
>

Only the first time you post (to prevent spammers from getting in). 


[web2py] Some database related changes to web2py core

2012-01-24 Thread Ben Goosman
I'm not sure if these are actual bug fixes or simply misinformed hacks
(please let me know), but I think they might be useful to the
community. My notes are for version 1.99.2 so the line numbers may be
a little off. Most of the changes are the result of trying to get
Oracle and multiple key tables to work.

I added values for 'reference FK' and 'reference 'TFK' in dal.py for
the Oracle adapter.
'reference FK': ', CONSTRAINT FK_%(constraint_name)s FOREIGN KEY (%
(field_name)s) REFERENCES %(foreign_key)s ON DELETE %
(on_delete_action)s',
'reference TFK': ' CONSTRAINT FK_%(foreign_table)s_PK FOREIGN KEY (%
(field_name)s) REFERENCES %(foreign_table)s (%(foreign_key)s) ON
DELETE %(on_delete_action)s',

I changed line 1046 in sqlhtml.py per http://tinyurl.com/7wn8sjv which
seems to allow the crud update page to display.
# Before
record_id = dict((k, request_vars[k]) for k in self.table._primarykey)
# After
record_id = dict((k, request_vars.get(k,None)) for k in
self.table._primarykey)

I changed line 761 in sqlhtml.py
# Before
self.record_id = dict([(k,record[k]) for k in table._primarykey])
# After
self.record_id = dict([(k,str(record[k])) for k in table._primarykey])
which allows the crud update form to be submitted. The problem lied in
the update form for dataSource. Since dataSource is keyed by
source_id, SQLFORM uses source_id as the record_id for any record you
edit. Web2py performs a security check on the value of the record_id
before and after the form was submitted. If the record_id changes,
web2py complains. Since source_id is an integer, web2py saved it as an
integer into the record_id. Since source_id appears on the update
form, it is converted to a string. Since num != 'num', a security
error occurred. The temporary(?) solution is to convert every value in
the record_id to a string before form submission.

Changed line 3071 in tools.py
# Before
if not (isinstance(table, self.db.Table) or table in self.db.tables) \
or not str(record_id).isdigit():
raise HTTP(404)
# After
if not (isinstance(table, self.db.Table) or table in self.db.tables):
raise HTTP(404)
This change should allow crud delete to work with keyed databases,
since line 3090 can accept a dictionary of key assignments. Thus, for
the dataSource table we can pass in dict(source_id=the_source_id) to
crud.delete().


[web2py] Re: Need help with selecting multiple rows into a single row

2012-01-24 Thread Alan Etkin
I think that your csv output should have a fixed column length. The
way you are trying to create the file would produce variable column
length for each row, unless you provide a way of adding the blank
fields.

Row objects have as_dict method. You could use this method to map row
data to a new table and create the csv file from it.

On 21 ene, 04:04, Adi  wrote:
> I am trying to export all rows from two tables, (e.g. purchase orders, and
> items) into a csv file, but if possible would like to export a single row
> per each purchase order (with belonging items divided into separate columns
> of the same row). I'm using MySQL, if it makes the difference.
>
> I read some comments about using the Expression or a function (from
> gluon.sql import Expression), but don't know how to go about it. Any advise?
>
> Thanks,
> Adnan
>
> >>> rows = db(db.purchase_order.id>0).select(db.purchase_order.po_number,
>
> db.item.id, left=db.item.on(db.purchase_order.id==db.item.po_id))
>
> >>> print rows
>
> results:
> purchase_order.po_number,item.id
> 201201120001,31
> 201201120001,41
> 201201120001,51
> 201201120001,61
> 201201160004,111
> 201201170005,151
> 201201006,161
>
> would prefer to have it like this:
> 201201120001,31,41,51,61
> 201201160004,111
> 201201170005,151
> 201201006,161


Re: [web2py] Problem with plugin_PowerFormWizard and Internetexplorer

2012-01-24 Thread Oli
thanks, i will try this later. I found a workaround for my Problem. The 
PowerFormWizard form was integrated in a Website of googlesites. When i 
open an extra window, which is not integrated in googlesites, all works 
fine.
 
Thanks OF.


[web2py] Re: Book-bug

2012-01-24 Thread Johann Spies
My original email was correct:

The statement in the book "*You can truncate the table, i.e., delete all
records and reset the counter of the id*."  is not correct.  The id-counter
does not get reset during truncate.  That is the case with Postgresql. I
have not tested that on other databases.

The book is correct far as SQLITE is concerned, but not with Postgresql.  I
just did another test on Postgresql:
In[14]: l = db(db.tut).select()

In [15]: l.last().id
Out[15]: 4487

In [16]: db.tut.truncate()

In [17]: db.commit()

In [18]: l = db(db.tut).select()

In [19]: len(l)
Out[19]: 0

In [22]: db.tut.import_from_csv_file(open('/home/js/Downloads/db_tut.csv',
'r'))

In [23]: l = db(db.tut).select()

In [24]: len(l)
Out[24]: 1495

In [25]: l.first().id
Out[25]: 4488

Regards
Johann


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