[web2py:35600] Re: Data parser advice sort from web2py developers

2009-11-19 Thread Carl

From the author of lxml (back in'06):
full XPath 1.0 support.
XSLT support.
Relax NG support
XML Schema support.
parsing and serialization retains namespace prefixes.
from this article: http://faassen.n--tree.net/blog/view/weblog/2006/02/24/0


2009/11/19 mdipierro mdipie...@cs.depaul.edu:

 It is not clear to me what does lxml do that element-tree does. Is it
 just an issue of speed?

 On Nov 18, 8:52 pm, Mark Larsen larsen...@gmail.com wrote:
 I've had good experience with ElementTree:

 http://effbot.org/zone/element-index.htm

 It has both straight python and a CPython versions.  It's included
 with Python = 2.5.
 


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



[web2py:35601] Re: routes problems

2009-11-19 Thread Carlos Aboim

Hi,

Thanks for the reply.

thi is my routes.py file:
http://dpaste.com/hold/122321/

As I posted earlier the url that I want to reach at the beginig
(defult) is:
http://127.0.0.1:8000/registos/obras/index

But it still falls in default welcome page.

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



[web2py:35602] Re: Data parser advice sort from web2py developers

2009-11-19 Thread Carl

thanks Mark.
I've not been able to integrate BeautifulSoup and if I can't find a
solution I'll look at ElementTree - thanks for the recommendation.

A useful article for appengine developers wanting to use ElementTree
http://groups.google.com/group/google-appengine/browse_thread/thread/85b7d03ff0d4ff2b/9fdfec112a4c051a


2009/11/19 Mark Larsen larsen...@gmail.com:

 I've had good experience with ElementTree:

 http://effbot.org/zone/element-index.htm

 It has both straight python and a CPython versions.  It's included
 with Python = 2.5.

 


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



[web2py:35603] Re: menu_auth state

2009-11-19 Thread annet

Massimo,

Problem solved, thanks.


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



[web2py:35606] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread Jon Romero

I am creating a CMS for web2py and I've decided using CKEditor due to
the fact that you can upload images/files directly from it.
Take a look here (http://docs.cksource.com/CKEditor_3.x/
Developers_Guide/File_Browser_(Uploader)).

Also, I have made a snippet (on web2pyslices and on my blog) on how to
use CKEditor as a standard text field for your 'text'.

On Nov 19, 5:32 am, Thadeus Burgess thade...@thadeusb.com wrote:
 I have been using CKEditor (the newest version of FCK), I love it. All that
 it is missing is the ability to (like in plone/wordpress/etc) is upload
 images automatically.

 With CKEditor I believe this is relatively simple.

 -Thadeus

 On Wed, Nov 18, 2009 at 6:45 PM, Darcy Clark d4r...@gmail.com wrote:

  Just did some research and Plone seems to be ditching kupu and
  adopting TinyMCE for Plone 4.

  On Nov 19, 10:20 am, Wes James compte...@gmail.com wrote:
   yep - like emacs vs vi - for plone it's kupu vs fckeditor ;)

   I wonder if kupu or fckeditor might work as an inline editor??

   kupu seemed to be more specifically developed for plone, but fckeditor
   would work in many different places (web apps, etc.)

   -wes

   On Wed, Nov 18, 2009 at 5:09 PM, Darcy Clark d4r...@gmail.com wrote:

I've come to web2py from a Plone CMS background. Plone integrated a
WYSIWYG editor called kupu which allowed the upload and integration of
images while you were editing rich content (i.e. web pages). It made
for a smoother more integrated content editing experience in that you
didn't have to separately upload the images and remember or calculate
their URLs. I'd really like to have something like this for web2py. Is
it feasible ? I think some of the available WYSIWYG editors have some
sort of image/file upload feature (including nicEdit), but we'd have
to tweak it to work with a back-end controller of some sort.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35608] ajax function eyecandy

2009-11-19 Thread selecta

If you want a little eyecandy for the ajax funtion relace it with
(web2py_ajax.html)

function ajax(u,s,t) {
  document.getElementById(t).innerHTML='{{=IMG(_src=URL
(request.application,'static','loading.gif' ,_alt='loading')}}';
  var query=;
  for(i=0; is.length; i++) {
 if(i0) query=query+;
 query=query+encodeURIComponent(s[i])+=+encodeURIComponent
(document.getElementById(s[i]).value);
  }
  jQuery.ajax({type: POST, url: u, data: query, success: function
(msg) { if(t==':eval') eval(msg); else document.getElementById
(t).innerHTML=msg; } });
}

and put a loading.gif in the static folder
you can find loading images at 
http://www.freeiconsdownload.com/Free_Downloads.asp?id=585


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



[web2py:35609] Oracle datetime problem (ORA-01830)

2009-11-19 Thread Gabriele Alberti

Hello web2py users,
I defined a table with one of the fields as datetime type, and when I
try to insert a raw it fails with this

ORA-01830: date format picture ends before converting entire input
string

with a raw query looking like this

INSERT INTO vals(timestamp, value, type, number) VALUES ('2009-09-07
12:00:00', 24, 11, 1);

which works with a MySQL backend.
Googling a bit it turns out its a problem of datetime conversion in
oracle.
Im still investingating about this, but what I get so far is the
default Oracle DATE format is something weird (kind of -MM-DD, no
hour and so).
To fix the problem you can either do this to change it to our (python
datetime) format

alter session set NLS_DATE_FORMAT='my_format';

but this lasts just for this session, or use something like

INSERT INTO vals(timestamp, value, type, number) VALUES (to_date
('2009-09-07 12:00:00', '-mm-dd hh:mi:ss'), 24, 11, 1);

using the to_date() oracle function.

I did not yet try anything of this solutions, and anyway I guess we
need a web2py fix.. any other hint ?

Thanks,

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



[web2py:35610] integrating pycrc into my web applicaton...

2009-11-19 Thread encompass

I am needing some extra tools integrated into my environment.  I
assumed you just put them into the modules folder and they can be
pulled normally.  But I guess I am doing something wrong.  Any ideas?
I am trying...
from crc_algorithms import Crc
and it gives me the error...
ImportError: No module names crc_algorithms
Please Reply to all on this message as I am not subscribed any longer
to the mailing list. (Too busy for me.)
Best Regards,
Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35611] gluon/highlight.py is missing 'DAL' and 'Field'

2009-11-19 Thread Markus Gritsch

Hi,

the new web2py specific identifiers 'DAL' and 'Field' are missing in
gluon/highlight.py line 169.  IMO they should be added.

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



[web2py:35612] mySQL and ON DELETE RESTRICT

2009-11-19 Thread Frederik Wagner

Hi,

it might be that I'm missing something, but:t
In a table definition I'm using a foreign key reference with the
ondelete='RESTRICT'. Following the sql.log and the Table schemes on
the DB, this is correctly used in the CREATE TABLE statements
.
When I'm inserting some data with references and then delete the
referenced data set (let's say a Table 'domain' and a 'host' which has
a reference to 'domain', then deleting a 'domain' entry)., I do not
get errors through web2py complaining that there are references left:

1. using SQLlite: web2py and on sqlite interface the referenced entry
is deleted without complaint.
2. using MySQL: web2py does delete the entry, but the cmdline of MySQL
gives an error as expected.

So how can web2py override the MySQL database constrain of ON DELETE RESTRICT?
For SQLlite is suppose it is just a missing feature in SQLlite...

Thanks for help,
Frederik

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



[web2py:35613] DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread Hans Murx

Hi,

given this legacy informix table:
~~~
create table kperson
(
  name  varchar(80, 1) not NULL,
  age   integer not NULL,
  primary key (name)
);

I did:

 db.define_table(kperson,
... Field(name),
... Field(age),
... primarykey=[name],
... migrate=False
... )

Inserting one row:
~
 db.kperson.insert(name=Oli1, age=23)
{'name': 'Oli1'}

Ok!

inserting another row:

 db.kperson.insert(name=Oli2, age=23)
{'name': 'Oli2'}

Ok!

trying to update the first row:
~
 db(db.kperson.name==Oli1).update(name=Oli2)
Traceback (most recent call last):
  File console, line 1, in module
  File /root/web2py-1439/gluon/sql.py, line 3091, in update
self._db._execute(query)
  File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
self._execute = lambda a: self._cursor.execute(a[:-1])
IntegrityError: SQLCODE -268 in EXECUTE:
23000: Integrity constraint violation
IX000: ISAM error:  duplicate value for a record with unique key.

Ok, this IntegrityError was expected, because we tried to update name
to a value that already existed in the table.

But trying to insert a row with an already existing name:

 db.kperson.insert(name=Oli2, age=23)

does not give an error message at all - although the same constraint
violation occurs!?

Why is there no IntegrityError exception raised in this case? Same
strange behavior with appadmin: you can 'insert' new rows with
appadmin that violate constraints and therefore are not really
inserted into the table without even getting an error message. I don't
think that this behavior is consistent.

Regards

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



[web2py:35614] Re: Oracle datetime problem (ORA-01830)

2009-11-19 Thread mdipierro

I think something is wrong in your model. If a field is declared of
type 'date' or 'datetime', web2py generates the SQL with the to_date
(..) function. I think you may have incorrectly defined the Field
('timestamp') as a string. BTW. I do not think 'timestamp' is a valid
field name since it is a reserved keyword.

On Nov 19, 5:47 am, Gabriele  Alberti gabriele.albe...@gmail.com
wrote:
 Hello web2py users,
 I defined a table with one of the fields as datetime type, and when I
 try to insert a raw it fails with this

 ORA-01830: date format picture ends before converting entire input
 string

 with a raw query looking like this

 INSERT INTO vals(timestamp, value, type, number) VALUES ('2009-09-07
 12:00:00', 24, 11, 1);

 which works with a MySQL backend.
 Googling a bit it turns out its a problem of datetime conversion in
 oracle.
 Im still investingating about this, but what I get so far is the
 default Oracle DATE format is something weird (kind of -MM-DD, no
 hour and so).
 To fix the problem you can either do this to change it to our (python
 datetime) format

 alter session set NLS_DATE_FORMAT='my_format';

 but this lasts just for this session, or use something like

 INSERT INTO vals(timestamp, value, type, number) VALUES (to_date
 ('2009-09-07 12:00:00', '-mm-dd hh:mi:ss'), 24, 11, 1);

 using the to_date() oracle function.

 I did not yet try anything of this solutions, and anyway I guess we
 need a web2py fix.. any other hint ?

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



[web2py:35615] Re: integrating pycrc into my web applicaton...

2009-11-19 Thread mdipierro

Try:

crc_algorithms = local_import('csc_algorithms')

There are some caveats:

modules under the modules folder work only if they do not contain
absolute imports.
Otherwise you have to put the module in site-packages as you would
normally do with Python modules.


On Nov 19, 5:54 am, encompass encomp...@gmail.com wrote:
 I am needing some extra tools integrated into my environment.  I
 assumed you just put them into the modules folder and they can be
 pulled normally.  But I guess I am doing something wrong.  Any ideas?
 I am trying...
 from crc_algorithms import Crc
 and it gives me the error...
 ImportError: No module names crc_algorithms
 Please Reply to all on this message as I am not subscribed any longer
 to the mailing list. (Too busy for me.)
 Best Regards,
 Jason Brower
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35616] Re: mySQL and ON DELETE RESTRICT

2009-11-19 Thread mdipierro

I agree this is strange. I do not know. web2py does not do anything
other than send the SQL to the database as you would from command
line.

The only special feature is the implementation of ondelete cascade
for mysql. You can how it is done manually in the delete(self) method
in gluon/sql.py.

Massimo

On Nov 19, 6:18 am, Frederik Wagner fner...@googlemail.com wrote:
 Hi,

 it might be that I'm missing something, but:t
 In a table definition I'm using a foreign key reference with the
 ondelete='RESTRICT'. Following the sql.log and the Table schemes on
 the DB, this is correctly used in the CREATE TABLE statements
 .
 When I'm inserting some data with references and then delete the
 referenced data set (let's say a Table 'domain' and a 'host' which has
 a reference to 'domain', then deleting a 'domain' entry)., I do not
 get errors through web2py complaining that there are references left:

 1. using SQLlite: web2py and on sqlite interface the referenced entry
 is deleted without complaint.
 2. using MySQL: web2py does delete the entry, but the cmdline of MySQL
 gives an error as expected.

 So how can web2py override the MySQL database constrain of ON DELETE RESTRICT?
 For SQLlite is suppose it is just a missing feature in SQLlite...

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



[web2py:35617] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread mdipierro

I agree this is strange but this seems a database problem to me.



On Nov 19, 6:49 am, Hans Murx murxun...@googlemail.com wrote:
 Hi,

 given this legacy informix table:
 ~~~
 create table kperson
 (
   name  varchar(80, 1) not NULL,
   age   integer not NULL,
   primary key (name)
 );

 I did:
  db.define_table(kperson,

 ...     Field(name),
 ...     Field(age),
 ...     primarykey=[name],
 ...     migrate=False
 ... )

 Inserting one row:
 ~ db.kperson.insert(name=Oli1, age=23)

 {'name': 'Oli1'}

 Ok!

 inserting another row:
  db.kperson.insert(name=Oli2, age=23)

 {'name': 'Oli2'}

 Ok!

 trying to update the first row:
 ~ db(db.kperson.name==Oli1).update(name=Oli2)

 Traceback (most recent call last):
   File console, line 1, in module
   File /root/web2py-1439/gluon/sql.py, line 3091, in update
     self._db._execute(query)
   File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
     self._execute = lambda a: self._cursor.execute(a[:-1])
 IntegrityError: SQLCODE -268 in EXECUTE:
 23000: Integrity constraint violation
 IX000: ISAM error:  duplicate value for a record with unique key.

 Ok, this IntegrityError was expected, because we tried to update name
 to a value that already existed in the table.

 But trying to insert a row with an already existing name:

  db.kperson.insert(name=Oli2, age=23)

 does not give an error message at all - although the same constraint
 violation occurs!?

 Why is there no IntegrityError exception raised in this case? Same
 strange behavior with appadmin: you can 'insert' new rows with
 appadmin that violate constraints and therefore are not really
 inserted into the table without even getting an error message. I don't
 think that this behavior is consistent.

 Regards

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



[web2py:35618] Re: crud.update(...,message,...)

2009-11-19 Thread mdipierro

Because in

response.flash='Update bedrijfsgegevens'
form=update_form(...)

response.flash is set before update_form which calls crud.update and
perform a redirection.
response.flash is reset upon redirection.

On Nov 18, 2:19 am, annet annet.verm...@gmail.com wrote:
 In a controller I have the following function:

 def update_company():
     response.view='company/update.html'
     response.flash='Update bedrijfsgegevens'
     form=update_form
 (db.bedrijf,company_id,'update_company','Bedrijfsgegevens
 gewijzigd',False)
     return dict(form=form)

 I defined the update_form function in db.py, it reads like:

 def update_form(table,record,next,message,deletable):
    form=crud.update(table,record,next=(URL
 (r=request,f=next)),message=message,deletable=deletable)
    if request.function=='update_company' or
 request.function=='update_paymentdata' or
 request.function=='update_address':
        form[0][-1][1].append(INPUT
 (_type=button,_value=Cancel,_onclick=window.location='%s';%URL
 (r=request,f='index')))
    else:
        form[0][-1][1].append(INPUT
 (_type=button,_value=Cancel,_onclick=javascript:hostory.go(-1)))
    return form

 Now when I expose the function I expect the flash to read like: Update
 bedrijfsgegevens. And after I
 updated the data I expect it to read like: Bedrijfsgegevens gewijzigd,
 because I set message=message,
 however, the flash still read like: Update bedrijfsgegevens.

 In the manual I read: message is the flash message upon form
 acceptance. Why doesn't this work?

 Kind regards,

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



[web2py:35619] Re: crud.select headers attribute

2009-11-19 Thread mdipierro

I think:

headers={'nfatype.nfatype':'medium', 'nfa.adres':'adres'}

On Nov 18, 4:27 am, annet annet.verm...@gmail.com wrote:
 I have the following function:

 records=crud.select(db.nfa, query=((db.nfa.bedrijf==auth.user.bedrijf)
 (db.nfa.nfatype==db.nfatype.id)),\
     fields=['nfatype.nfatype','nfa.adres'], orderby='nfa.nfatype',
 headers={'nfatype.nfatype', 'medium', 'nfa.adres', 'adres'})

 When I remove the headers attribute from the code it works, what is
 the correct
 syntax for the headers attribute?

 Kind regards,

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



[web2py:35620] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread DenesL

Hi Hans,

On Nov 19, 7:49 am, Hans Murx murxun...@googlemail.com wrote:
 Hi,

 given this legacy informix table:
 ~~~
 create table kperson
 (
   name  varchar(80, 1) not NULL,
   age   integer not NULL,
   primary key (name)
 );

 I did:
  db.define_table(kperson,

 ... Field(name),
 ... Field(age),
  Field(age,integer),
 ... primarykey=[name],
 ... migrate=False
 ... )

 Inserting one row:
 ~ db.kperson.insert(name=Oli1, age=23)

 {'name': 'Oli1'}

 Ok!

 inserting another row:
  db.kperson.insert(name=Oli2, age=23)

 {'name': 'Oli2'}

 Ok!

 trying to update the first row:
 ~ db(db.kperson.name==Oli1).update(name=Oli2)

 Traceback (most recent call last):
   File console, line 1, in module
   File /root/web2py-1439/gluon/sql.py, line 3091, in update
 self._db._execute(query)
   File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
 self._execute = lambda a: self._cursor.execute(a[:-1])
 IntegrityError: SQLCODE -268 in EXECUTE:
 23000: Integrity constraint violation
 IX000: ISAM error:  duplicate value for a record with unique key.

 Ok, this IntegrityError was expected, because we tried to update name
 to a value that already existed in the table.

 But trying to insert a row with an already existing name:

  db.kperson.insert(name=Oli2, age=23)

What is the return code of that insert?
If you get a 0 (zero) the operation was not successful.


 does not give an error message at all - although the same constraint
 violation occurs!?

 Why is there no IntegrityError exception raised in this case? Same
 strange behavior with appadmin: you can 'insert' new rows with
 appadmin that violate constraints and therefore are not really
 inserted into the table without even getting an error message. I don't
 think that this behavior is consistent.

 Regards

   Hans

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



[web2py:35621] Re: Oracle datetime problem (ORA-01830)

2009-11-19 Thread Gabriele Alberti

Hello,
my model is ok.. I tried to debug a bit, dont know exactly what is
happening but you probably do:
what happens in sql_represent() method is that among the many if
fieldtype == 'type' there is this code:

elif isinstance(obj, str):
try:
obj.decode('utf-8')
except:
obj = obj.decode('latin1').encode('utf8')

which catches up my datetime field (dunno why), and as it is an elif
clause it ends up not being catched by the following
elif fieldtype == 'datetime': code, which fixes the to_date() issue.

Hope this helps understanding what is going on..

Regards,

G.

On Nov 19, 2:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I think something is wrong in your model. If a field is declared of
 type 'date' or 'datetime', web2py generates the SQL with the to_date
 (..) function. I think you may have incorrectly defined the Field
 ('timestamp') as a string. BTW. I do not think 'timestamp' is a valid
 field name since it is a reserved keyword.

 On Nov 19, 5:47 am, Gabriele  Alberti gabriele.albe...@gmail.com
 wrote:

  Hello web2py users,
  I defined a table with one of the fields as datetime type, and when I
  try to insert a raw it fails with this

  ORA-01830: date format picture ends before converting entire input
  string

  with a raw query looking like this

  INSERT INTO vals(timestamp, value, type, number) VALUES ('2009-09-07
  12:00:00', 24, 11, 1);

  which works with a MySQL backend.
  Googling a bit it turns out its a problem of datetime conversion in
  oracle.
  Im still investingating about this, but what I get so far is the
  default Oracle DATE format is something weird (kind of -MM-DD, no
  hour and so).
  To fix the problem you can either do this to change it to our (python
  datetime) format

  alter session set NLS_DATE_FORMAT='my_format';

  but this lasts just for this session, or use something like

  INSERT INTO vals(timestamp, value, type, number) VALUES (to_date
  ('2009-09-07 12:00:00', '-mm-dd hh:mi:ss'), 24, 11, 1);

  using the to_date() oracle function.

  I did not yet try anything of this solutions, and anyway I guess we
  need a web2py fix.. any other hint ?

  Thanks,


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



[web2py:35622] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread Hans Murx

database problem seems unlikely because doing the same sql statement
with informix sql tool, returns expected error messages:

$ echo INSERT INTO kperson(name, age) VALUES ('Test', '23'); |
dbaccess stammdat

prints to stderr:

  268: Unique constraint (root.u151_174) violated.
  100: ISAM error:  duplicate value for a record with unique key.

Regards,

  Hans

~
On 19 Nov., 14:50, mdipierro mdipie...@cs.depaul.edu wrote:
 I agree this is strange but this seems a database problem to me.

 On Nov 19, 6:49 am, Hans Murx murxun...@googlemail.com wrote:

  Hi,

  given this legacy informix table:
  ~~~
  create table kperson
  (
    name  varchar(80, 1) not NULL,
    age   integer not NULL,
    primary key (name)
  );

  I did:
   db.define_table(kperson,

  ...     Field(name),
  ...     Field(age),
  ...     primarykey=[name],
  ...     migrate=False
  ... )

  Inserting one row:
  ~ db.kperson.insert(name=Oli1, age=23)

  {'name': 'Oli1'}

  Ok!

  inserting another row:
   db.kperson.insert(name=Oli2, age=23)

  {'name': 'Oli2'}

  Ok!

  trying to update the first row:
  ~ db(db.kperson.name==Oli1).update(name=Oli2)

  Traceback (most recent call last):
    File console, line 1, in module
    File /root/web2py-1439/gluon/sql.py, line 3091, in update
      self._db._execute(query)
    File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
      self._execute = lambda a: self._cursor.execute(a[:-1])
  IntegrityError: SQLCODE -268 in EXECUTE:
  23000: Integrity constraint violation
  IX000: ISAM error:  duplicate value for a record with unique key.

  Ok, this IntegrityError was expected, because we tried to update name
  to a value that already existed in the table.

  But trying to insert a row with an already existing name:

   db.kperson.insert(name=Oli2, age=23)

  does not give an error message at all - although the same constraint
  violation occurs!?

  Why is there no IntegrityError exception raised in this case? Same
  strange behavior with appadmin: you can 'insert' new rows with
  appadmin that violate constraints and therefore are not really
  inserted into the table without even getting an error message. I don't
  think that this behavior is consistent.

  Regards

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



[web2py:35623] SELECT helpers and id-label tuples from the db

2009-11-19 Thread Dmitri Zagidulin

When you pass a list of strings to the SELECT helper, it creates an
html select control, with options populated from the list of strings,
and each string is both the option's value and label.

so, SELECT(['one, 'two']) yields
select
option value=oneone/option
etc.

Does SELECT provide for the other common usage scenario, where you're
trying to create a list of options that have, say, an integer id as
the value and a string label as the contents of the option?
(That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
yielding:
select
option value=1one/option .. etc.
)
So, is it possible to pass in a list of tuples to SELECT (instead of
just a flat list)?

If not, would you accept a patch to make that possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35624] reportlab error

2009-11-19 Thread __Kyo__

By using reportlab in a system and send a variable from one function
to another to generate the report I get the following error, but only
in the latest version of web2py (1.71.2), I hope you can help me.

this is my code:

def reportePais():
form=FORM(TABLE(TR(Seleccione un País,SELECT
(_type=select,_name=pais, *[OPTION(x.nPais,_value=x.id)
for x in db().select(db.Pais.ALL, orderby = db.Pais.nPais)])),
TR(, INPUT(_type='submit',_value='Generar Reporte'
if form.accepts(request.vars, session):
return reportePaisResult(form.vars.pais)
return dict(form=form)


def reportePaisResult(x):
P=Paragraph(Productos seleccionados ,h1);  story.append(P);
story.append(Spacer(0,12))
consulta=db(db.Inventario.idPais==x).select()
if not len(consulta):
redirect(URL(r=request))
P=Paragraph(Cuerpo del reporte,h1); story.append(P)
cab=[['#id'],['Id Pais']]
m=[[x.id for x in consulta],[x.idPais for x in consulta]]
mcab=[cab[x]+m[x] for x in range(len(cab))];mcab=map
(None,*mcab);t=Table(mcab);t.setStyle(EstiloTablaH)
story.append(t)
story.append(Spacer(0,10))
doc=SimpleDocTemplate(Reporte.pdf,pagesize=landscape
(A4),showBoundary=1); doc.build(story)
response.headers['Content-Type']='application/pdf'
response.headers['Content-Disposition'] =
'attachment;filename=Reporte.pdf'
return response.stream(open(Reporte.pdf, 'rb'))


it generates the next error

TypeError: 'NoneType' object is not callable
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35625] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread Olaf

Hi Denes,

the second try to insert identical values returns None:

 db=DAL(informix://oli:x...@xeon2/stammdat)
 db.define_table(kperson,
... Field(name),
... Field(age, integer),
... primarykey=[name],
... migrate=False
... )

 a = db.kperson.insert(name=Test, age=23)# first successful insert
 print a
{'name': 'Test'}

 a = db.kperson.insert(name=Test, age=23)# second try, exception 
 expected - but none
 print a
None

 db.kperson._insert(name=Test, age=23)# to see if the 
 sql-statement is correct
INSERT INTO kperson(name, age) VALUES ('Test', 23);

doing the same sql statement via UNIX commandline:

$ echo INSERT INTO kperson(name, age) VALUES ('Test', 23); |
dbaccess stammdat

returns error messages as expected:

   268: Unique constraint (root.u151_174) violated.
  100: ISAM error:  duplicate value for a record with unique key.

Regards

  Hans

~
On 19 Nov., 15:02, DenesL denes1...@yahoo.ca wrote:
 Hi Hans,

 On Nov 19, 7:49 am, Hans Murx murxun...@googlemail.com wrote:

  Hi,

  given this legacy informix table:
  ~~~
  create table kperson
  (
    name  varchar(80, 1) not NULL,
    age   integer not NULL,
    primary key (name)
  );

  I did:
   db.define_table(kperson,

  ...     Field(name),
  ...     Field(age),

           Field(age,integer),



  ...     primarykey=[name],
  ...     migrate=False
  ... )

  Inserting one row:
  ~ db.kperson.insert(name=Oli1, age=23)

  {'name': 'Oli1'}

  Ok!

  inserting another row:
   db.kperson.insert(name=Oli2, age=23)

  {'name': 'Oli2'}

  Ok!

  trying to update the first row:
  ~ db(db.kperson.name==Oli1).update(name=Oli2)

  Traceback (most recent call last):
    File console, line 1, in module
    File /root/web2py-1439/gluon/sql.py, line 3091, in update
      self._db._execute(query)
    File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
      self._execute = lambda a: self._cursor.execute(a[:-1])
  IntegrityError: SQLCODE -268 in EXECUTE:
  23000: Integrity constraint violation
  IX000: ISAM error:  duplicate value for a record with unique key.

  Ok, this IntegrityError was expected, because we tried to update name
  to a value that already existed in the table.

  But trying to insert a row with an already existing name:

   db.kperson.insert(name=Oli2, age=23)

 What is the return code of that insert?
 If you get a 0 (zero) the operation was not successful.



  does not give an error message at all - although the same constraint
  violation occurs!?

  Why is there no IntegrityError exception raised in this case? Same
  strange behavior with appadmin: you can 'insert' new rows with
  appadmin that violate constraints and therefore are not really
  inserted into the table without even getting an error message. I don't
  think that this behavior is consistent.

  Regards

    Hans

 Denes.

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



[web2py:35626] Re: reportlab error

2009-11-19 Thread __Kyo__

i've got the solution for it

m=[[x.id for x in consulta],[str(x.idPais) for x in consulta]]

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



[web2py:35627] Re: routes problems

2009-11-19 Thread Thadeus Burgess
('^/$', '/registos/obras/'),


-Thadeus




On Thu, Nov 19, 2009 at 3:10 AM, Carlos Aboim abo...@gmail.com wrote:


 Hi,

 Thanks for the reply.

 thi is my routes.py file:
 http://dpaste.com/hold/122321/

 As I posted earlier the url that I want to reach at the beginig
 (defult) is:
 http://127.0.0.1:8000/registos/obras/index

 But it still falls in default welcome page.

 thank you for your help
 Carlos Aboim
 


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



[web2py:35628] Re: Oracle datetime problem (ORA-01830)

2009-11-19 Thread mdipierro

You are right. there is a problem. I assumed the datetime was
datetime.datetime format and not a string.
I am uploading a fix in trunk, please give it a try.

On Nov 19, 8:57 am, Gabriele  Alberti gabriele.albe...@gmail.com
wrote:
 Hello,
 my model is ok.. I tried to debug a bit, dont know exactly what is
 happening but you probably do:
 what happens in sql_represent() method is that among the many if
 fieldtype == 'type' there is this code:

     elif isinstance(obj, str):
         try:
             obj.decode('utf-8')
         except:
             obj = obj.decode('latin1').encode('utf8')

 which catches up my datetime field (dunno why), and as it is an elif
 clause it ends up not being catched by the following
 elif fieldtype == 'datetime': code, which fixes the to_date() issue.

 Hope this helps understanding what is going on..

 Regards,

 G.

 On Nov 19, 2:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I think something is wrong in your model. If a field is declared of
  type 'date' or 'datetime', web2py generates the SQL with the to_date
  (..) function. I think you may have incorrectly defined the Field
  ('timestamp') as a string. BTW. I do not think 'timestamp' is a valid
  field name since it is a reserved keyword.

  On Nov 19, 5:47 am, Gabriele  Alberti gabriele.albe...@gmail.com
  wrote:

   Hello web2py users,
   I defined a table with one of the fields as datetime type, and when I
   try to insert a raw it fails with this

   ORA-01830: date format picture ends before converting entire input
   string

   with a raw query looking like this

   INSERT INTO vals(timestamp, value, type, number) VALUES ('2009-09-07
   12:00:00', 24, 11, 1);

   which works with a MySQL backend.
   Googling a bit it turns out its a problem of datetime conversion in
   oracle.
   Im still investingating about this, but what I get so far is the
   default Oracle DATE format is something weird (kind of -MM-DD, no
   hour and so).
   To fix the problem you can either do this to change it to our (python
   datetime) format

   alter session set NLS_DATE_FORMAT='my_format';

   but this lasts just for this session, or use something like

   INSERT INTO vals(timestamp, value, type, number) VALUES (to_date
   ('2009-09-07 12:00:00', '-mm-dd hh:mi:ss'), 24, 11, 1);

   using the to_date() oracle function.

   I did not yet try anything of this solutions, and anyway I guess we
   need a web2py fix.. any other hint ?

   Thanks,


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



[web2py:35630] Re: reportlab error [SOLVED]

2009-11-19 Thread mdipierro

the an issue is solved, please add [SOLVED[ to the title. I am guilty
of this as everybody else.

On Nov 19, 10:28 am, __Kyo__ iacastil...@gmail.com wrote:
 i've got the solution for it

 m=[[x.id for x in consulta],[str(x.idPais) for x in consulta]]

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



[web2py:35629] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread mdipierro

yes,

SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:
 When you pass a list of strings to the SELECT helper, it creates an
 html select control, with options populated from the list of strings,
 and each string is both the option's value and label.

 so, SELECT(['one, 'two']) yields
 select
 option value=oneone/option
 etc.

 Does SELECT provide for the other common usage scenario, where you're
 trying to create a list of options that have, say, an integer id as
 the value and a string label as the contents of the option?
 (That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
 yielding:
 select
 option value=1one/option .. etc.
 )
 So, is it possible to pass in a list of tuples to SELECT (instead of
 just a flat list)?

 If not, would you accept a patch to make that possible?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35631] Re: Retrieve Images From Database

2009-11-19 Thread ecall

I'm trying to export/import database having an upload field stored
as a blob refered by a uploadfield.
Infortunatly, the blob is saved as binary data, this makes the CSV
file useless... I was expecting that was base64 data.

Is there a way to tell export_to_csv_file() to use base64 for the
blob?

Thx
Edouard


On Nov 18, 1:41 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 what do you mean by calling? The garbage is the image.

 On Nov 17, 11:39 pm, David digitalcry...@gmail.com wrote:

  I was storing the images in postgres.  When I tried calling the image
  by the filename it returned the coded filename.  When I tried calling
  the image blob it returned garbage.

  I was just wondering if there was an example on how to call the images
  from the database as it isn't mentioned in the manual and I don't know
  what takes place on GAE.

  On Nov 17, 7:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   This is all automatic in web2py is you do not rename the uploaded
   files.

   On Nov 17, 7:18 pm, Beerc berces.las...@fomi.hu wrote:

Storing images in database is a bad idea GENERALLY.
But on GAE you can't write the file system, so you have no other
choice for persistent storage.

And you will see garbage instead of image if MIME type incorrect or
unsetted.
In general case the web server (e.g. Apache) will set it for you
automatically (if its configuration is correct).
But if YOU serve the files (as in case of GAE) instead of the web
server, then you must to set the MIME type in the HTTP header. Example
for a JPEG file:
   Content-Type: image/jpg
Seehttp://en.wikipedia.org/wiki/MIMEfordetails.

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



[web2py:35632] Re: reportlab error [SOLVED]

2009-11-19 Thread Thadeus Burgess
It's impossible to add [SOLVED] if you use the groups through gmail :)

-Thadeus




On Thu, Nov 19, 2009 at 10:47 AM, mdipierro mdipie...@cs.depaul.edu wrote:


 the an issue is solved, please add [SOLVED[ to the title. I am guilty
 of this as everybody else.

 On Nov 19, 10:28 am, __Kyo__ iacastil...@gmail.com wrote:
  i've got the solution for it
 
  m=[[x.id for x in consulta],[str(x.idPais) for x in consulta]]
 
  thank
 


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



[web2py:35633] Re: Image Uploading

2009-11-19 Thread NuclearDragon

Thanks for the replies everyone!

We are renaming the files with our own naming scheme, so they are
unique, but not random. We don't provide a download function for our
users, so I'm not worried about the download aspect.

Thanks especially to Richard for this!:

form = SQLFORM(db.image)
if form.accepts(request.vars, session):
target_filename = ...
# need to stream or large files could cripple your server
gluon.fileutils.copystream(request.vars.filename.file, open
(target_filename, 'wb'), int(request.env.content_length))
db.image.insert(filename=target_filename)


Also, I tried my first 'multiple forms page', and it worked very
slick! I'm really starting to like web2py, especially the
customization I can do within it.

Thanks for a great framework, Massimo!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35634] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread Dmitri Zagidulin

Ok, that makes sense, that's how I ended up doing it. I was just
wondering if there was a short form, like with the list of strings (as
opposed to a list of OPTION objects), but with tuples.

Oh! One other question. Is there a way (or would you accept a patch)
to specify which value you want selected, when creating a SELECT
helper? There's a 'value=' parameter to the constructor, but that
seems to refer to the contents of the option, not its value (so, you
can do value='one' but not value='1', from the example below).



On Nov 19, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:
 yes,

 SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

 On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

  When you pass a list of strings to the SELECT helper, it creates an
  html select control, with options populated from the list of strings,
  and each string is both the option's value and label.

  so, SELECT(['one, 'two']) yields
  select
  option value=oneone/option
  etc.

  Does SELECT provide for the other common usage scenario, where you're
  trying to create a list of options that have, say, an integer id as
  the value and a string label as the contents of the option?
  (That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
  yielding:
  select
  option value=1one/option .. etc.
  )
  So, is it possible to pass in a list of tuples to SELECT (instead of
  just a flat list)?

  If not, would you accept a patch to make that possible?


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



[web2py:35635] Re: Retrieve Images From Database

2009-11-19 Thread mdipierro

This needs to be fixed. It is tricky to do but I will put on the todo
list.

On Nov 19, 10:14 am, ecall edouard.call...@gmail.com wrote:
 I'm trying to export/import database having an upload field stored
 as a blob refered by a uploadfield.
 Infortunatly, the blob is saved as binary data, this makes the CSV
 file useless... I was expecting that was base64 data.

 Is there a way to tell export_to_csv_file() to use base64 for the
 blob?

 Thx
 Edouard

 On Nov 18, 1:41 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  what do you mean by calling? The garbage is the image.

  On Nov 17, 11:39 pm, David digitalcry...@gmail.com wrote:

   I was storing the images in postgres.  When I tried calling the image
   by the filename it returned the coded filename.  When I tried calling
   the image blob it returned garbage.

   I was just wondering if there was an example on how to call the images
   from the database as it isn't mentioned in the manual and I don't know
   what takes place on GAE.

   On Nov 17, 7:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:

This is all automatic in web2py is you do not rename the uploaded
files.

On Nov 17, 7:18 pm, Beerc berces.las...@fomi.hu wrote:

 Storing images in database is a bad idea GENERALLY.
 But on GAE you can't write the file system, so you have no other
 choice for persistent storage.

 And you will see garbage instead of image if MIME type incorrect or
 unsetted.
 In general case the web server (e.g. Apache) will set it for you
 automatically (if its configuration is correct).
 But if YOU serve the files (as in case of GAE) instead of the web
 server, then you must to set the MIME type in the HTTP header. Example
 for a JPEG file:
    Content-Type: image/jpg
 Seehttp://en.wikipedia.org/wiki/MIMEfordetails.


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



[web2py:35636] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread DenesL

Hi Hans,

actually insert should return the inserted record key
(not a return code as I said above).

So a return of None would mean no insert was done.

To be consistent maybe we should trap the exception on the update.
What do you think?.

Denes.


On Nov 19, 10:05 am, Olaf of.m...@googlemail.com wrote:
 Hi Denes,

 the second try to insert identical values returns None:

  db=DAL(informix://oli:x...@xeon2/stammdat)
  db.define_table(kperson,

 ... Field(name),
 ... Field(age, integer),
 ... primarykey=[name],
 ... migrate=False
 ... )

  a = db.kperson.insert(name=Test, age=23)# first successful insert
  print a

 {'name': 'Test'}

  a = db.kperson.insert(name=Test, age=23)# second try, exception 
  expected - but none
  print a

 None

  db.kperson._insert(name=Test, age=23)# to see if the 
  sql-statement is correct

 INSERT INTO kperson(name, age) VALUES ('Test', 23);

 doing the same sql statement via UNIX commandline:

 $ echo INSERT INTO kperson(name, age) VALUES ('Test', 23); |
 dbaccess stammdat

 returns error messages as expected:

268: Unique constraint (root.u151_174) violated.
   100: ISAM error:  duplicate value for a record with unique key.

 Regards

   Hans

 ~
 On 19 Nov., 15:02, DenesL denes1...@yahoo.ca wrote:

  Hi Hans,

  On Nov 19, 7:49 am, Hans Murx murxun...@googlemail.com wrote:

   Hi,

   given this legacy informix table:
   ~~~
   create table kperson
   (
 name  varchar(80, 1) not NULL,
 age   integer not NULL,
 primary key (name)
   );

   I did:
    db.define_table(kperson,

   ... Field(name),
   ... Field(age),

Field(age,integer),

   ... primarykey=[name],
   ... migrate=False
   ... )

   Inserting one row:
   ~ db.kperson.insert(name=Oli1, age=23)

   {'name': 'Oli1'}

   Ok!

   inserting another row:
    db.kperson.insert(name=Oli2, age=23)

   {'name': 'Oli2'}

   Ok!

   trying to update the first row:
   ~ db(db.kperson.name==Oli1).update(name=Oli2)

   Traceback (most recent call last):
 File console, line 1, in module
 File /root/web2py-1439/gluon/sql.py, line 3091, in update
   self._db._execute(query)
 File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
   self._execute = lambda a: self._cursor.execute(a[:-1])
   IntegrityError: SQLCODE -268 in EXECUTE:
   23000: Integrity constraint violation
   IX000: ISAM error:  duplicate value for a record with unique key.

   Ok, this IntegrityError was expected, because we tried to update name
   to a value that already existed in the table.

   But trying to insert a row with an already existing name:

db.kperson.insert(name=Oli2, age=23)

  What is the return code of that insert?
  If you get a 0 (zero) the operation was not successful.

   does not give an error message at all - although the same constraint
   violation occurs!?

   Why is there no IntegrityError exception raised in this case? Same
   strange behavior with appadmin: you can 'insert' new rows with
   appadmin that violate constraints and therefore are not really
   inserted into the table without even getting an error message. I don't
   think that this behavior is consistent.

   Regards

 Hans

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



[web2py:35637] Re: Retrieve Images From Database

2009-11-19 Thread mdipierro

for now you can do:

import base64
rows=db(db.tablename.id0).select()
for row in rows:
row.blobfield=base64.b64encode(row.blobfield)
rows.export_to_csv_file(file)

On Nov 19, 10:52 am, mdipierro mdipie...@cs.depaul.edu wrote:
 This needs to be fixed. It is tricky to do but I will put on the todo
 list.

 On Nov 19, 10:14 am, ecall edouard.call...@gmail.com wrote:

  I'm trying to export/import database having an upload field stored
  as a blob refered by a uploadfield.
  Infortunatly, the blob is saved as binary data, this makes the CSV
  file useless... I was expecting that was base64 data.

  Is there a way to tell export_to_csv_file() to use base64 for the
  blob?

  Thx
  Edouard

  On Nov 18, 1:41 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   what do you mean by calling? The garbage is the image.

   On Nov 17, 11:39 pm, David digitalcry...@gmail.com wrote:

I was storing the images in postgres.  When I tried calling the image
by the filename it returned the coded filename.  When I tried calling
the image blob it returned garbage.

I was just wondering if there was an example on how to call the images
from the database as it isn't mentioned in the manual and I don't know
what takes place on GAE.

On Nov 17, 7:35 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 This is all automatic in web2py is you do not rename the uploaded
 files.

 On Nov 17, 7:18 pm, Beerc berces.las...@fomi.hu wrote:

  Storing images in database is a bad idea GENERALLY.
  But on GAE you can't write the file system, so you have no other
  choice for persistent storage.

  And you will see garbage instead of image if MIME type incorrect or
  unsetted.
  In general case the web server (e.g. Apache) will set it for you
  automatically (if its configuration is correct).
  But if YOU serve the files (as in case of GAE) instead of the web
  server, then you must to set the MIME type in the HTTP header. 
  Example
  for a JPEG file:
     Content-Type: image/jpg
  Seehttp://en.wikipedia.org/wiki/MIMEfordetails.


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



[web2py:35638] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread mdipierro

You can do something like

d={1:'one', 2:'two'}
SELECT(*[OPTION(v,_value=k) for (k,v) in d.items()])

and variations

On Nov 19, 10:51 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:
 Ok, that makes sense, that's how I ended up doing it. I was just
 wondering if there was a short form, like with the list of strings (as
 opposed to a list of OPTION objects), but with tuples.

 Oh! One other question. Is there a way (or would you accept a patch)
 to specify which value you want selected, when creating a SELECT
 helper? There's a 'value=' parameter to the constructor, but that
 seems to refer to the contents of the option, not its value (so, you
 can do value='one' but not value='1', from the example below).

 On Nov 19, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:

  yes,

  SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

  On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

   When you pass a list of strings to the SELECT helper, it creates an
   html select control, with options populated from the list of strings,
   and each string is both the option's value and label.

   so, SELECT(['one, 'two']) yields
   select
   option value=oneone/option
   etc.

   Does SELECT provide for the other common usage scenario, where you're
   trying to create a list of options that have, say, an integer id as
   the value and a string label as the contents of the option?
   (That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
   yielding:
   select
   option value=1one/option .. etc.
   )
   So, is it possible to pass in a list of tuples to SELECT (instead of
   just a flat list)?

   If not, would you accept a patch to make that possible?


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



[web2py:35639] Re: DAL: inconsistent behavior with constraint violation errors

2009-11-19 Thread mdipierro

update returns the number of updated records so it is correct that
raises an exception on failure.

shouldn't instead insert raise an exception on failure too?



On Nov 19, 10:58 am, DenesL denes1...@yahoo.ca wrote:
 Hi Hans,

 actually insert should return the inserted record key
 (not a return code as I said above).

 So a return of None would mean no insert was done.

 To be consistent maybe we should trap the exception on the update.
 What do you think?.

 Denes.

 On Nov 19, 10:05 am, Olaf of.m...@googlemail.com wrote:

  Hi Denes,

  the second try to insert identical values returns None:

   db=DAL(informix://oli:x...@xeon2/stammdat)
   db.define_table(kperson,

  ... Field(name),
  ... Field(age, integer),
  ... primarykey=[name],
  ... migrate=False
  ... )

   a = db.kperson.insert(name=Test, age=23)    # first successful insert
   print a

  {'name': 'Test'}

   a = db.kperson.insert(name=Test, age=23)    # second try, exception 
   expected - but none
   print a

  None

   db.kperson._insert(name=Test, age=23)        # to see if the 
   sql-statement is correct

  INSERT INTO kperson(name, age) VALUES ('Test', 23);

  doing the same sql statement via UNIX commandline:

  $ echo INSERT INTO kperson(name, age) VALUES ('Test', 23); |
  dbaccess stammdat

  returns error messages as expected:

     268: Unique constraint (root.u151_174) violated.
    100: ISAM error:  duplicate value for a record with unique key.

  Regards

    Hans

  ~
  On 19 Nov., 15:02, DenesL denes1...@yahoo.ca wrote:

   Hi Hans,

   On Nov 19, 7:49 am, Hans Murx murxun...@googlemail.com wrote:

Hi,

given this legacy informix table:
~~~
create table kperson
(
  name  varchar(80, 1) not NULL,
  age   integer not NULL,
  primary key (name)
);

I did:
 db.define_table(kperson,

...     Field(name),
...     Field(age),

             Field(age,integer),

...     primarykey=[name],
...     migrate=False
... )

Inserting one row:
~ db.kperson.insert(name=Oli1, age=23)

{'name': 'Oli1'}

Ok!

inserting another row:
 db.kperson.insert(name=Oli2, age=23)

{'name': 'Oli2'}

Ok!

trying to update the first row:
~ db(db.kperson.name==Oli1).update(name=Oli2)

Traceback (most recent call last):
  File console, line 1, in module
  File /root/web2py-1439/gluon/sql.py, line 3091, in update
    self._db._execute(query)
  File /root/web2py-1439/gluon/sql.py, line 1086, in lambda
    self._execute = lambda a: self._cursor.execute(a[:-1])
IntegrityError: SQLCODE -268 in EXECUTE:
23000: Integrity constraint violation
IX000: ISAM error:  duplicate value for a record with unique key.

Ok, this IntegrityError was expected, because we tried to update name
to a value that already existed in the table.

But trying to insert a row with an already existing name:

 db.kperson.insert(name=Oli2, age=23)

   What is the return code of that insert?
   If you get a 0 (zero) the operation was not successful.

does not give an error message at all - although the same constraint
violation occurs!?

Why is there no IntegrityError exception raised in this case? Same
strange behavior with appadmin: you can 'insert' new rows with
appadmin that violate constraints and therefore are not really
inserted into the table without even getting an error message. I don't
think that this behavior is consistent.

Regards

  Hans

   Denes.


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



[web2py:35640] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread Dmitri Zagidulin

Sure. And the other question, the specifying which option you want
'selected', in the SELECT constructor?

On Nov 19, 12:13 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You can do something like

 d={1:'one', 2:'two'}
 SELECT(*[OPTION(v,_value=k) for (k,v) in d.items()])

 and variations

 On Nov 19, 10:51 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

  Ok, that makes sense, that's how I ended up doing it. I was just
  wondering if there was a short form, like with the list of strings (as
  opposed to a list of OPTION objects), but with tuples.

  Oh! One other question. Is there a way (or would you accept a patch)
  to specify which value you want selected, when creating a SELECT
  helper? There's a 'value=' parameter to the constructor, but that
  seems to refer to the contents of the option, not its value (so, you
  can do value='one' but not value='1', from the example below).

  On Nov 19, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:

   yes,

   SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

   On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

When you pass a list of strings to the SELECT helper, it creates an
html select control, with options populated from the list of strings,
and each string is both the option's value and label.

so, SELECT(['one, 'two']) yields
select
option value=oneone/option
etc.

Does SELECT provide for the other common usage scenario, where you're
trying to create a list of options that have, say, an integer id as
the value and a string label as the contents of the option?
(That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
yielding:
select
option value=1one/option .. etc.
)
So, is it possible to pass in a list of tuples to SELECT (instead of
just a flat list)?

If not, would you accept a patch to make that possible?


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



[web2py:35641] expire login when browser closes

2009-11-19 Thread Wes James
I see in tools.py

self.settings.expiration = 3600  # seconds

Is this used when auth_user is logged in?

How can this be reset when a browser has closed?

I notice that when I close the broswer, then come back to the page, it is
still logged in.

thx,

-wes

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



[web2py:35642] Re: Oracle datetime problem (ORA-01830)

2009-11-19 Thread Gabriele Alberti

Hello,
it does with this patch

Index: gluon/sql.py
===
--- gluon/sql.py(revision 1441)
+++ gluon/sql.py(working copy)
@@ -521,7 +521,7 @@
 obj = obj.isoformat()[:10]
 else:
 obj = str(obj)
-if not instance(obj,str):
+if not isinstance(obj,str):
 obj = str(obj)
 try:
 obj.decode('utf-8')

Damn typos ;)

Thank you very much for your help!

Best regards


On Nov 19, 5:43 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You are right. there is a problem. I assumed the datetime was
 datetime.datetime format and not a string.
 I am uploading a fix in trunk, please give it a try.

 On Nov 19, 8:57 am, Gabriele  Alberti gabriele.albe...@gmail.com
 wrote:

  Hello,
  my model is ok.. I tried to debug a bit, dont know exactly what is
  happening but you probably do:
  what happens in sql_represent() method is that among the many if
  fieldtype == 'type' there is this code:

      elif isinstance(obj, str):
          try:
              obj.decode('utf-8')
          except:
              obj = obj.decode('latin1').encode('utf8')

  which catches up my datetime field (dunno why), and as it is an elif
  clause it ends up not being catched by the following
  elif fieldtype == 'datetime': code, which fixes the to_date() issue.

  Hope this helps understanding what is going on..

  Regards,

  G.

  On Nov 19, 2:37 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I think something is wrong in your model. If a field is declared of
   type 'date' or 'datetime', web2py generates the SQL with the to_date
   (..) function. I think you may have incorrectly defined the Field
   ('timestamp') as a string. BTW. I do not think 'timestamp' is a valid
   field name since it is a reserved keyword.

   On Nov 19, 5:47 am, Gabriele  Alberti gabriele.albe...@gmail.com
   wrote:

Hello web2py users,
I defined a table with one of the fields as datetime type, and when I
try to insert a raw it fails with this

ORA-01830: date format picture ends before converting entire input
string

with a raw query looking like this

INSERT INTO vals(timestamp, value, type, number) VALUES ('2009-09-07
12:00:00', 24, 11, 1);

which works with a MySQL backend.
Googling a bit it turns out its a problem of datetime conversion in
oracle.
Im still investingating about this, but what I get so far is the
default Oracle DATE format is something weird (kind of -MM-DD, no
hour and so).
To fix the problem you can either do this to change it to our (python
datetime) format

alter session set NLS_DATE_FORMAT='my_format';

but this lasts just for this session, or use something like

INSERT INTO vals(timestamp, value, type, number) VALUES (to_date
('2009-09-07 12:00:00', '-mm-dd hh:mi:ss'), 24, 11, 1);

using the to_date() oracle function.

I did not yet try anything of this solutions, and anyway I guess we
need a web2py fix.. any other hint ?

Thanks,


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



[web2py:35643] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread mdipierro

two ways

SELECT(OPTION('one',_value=1),OPTION('two',_value=2),value=1)

or

SELECT(OPTION('one',_value=1,_selected=True),OPTION('two',_value=2))

On Nov 19, 11:29 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:
 Sure. And the other question, the specifying which option you want
 'selected', in the SELECT constructor?

 On Nov 19, 12:13 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  You can do something like

  d={1:'one', 2:'two'}
  SELECT(*[OPTION(v,_value=k) for (k,v) in d.items()])

  and variations

  On Nov 19, 10:51 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

   Ok, that makes sense, that's how I ended up doing it. I was just
   wondering if there was a short form, like with the list of strings (as
   opposed to a list of OPTION objects), but with tuples.

   Oh! One other question. Is there a way (or would you accept a patch)
   to specify which value you want selected, when creating a SELECT
   helper? There's a 'value=' parameter to the constructor, but that
   seems to refer to the contents of the option, not its value (so, you
   can do value='one' but not value='1', from the example below).

   On Nov 19, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:

yes,

SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

 When you pass a list of strings to the SELECT helper, it creates an
 html select control, with options populated from the list of strings,
 and each string is both the option's value and label.

 so, SELECT(['one, 'two']) yields
 select
 option value=oneone/option
 etc.

 Does SELECT provide for the other common usage scenario, where you're
 trying to create a list of options that have, say, an integer id as
 the value and a string label as the contents of the option?
 (That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
 yielding:
 select
 option value=1one/option .. etc.
 )
 So, is it possible to pass in a list of tuples to SELECT (instead of
 just a flat list)?

 If not, would you accept a patch to make that possible?


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



[web2py:35644] verify email

2009-11-19 Thread Wes James
I just tried:

 http://127.0.0.1:port/app/default/user/verify_email/code

and got

404 NOT FOUND

error

after registering then getting code in email and trying it.

Do I need to turn something else on?

thx,

-wes

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



[web2py:35645] Re: SELECT helpers and id-label tuples from the db

2009-11-19 Thread Dmitri Zagidulin

Got it, thanks!

On Nov 19, 12:57 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 two ways

 SELECT(OPTION('one',_value=1),OPTION('two',_value=2),value=1)

 or

 SELECT(OPTION('one',_value=1,_selected=True),OPTION('two',_value=2))

 On Nov 19, 11:29 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

  Sure. And the other question, the specifying which option you want
  'selected', in the SELECT constructor?

  On Nov 19, 12:13 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   You can do something like

   d={1:'one', 2:'two'}
   SELECT(*[OPTION(v,_value=k) for (k,v) in d.items()])

   and variations

   On Nov 19, 10:51 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

Ok, that makes sense, that's how I ended up doing it. I was just
wondering if there was a short form, like with the list of strings (as
opposed to a list of OPTION objects), but with tuples.

Oh! One other question. Is there a way (or would you accept a patch)
to specify which value you want selected, when creating a SELECT
helper? There's a 'value=' parameter to the constructor, but that
seems to refer to the contents of the option, not its value (so, you
can do value='one' but not value='1', from the example below).

On Nov 19, 11:45 am, mdipierro mdipie...@cs.depaul.edu wrote:

 yes,

 SELECT(OPTION('one',_value=1),OPTION('two',_value=2))

 On Nov 19, 9:54 am, Dmitri Zagidulin dzagidu...@gmail.com wrote:

  When you pass a list of strings to the SELECT helper, it creates an
  html select control, with options populated from the list of 
  strings,
  and each string is both the option's value and label.

  so, SELECT(['one, 'two']) yields
  select
  option value=oneone/option
  etc.

  Does SELECT provide for the other common usage scenario, where 
  you're
  trying to create a list of options that have, say, an integer id as
  the value and a string label as the contents of the option?
  (That is, something like SELECT([ ('1', 'one'), ('2', 'two')])
  yielding:
  select
  option value=1one/option .. etc.
  )
  So, is it possible to pass in a list of tuples to SELECT (instead of
  just a flat list)?

  If not, would you accept a patch to make that possible?


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



[web2py:35647] verify message flash message

2009-11-19 Thread Wes James
how does:

else:
user.update_record(registration_key = '')
self.environment.session.flash = self.messages.email_verified

in tools.py

filter back to response.flash or session.flash or something that can be
flashed?

I followed it with wingide, but I don't see where I can use it on the page
with my form.  All the flashes I find are ''.

thx,

-wes

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



[web2py:35648] Re: expire login when browser closes

2009-11-19 Thread mdipierro

This expiration is handled at the web2py level. The session cookie
used to maintain the session should expire at the browser level when
you close the browser because it does have an expiration time. Since
that is browser dependent I do not know if it always works.

On Nov 19, 11:43 am, Wes James compte...@gmail.com wrote:
 I see in tools.py

 self.settings.expiration = 3600  # seconds

 Is this used when auth_user is logged in?

 How can this be reset when a browser has closed?

 I notice that when I close the broswer, then come back to the page, it is
 still logged in.

 thx,

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



[web2py:35649] Re: verify email

2009-11-19 Thread mdipierro

No. I do not know.

On Nov 19, 12:25 pm, Wes James compte...@gmail.com wrote:
 I just tried this on a real IP and it worked.  Is it supposed to fail with
 localhost?

 thx,

 -wes

 On Thu, Nov 19, 2009 at 11:04 AM, Wes James compte...@gmail.com wrote:
  I just tried:

   http://127.0.0.1:port/app/default/user/verify_email/code

  and got

  404 NOT FOUND

  error

  after registering then getting code in email and trying it.

  Do I need to turn something else on?

  thx,

  -wes


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



[web2py:35650] Re: verify message flash message

2009-11-19 Thread mdipierro

self.environment.session is a reference to session

On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
 how does:

         else:
             user.update_record(registration_key = '')
             self.environment.session.flash = self.messages.email_verified

 in tools.py

 filter back to response.flash or session.flash or something that can be
 flashed?

 I followed it with wingide, but I don't see where I can use it on the page
 with my form.  All the flashes I find are ''.

 thx,

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



[web2py:35652] Re: expire login when browser closes

2009-11-19 Thread Wes James
ok thx- i'm testing with latest firefox on snoLeo.

I'll keep testing and also try safari.

-wes

On Thu, Nov 19, 2009 at 12:14 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 This expiration is handled at the web2py level. The session cookie
 used to maintain the session should expire at the browser level when
 you close the browser because it does have an expiration time. Since
 that is browser dependent I do not know if it always works.

 On Nov 19, 11:43 am, Wes James compte...@gmail.com wrote:
  I see in tools.py
 
  self.settings.expiration = 3600  # seconds
 
  Is this used when auth_user is logged in?
 
  How can this be reset when a browser has closed?
 
  I notice that when I close the broswer, then come back to the page, it is
  still logged in.
 
  thx,
 
  -wes
 


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



[web2py:35653] Re: verify email

2009-11-19 Thread Thadeus Burgess
Works fine with a new welcome app on localhost for me.

-Thadeus




On Thu, Nov 19, 2009 at 1:15 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 No. I do not know.

 On Nov 19, 12:25 pm, Wes James compte...@gmail.com wrote:
  I just tried this on a real IP and it worked.  Is it supposed to fail
 with
  localhost?
 
  thx,
 
  -wes
 
  On Thu, Nov 19, 2009 at 11:04 AM, Wes James compte...@gmail.com wrote:
   I just tried:
 
http://127.0.0.1:port/app/default/user/verify_email/code
 
   and got
 
   404 NOT FOUND
 
   error
 
   after registering then getting code in email and trying it.
 
   Do I need to turn something else on?
 
   thx,
 
   -wes
 
 
 


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



[web2py:35654] Re: verify message flash message

2009-11-19 Thread Wes James
I just follow the code:

user.update_record(registration_key = '')
self.environment.session.flash = self.messages.email_verified
.
.
.
redirect(next)

in tools.py


After I come out of the redirect(next) there is no session.flash to be found
with 'Email Verified'.  Any I find are empty.

Do I need to pass a session=session somewhere?

thx,

-wes

On Thu, Nov 19, 2009 at 12:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:


 self.environment.session is a reference to session

 On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
  how does:
 
  else:
  user.update_record(registration_key = '')
  self.environment.session.flash = self.messages.email_verified
 
  in tools.py
 
  filter back to response.flash or session.flash or something that can be
  flashed?
 
  I followed it with wingide, but I don't see where I can use it on the
 page
  with my form.  All the flashes I find are ''.
 
  thx,
 
  -wes
 


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



[web2py:35655] Re: verify email

2009-11-19 Thread Wes James
I do see flash messages about Email verification sent and Logged out

On Thu, Nov 19, 2009 at 12:42 PM, Thadeus Burgess thade...@thadeusb.comwrote:

 Works fine with a new welcome app on localhost for me.

 -Thadeus





 On Thu, Nov 19, 2009 at 1:15 PM, mdipierro mdipie...@cs.depaul.eduwrote:


 No. I do not know.

 On Nov 19, 12:25 pm, Wes James compte...@gmail.com wrote:
  I just tried this on a real IP and it worked.  Is it supposed to fail
 with
  localhost?
 
  thx,
 
  -wes
 
  On Thu, Nov 19, 2009 at 11:04 AM, Wes James compte...@gmail.com
 wrote:
   I just tried:
 
http://127.0.0.1:port/app/default/user/verify_email/code
 
   and got
 
   404 NOT FOUND
 
   error
 
   after registering then getting code in email and trying it.
 
   Do I need to turn something else on?
 
   thx,
 
   -wes
 
 



 


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



[web2py:35656] Re: verify email

2009-11-19 Thread Wes James
sorry wrong thread :(

On Thu, Nov 19, 2009 at 12:53 PM, Wes James compte...@gmail.com wrote:

 I do see flash messages about Email verification sent and Logged out


 On Thu, Nov 19, 2009 at 12:42 PM, Thadeus Burgess 
 thade...@thadeusb.comwrote:

 Works fine with a new welcome app on localhost for me.

 -Thadeus





 On Thu, Nov 19, 2009 at 1:15 PM, mdipierro mdipie...@cs.depaul.eduwrote:


 No. I do not know.

 On Nov 19, 12:25 pm, Wes James compte...@gmail.com wrote:
  I just tried this on a real IP and it worked.  Is it supposed to fail
 with
  localhost?
 
  thx,
 
  -wes
 
  On Thu, Nov 19, 2009 at 11:04 AM, Wes James compte...@gmail.com
 wrote:
   I just tried:
 
http://127.0.0.1:port/app/default/user/verify_email/code
 
   and got
 
   404 NOT FOUND
 
   error
 
   after registering then getting code in email and trying it.
 
   Do I need to turn something else on?
 
   thx,
 
   -wes
 
 



 



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



[web2py:35657] Re: verify message flash message

2009-11-19 Thread Wes James

I do see flash messages about Email verification sent and Logged out

On Thu, Nov 19, 2009 at 12:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 self.environment.session is a reference to session

 On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
  how does:
 
          else:
              user.update_record(registration_key = '')
              self.environment.session.flash = self.messages.email_verified
 
  in tools.py
 
  filter back to response.flash or session.flash or something that can be
  flashed?
 
  I followed it with wingide, but I don't see where I can use it on the page
  with my form.  All the flashes I find are ''.
 
  thx,
 
  -wes
 

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



[web2py:35658] Re: verify message flash message

2009-11-19 Thread mdipierro

I suspect the problem is that there is a double redirect somewhere
that resets the flash.
What's auth.settings.verify_email_next? Is is an aciton that requires
login? That would cause a double redirect.

On Nov 19, 1:47 pm, Wes James compte...@gmail.com wrote:
 I just follow the code:

             user.update_record(registration_key = '')
             self.environment.session.flash = self.messages.email_verified
 .
 .
 .
         redirect(next)

 in tools.py

 After I come out of the redirect(next) there is no session.flash to be found
 with 'Email Verified'.  Any I find are empty.

 Do I need to pass a session=session somewhere?

 thx,

 -wes

 On Thu, Nov 19, 2009 at 12:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:

  self.environment.session is a reference to session

  On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
   how does:

           else:
               user.update_record(registration_key = '')
               self.environment.session.flash = self.messages.email_verified

   in tools.py

   filter back to response.flash or session.flash or something that can be
   flashed?

   I followed it with wingide, but I don't see where I can use it on the
  page
   with my form.  All the flashes I find are ''.

   thx,

   -wes


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



[web2py:35659] AttributeError: 'module' object has no attribute 'dumps'

2009-11-19 Thread Shalab

I was trying to test web2py framework and it support on google app
engine and i decided to do what reddish(web2py.appspot.com) has done
and test all functionality on google app engine. I have been
successful in uploading the app with all the name changes but on
registration get below error in google appengine logs.
Can you explain how to resolve this error.


Traceback (most recent call last):
  File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
main.py, line 469, in wsgibase
session._try_store_in_db(request, response)
  File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
globals.py, line 343, in _try_store_in_db
session_data=cPickle.dumps(dict(self)),
  File /base/python_dist/lib/python2.5/pickle.py, line 1359, in
dumps
Pickler(file, protocol).dump(obj)
  File /base/python_dist/lib/python2.5/pickle.py, line 218, in dump
self.save(obj)
  File /base/python_dist/lib/python2.5/pickle.py, line 280, in save
f(self, obj) # Call unbound method with explicit self
  File /base/python_dist/lib/python2.5/pickle.py, line 643, in
save_dict
self._batch_setitems(obj.iteritems())
  File /base/python_dist/lib/python2.5/pickle.py, line 657, in
_batch_setitems
save(v)
  File /base/python_dist/lib/python2.5/pickle.py, line 295, in save
rv = reduce(obj)
  File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
sql.py, line 1388, in Reference_pickler
return (Reference_unpickler, (marshal.dumps(int(data)),))
AttributeError: 'module' object has no attribute 'dumps'

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



[web2py:35660] Re: AttributeError: 'module' object has no attribute 'dumps'

2009-11-19 Thread mdipierro

Which are you using?

The app is trying to store a db reference object in the session. The
custom pickling method calls marshal.dumps which is not implemented on
GAE.

If this is a common problem, then we should implement our own
marshal.dump on GAE.

def dump(i):
i,a=divmod(i,256)
i,b=divmod(i,256)
d,c=divmod(i,256)
return 'i%s%s%s%s' % (chr(a),chr(b),chr(c),chr(d))
marshal.dump=dump

Pros cons?


On Nov 19, 2:13 pm, Shalab sachinl...@gmail.com wrote:
 I was trying to test web2py framework and it support on google app
 engine and i decided to do what reddish(web2py.appspot.com) has done
 and test all functionality on google app engine. I have been
 successful in uploading the app with all the name changes but on
 registration get below error in google appengine logs.
 Can you explain how to resolve this error.

 Traceback (most recent call last):
   File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
 main.py, line 469, in wsgibase
     session._try_store_in_db(request, response)
   File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
 globals.py, line 343, in _try_store_in_db
     session_data=cPickle.dumps(dict(self)),
   File /base/python_dist/lib/python2.5/pickle.py, line 1359, in
 dumps
     Pickler(file, protocol).dump(obj)
   File /base/python_dist/lib/python2.5/pickle.py, line 218, in dump
     self.save(obj)
   File /base/python_dist/lib/python2.5/pickle.py, line 280, in save
     f(self, obj) # Call unbound method with explicit self
   File /base/python_dist/lib/python2.5/pickle.py, line 643, in
 save_dict
     self._batch_setitems(obj.iteritems())
   File /base/python_dist/lib/python2.5/pickle.py, line 657, in
 _batch_setitems
     save(v)
   File /base/python_dist/lib/python2.5/pickle.py, line 295, in save
     rv = reduce(obj)
   File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
 sql.py, line 1388, in Reference_pickler
     return (Reference_unpickler, (marshal.dumps(int(data)),))
 AttributeError: 'module' object has no attribute 'dumps'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35661] Re: AttributeError: 'module' object has no attribute 'dumps'

2009-11-19 Thread mdipierro

I added a temporary fix in trunk. please give it a try.

On Nov 19, 3:32 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Which are you using?

 The app is trying to store a db reference object in the session. The
 custom pickling method calls marshal.dumps which is not implemented on
 GAE.

 If this is a common problem, then we should implement our own
 marshal.dump on GAE.

 def dump(i):
     i,a=divmod(i,256)
     i,b=divmod(i,256)
     d,c=divmod(i,256)
     return 'i%s%s%s%s' % (chr(a),chr(b),chr(c),chr(d))
 marshal.dump=dump

 Pros cons?

 On Nov 19, 2:13 pm, Shalab sachinl...@gmail.com wrote:

  I was trying to test web2py framework and it support on google app
  engine and i decided to do what reddish(web2py.appspot.com) has done
  and test all functionality on google app engine. I have been
  successful in uploading the app with all the name changes but on
  registration get below error in google appengine logs.
  Can you explain how to resolve this error.

  Traceback (most recent call last):
    File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
  main.py, line 469, in wsgibase
      session._try_store_in_db(request, response)
    File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
  globals.py, line 343, in _try_store_in_db
      session_data=cPickle.dumps(dict(self)),
    File /base/python_dist/lib/python2.5/pickle.py, line 1359, in
  dumps
      Pickler(file, protocol).dump(obj)
    File /base/python_dist/lib/python2.5/pickle.py, line 218, in dump
      self.save(obj)
    File /base/python_dist/lib/python2.5/pickle.py, line 280, in save
      f(self, obj) # Call unbound method with explicit self
    File /base/python_dist/lib/python2.5/pickle.py, line 643, in
  save_dict
      self._batch_setitems(obj.iteritems())
    File /base/python_dist/lib/python2.5/pickle.py, line 657, in
  _batch_setitems
      save(v)
    File /base/python_dist/lib/python2.5/pickle.py, line 295, in save
      rv = reduce(obj)
    File /base/data/home/apps/gifteddeals/1.337717733870634071/gluon/
  sql.py, line 1388, in Reference_pickler
      return (Reference_unpickler, (marshal.dumps(int(data)),))
  AttributeError: 'module' object has no attribute 'dumps'


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



[web2py:35662] Re: verify message flash message [Solved]

2009-11-19 Thread Wes James

Massimo,

This fixed it.  I put this in db.py:

auth.settings.verify_email_next = '/app/default/user/login'

Is there functional way to do the last part?  URL() returns an object
so no on that...

thx,

-wes

On Thu, Nov 19, 2009 at 2:12 PM, mdipierro mdipie...@cs.depaul.edu wrote:

 I suspect the problem is that there is a double redirect somewhere
 that resets the flash.
 What's auth.settings.verify_email_next? Is is an aciton that requires
 login? That would cause a double redirect.

 On Nov 19, 1:47 pm, Wes James compte...@gmail.com wrote:
 I just follow the code:

             user.update_record(registration_key = '')
             self.environment.session.flash = self.messages.email_verified
 .
 .
 .
         redirect(next)

 in tools.py

 After I come out of the redirect(next) there is no session.flash to be found
 with 'Email Verified'.  Any I find are empty.

 Do I need to pass a session=session somewhere?

 thx,

 -wes

 On Thu, Nov 19, 2009 at 12:16 PM, mdipierro mdipie...@cs.depaul.edu wrote:

  self.environment.session is a reference to session

  On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
   how does:

           else:
               user.update_record(registration_key = '')
               self.environment.session.flash = self.messages.email_verified

   in tools.py

   filter back to response.flash or session.flash or something that can be
   flashed?

   I followed it with wingide, but I don't see where I can use it on the
  page
   with my form.  All the flashes I find are ''.

   thx,

   -wes


 


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



[web2py:35663] Re: verify message flash message [Solved]

2009-11-19 Thread mr.freeze

URL returns a string.

On Nov 19, 3:57 pm, Wes James compte...@gmail.com wrote:
 Massimo,

 This fixed it.  I put this in db.py:

 auth.settings.verify_email_next = '/app/default/user/login'

 Is there functional way to do the last part?  URL() returns an object
 so no on that...

 thx,

 -wes

 On Thu, Nov 19, 2009 at 2:12 PM, mdipierro mdipie...@cs.depaul.edu wrote:

  I suspect the problem is that there is a double redirect somewhere
  that resets the flash.
  What's auth.settings.verify_email_next? Is is an aciton that requires
  login? That would cause a double redirect.

  On Nov 19, 1:47 pm, Wes James compte...@gmail.com wrote:
  I just follow the code:

              user.update_record(registration_key = '')
              self.environment.session.flash = self.messages.email_verified
  .
  .
  .
          redirect(next)

  in tools.py

  After I come out of the redirect(next) there is no session.flash to be 
  found
  with 'Email Verified'.  Any I find are empty.

  Do I need to pass a session=session somewhere?

  thx,

  -wes

  On Thu, Nov 19, 2009 at 12:16 PM, mdipierro mdipie...@cs.depaul.edu 
  wrote:

   self.environment.session is a reference to session

   On Nov 19, 1:08 pm, Wes James compte...@gmail.com wrote:
how does:

        else:
            user.update_record(registration_key = '')
            self.environment.session.flash = 
self.messages.email_verified

in tools.py

filter back to response.flash or session.flash or something that can be
flashed?

I followed it with wingide, but I don't see where I can use it on the
   page
with my form.  All the flashes I find are ''.

thx,

-wes


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



[web2py:35664] GAE and belongs

2009-11-19 Thread howesc

Hello,

I'm using Google App Engine, and trying to make use of the new
'belongs' feature in queries (thanks much for adding it in!), and am
having a problem.  It seems that when i construct the query my list is
being converted to a unicode string, and then the query generation
code fails.

here's my model:

db.define_table('media_type',
Field('name', 'string', notnull=True, unique=True,
  requires=[IS_NOT_EMPTY(),
IS_NOT_IN_DB(db,'media_type.name')]))

here's my query:

  rows = db(db.media_type.name.belongs(['paper', 'cd'])).select()

here's the error:
  /cfhowes/clients/rockriver/source/web2py/applications/rockriver/
controllers/manage.py:song_media, line 68, in song_media\n  File /
home/cfhowes/clients/rockriver/source/web2py/gluon/contrib/gql.py,
line 666, in select\n(items, tablename, fields) = self._select
(*fields, **attributes)\n  File /home/cfhowes/clients/rockriver/
source/web2py/gluon/contrib/gql.py, line 617, in _select\nitems =
items.filter(cond, val)\n  File /home/cfhowes/Desktop/gae/
google_appengine/google/appengine/ext/db/__init__.py, line 1882, in
filter\nraise BadValueError(\'Argument to the in operator must
be a list\')\nBadValueError: Argument to the in operator must be a
list\n

(sorry, it's how i copied it out of the GAE viewer)

Here's my proposed solution - but I don't understand what i did well
enough to know the potential other side effects.  If I modify gql.py
(from Version 1.72.3 (2009-11-10 09:17:13)) and add the following at
line 460:

elif isinstance(obj, list):
obj = obj
which keeps the check a few lines later from converting my list to a
unicode string.  my query now works.

so, did i do something wrong in my query, or is this fix (or something
similar) needed to make belongs work in the latest build?

thanks,

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



[web2py:35665] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread blackthorne

That was one my first intentions when I got into web2py. Just to say
I'm willing to work for that. Get a WYSIWYG web based editor like kupu
or TinyMCE or FCKeditor in web2py for rich content handling. My idea
for that would be to turn it as a optional setting (namely for the
views).
Afaik kupu started outside the Plone project but became assimilated.
Seems to me it should be possible to integrate it on any project but
probably harder than with TinyMCE or FCKeditor/CKeditor.

Anyone feels like putting hands-on this?

On Nov 19, 12:09 am, Darcy Clark d4r...@gmail.com wrote:
 I've come to web2py from a Plone CMS background. Plone integrated a
 WYSIWYG editor called kupu which allowed the upload and integration of
 images while you were editing rich content (i.e. web pages). It made
 for a smoother more integrated content editing experience in that you
 didn't have to separately upload the images and remember or calculate
 their URLs. I'd really like to have something like this for web2py. Is
 it feasible ? I think some of the available WYSIWYG editors have some
 sort of image/file upload feature (including nicEdit), but we'd have
 to tweak it to work with a back-end controller of some sort.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35666] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread Darcy Clark

I'm willing to help on this - however I'm hoping someone with a deeper
knowledge of web2py can provide some guidance on where to start and
best practice etc...

On Nov 20, 12:26 pm, blackthorne francisco@gmail.com wrote:
 That was one my first intentions when I got into web2py. Just to say
 I'm willing to work for that. Get a WYSIWYG web based editor like kupu
 or TinyMCE or FCKeditor in web2py for rich content handling. My idea
 for that would be to turn it as a optional setting (namely for the
 views).
 Afaik kupu started outside the Plone project but became assimilated.
 Seems to me it should be possible to integrate it on any project but
 probably harder than with TinyMCE or FCKeditor/CKeditor.

 Anyone feels like putting hands-on this?

 On Nov 19, 12:09 am, Darcy Clark d4r...@gmail.com wrote:

  I've come to web2py from a Plone CMS background. Plone integrated a
  WYSIWYG editor called kupu which allowed the upload and integration of
  images while you were editing rich content (i.e. web pages). It made
  for a smoother more integrated content editing experience in that you
  didn't have to separately upload the images and remember or calculate
  their URLs. I'd really like to have something like this for web2py. Is
  it feasible ? I think some of the available WYSIWYG editors have some
  sort of image/file upload feature (including nicEdit), but we'd have
  to tweak it to work with a back-end controller of some sort.


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



[web2py:35667] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread Thadeus Burgess
As far as integrating CKeditor, easy.

Integrating something like CKFinder however, is a whole nother story. I have
been researching, and it seems that the backend code will need to be ported
from their examples, to web2py. CKFinder uses mostly XML to communicate for
file browsing etc, and with a little bit of firebug magic and some time, I
think a workable back end is possible.

I'm thinking this can be designed as a web2py plug-in.

-Thadeus




On Thu, Nov 19, 2009 at 9:48 PM, Darcy Clark d4r...@gmail.com wrote:


 I'm willing to help on this - however I'm hoping someone with a deeper
 knowledge of web2py can provide some guidance on where to start and
 best practice etc...

 On Nov 20, 12:26 pm, blackthorne francisco@gmail.com wrote:
  That was one my first intentions when I got into web2py. Just to say
  I'm willing to work for that. Get a WYSIWYG web based editor like kupu
  or TinyMCE or FCKeditor in web2py for rich content handling. My idea
  for that would be to turn it as a optional setting (namely for the
  views).
  Afaik kupu started outside the Plone project but became assimilated.
  Seems to me it should be possible to integrate it on any project but
  probably harder than with TinyMCE or FCKeditor/CKeditor.
 
  Anyone feels like putting hands-on this?
 
  On Nov 19, 12:09 am, Darcy Clark d4r...@gmail.com wrote:
 
   I've come to web2py from a Plone CMS background. Plone integrated a
   WYSIWYG editor called kupu which allowed the upload and integration of
   images while you were editing rich content (i.e. web pages). It made
   for a smoother more integrated content editing experience in that you
   didn't have to separately upload the images and remember or calculate
   their URLs. I'd really like to have something like this for web2py. Is
   it feasible ? I think some of the available WYSIWYG editors have some
   sort of image/file upload feature (including nicEdit), but we'd have
   to tweak it to work with a back-end controller of some sort.
 
 
 


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



[web2py:35668] Problem to connect mysql with web2py

2009-11-19 Thread Alexander Cabezas

I have installed the mysql-python on a Leopard 10.5 and when i have
tryed to run my application, after mody the db.py

db = DAL('mysql://r...@localhost/database')

web2py generated a ticket with the following error:

Traceback (most recent call last):
  File gluon/restricted.py, line 184, in restricted
  File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
applications/core/models/db.py, line 15, in module
  File gluon/sql.py, line 3580, in DAL
  File gluon/sql.py, line 870, in __init__
  File gluon/sql.py, line 781, in _pool_connection
  File gluon/sql.py, line 870, in lambda
NameError: global name 'MySQLdb' is not defined

thank you very much for helping me

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



[web2py:35669] Re: GAE and belongs

2009-11-19 Thread mdipierro

GAE does not support belongs and does not support OR. You have to do:

rows = db(db.media_type.name=='paper').select()db
(db.media_type.name=='cd').select()

The  is done at the web2py level but since records are exclusive and
you are not sorting them, there is no major slowdown.

Massimo

On Nov 19, 5:49 pm, howesc how...@umich.edu wrote:
 Hello,

 I'm using Google App Engine, and trying to make use of the new
 'belongs' feature in queries (thanks much for adding it in!), and am
 having a problem.  It seems that when i construct the query my list is
 being converted to a unicode string, and then the query generation
 code fails.

 here's my model:

 db.define_table('media_type',
     Field('name', 'string', notnull=True, unique=True,
           requires=[IS_NOT_EMPTY(),
                     IS_NOT_IN_DB(db,'media_type.name')]))

 here's my query:

   rows = db(db.media_type.name.belongs(['paper', 'cd'])).select()

 here's the error:
   /cfhowes/clients/rockriver/source/web2py/applications/rockriver/
 controllers/manage.py:song_media, line 68, in song_media\n  File /
 home/cfhowes/clients/rockriver/source/web2py/gluon/contrib/gql.py,
 line 666, in select\n    (items, tablename, fields) = self._select
 (*fields, **attributes)\n  File /home/cfhowes/clients/rockriver/
 source/web2py/gluon/contrib/gql.py, line 617, in _select\n    items =
 items.filter(cond, val)\n  File /home/cfhowes/Desktop/gae/
 google_appengine/google/appengine/ext/db/__init__.py, line 1882, in
 filter\n    raise BadValueError(\'Argument to the in operator must
 be a list\')\nBadValueError: Argument to the in operator must be a
 list\n

 (sorry, it's how i copied it out of the GAE viewer)

 Here's my proposed solution - but I don't understand what i did well
 enough to know the potential other side effects.  If I modify gql.py
 (from Version 1.72.3 (2009-11-10 09:17:13)) and add the following at
 line 460:

         elif isinstance(obj, list):
             obj = obj
 which keeps the check a few lines later from converting my list to a
 unicode string.  my query now works.

 so, did i do something wrong in my query, or is this fix (or something
 similar) needed to make belongs work in the latest build?

 thanks,

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



[web2py:35670] web2py and ajax

2009-11-19 Thread Wes James

This last week I've been trying to use ajax on pages so that
everything is from http://host/app.

It seems that full mvc works when you use
http://host/app/controller/default/view, but if you have
http://host/app/ and then use:

ajax('/app/controller/view',[],'register-data')  that only the
controller information is return.  What I would like is when ajax() is
call that the data from the view is returned, i.e. the html from the
view.

for instance say I have:

def profile():
student=db(db.student.sid==user_id).select()
if (student):
form=crud.update(db.student,student[0],next=URL(r=request))
else:
form=crud.create(db.student,next=URL(r=request))
if form.errors:
response.flash=There was an error submitting the form!
Please check for any errors below the fields.
return dict(form=form,response=response)

if I go to http://host/app/default/profile  (meaning there is def
profile in default.py and profile.html in default/profile.html) this
will work fine.

But if I load the page http://host/app then use
ajax('/app/default/profile', [], 'adiv') then the div is filled with
python object, where as if def profile (): return html will return
proper info to adiv.  Why is this?  It seems like the view is skipped
with ajax() js.

thx,

-wes

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



[web2py:35671] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread Wes James

web2py has xmlrpc service - would that help any?

-wes

On Thu, Nov 19, 2009 at 9:05 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 As far as integrating CKeditor, easy.

 Integrating something like CKFinder however, is a whole nother story. I have
 been researching, and it seems that the backend code will need to be ported
 from their examples, to web2py. CKFinder uses mostly XML to communicate for
 file browsing etc, and with a little bit of firebug magic and some time, I
 think a workable back end is possible.

 I'm thinking this can be designed as a web2py plug-in.

 -Thadeus




 On Thu, Nov 19, 2009 at 9:48 PM, Darcy Clark d4r...@gmail.com wrote:

 I'm willing to help on this - however I'm hoping someone with a deeper
 knowledge of web2py can provide some guidance on where to start and
 best practice etc...

 On Nov 20, 12:26 pm, blackthorne francisco@gmail.com wrote:
  That was one my first intentions when I got into web2py. Just to say
  I'm willing to work for that. Get a WYSIWYG web based editor like kupu
  or TinyMCE or FCKeditor in web2py for rich content handling. My idea
  for that would be to turn it as a optional setting (namely for the
  views).
  Afaik kupu started outside the Plone project but became assimilated.
  Seems to me it should be possible to integrate it on any project but
  probably harder than with TinyMCE or FCKeditor/CKeditor.
 
  Anyone feels like putting hands-on this?
 
  On Nov 19, 12:09 am, Darcy Clark d4r...@gmail.com wrote:
 
   I've come to web2py from a Plone CMS background. Plone integrated a
   WYSIWYG editor called kupu which allowed the upload and integration of
   images while you were editing rich content (i.e. web pages). It made
   for a smoother more integrated content editing experience in that you
   didn't have to separately upload the images and remember or calculate
   their URLs. I'd really like to have something like this for web2py. Is
   it feasible ? I think some of the available WYSIWYG editors have some
   sort of image/file upload feature (including nicEdit), but we'd have
   to tweak it to work with a back-end controller of some sort.
 
 



 


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



[web2py:35672] Re: possible ? WYSIWYG editor with integrated image upload

2009-11-19 Thread Thadeus Burgess
I don't think it needs RPC. Just to return XML data.

It shouldn't be hard, we just need to start gathering data that gets
communicated between CKFinder and the server. They don't really have any
examples for implementing backend code, since they expect you to use their
written code, which is way more complicated than it needs to be.

-Thadeus




On Thu, Nov 19, 2009 at 10:18 PM, Wes James compte...@gmail.com wrote:


 web2py has xmlrpc service - would that help any?

 -wes

 On Thu, Nov 19, 2009 at 9:05 PM, Thadeus Burgess thade...@thadeusb.com
 wrote:
  As far as integrating CKeditor, easy.
 
  Integrating something like CKFinder however, is a whole nother story. I
 have
  been researching, and it seems that the backend code will need to be
 ported
  from their examples, to web2py. CKFinder uses mostly XML to communicate
 for
  file browsing etc, and with a little bit of firebug magic and some time,
 I
  think a workable back end is possible.
 
  I'm thinking this can be designed as a web2py plug-in.
 
  -Thadeus
 
 
 
 
  On Thu, Nov 19, 2009 at 9:48 PM, Darcy Clark d4r...@gmail.com wrote:
 
  I'm willing to help on this - however I'm hoping someone with a deeper
  knowledge of web2py can provide some guidance on where to start and
  best practice etc...
 
  On Nov 20, 12:26 pm, blackthorne francisco@gmail.com wrote:
   That was one my first intentions when I got into web2py. Just to say
   I'm willing to work for that. Get a WYSIWYG web based editor like kupu
   or TinyMCE or FCKeditor in web2py for rich content handling. My idea
   for that would be to turn it as a optional setting (namely for the
   views).
   Afaik kupu started outside the Plone project but became assimilated.
   Seems to me it should be possible to integrate it on any project but
   probably harder than with TinyMCE or FCKeditor/CKeditor.
  
   Anyone feels like putting hands-on this?
  
   On Nov 19, 12:09 am, Darcy Clark d4r...@gmail.com wrote:
  
I've come to web2py from a Plone CMS background. Plone integrated a
WYSIWYG editor called kupu which allowed the upload and integration
 of
images while you were editing rich content (i.e. web pages). It made
for a smoother more integrated content editing experience in that
 you
didn't have to separately upload the images and remember or
 calculate
their URLs. I'd really like to have something like this for web2py.
 Is
it feasible ? I think some of the available WYSIWYG editors have
 some
sort of image/file upload feature (including nicEdit), but we'd have
to tweak it to work with a back-end controller of some sort.
  
  
 
 
 
  
 

 


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



[web2py:35673] Re: Problem to connect mysql with web2py

2009-11-19 Thread Thadeus Burgess
Are you sure it installed to the right version of python?

Macs already come with python 2.3(or 2.4) installed, in a way that makes it
difficult for python applications to make use of it.



-Thadeus




On Thu, Nov 19, 2009 at 6:17 PM, Alexander Cabezas i...@mantecao.com.vewrote:


 I have installed the mysql-python on a Leopard 10.5 and when i have
 tryed to run my application, after mody the db.py

 db = DAL('mysql://r...@localhost/database')

 web2py generated a ticket with the following error:

 Traceback (most recent call last):
  File gluon/restricted.py, line 184, in restricted
  File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
 applications/core/models/db.py, line 15, in module
  File gluon/sql.py, line 3580, in DAL
  File gluon/sql.py, line 870, in __init__
  File gluon/sql.py, line 781, in _pool_connection
  File gluon/sql.py, line 870, in lambda
 NameError: global name 'MySQLdb' is not defined

 thank you very much for helping me

 


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



[web2py:35674] Re: Using CKEditor for editing text fields (short tutorial) using widgets

2009-11-19 Thread David

Backtick `   Apostrophe '   Single Quote ´

So hard to see that without my glasses :0(
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~--~~~~--~~--~--~---



[web2py:35675] Re: Data parser advice sort from web2py developers

2009-11-19 Thread Richard

I use lxml when available because of the speed, more robust HTML
parsing than BeautifulSoup, and better XPath support than ElementTree.
(The latest development snapshot of ElementTree improves the XPath
support.)
When lxml is not available I use ElementSoup (http://effbot.org/zone/
element-soup.htm) because I prefer using the ElementTree interface.

Richard


On Nov 19, 1:53 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 It is not clear to me what does lxml do that element-tree does. Is it
 just an issue of speed?

 On Nov 18, 8:52 pm, Mark Larsen larsen...@gmail.com wrote:

  I've had good experience with ElementTree:

 http://effbot.org/zone/element-index.htm

  It has both straight python and a CPython versions.  It's included
  with Python = 2.5.


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



[web2py:35676] ListProperty DAL support

2009-11-19 Thread Richard

Hello,

a few months back there was a discussion about adding ListProperty
support to the DAL. How is that going?
http://groups.google.com/group/web2py/browse_thread/thread/d3a8fcffb8c6ea7d

I have been using that type on GAE and it is quite useful.
Also sometimes I am feeling lazy and really don't want to create a sub-
table!

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



[web2py:35677] Re: Problem to connect mysql with web2py

2009-11-19 Thread mdipierro

Make sure you using the source version of web2py and the same python
you used to install mysqldb.

On Nov 19, 6:17 pm, Alexander Cabezas i...@mantecao.com.ve wrote:
 I have installed the mysql-python on a Leopard 10.5 and when i have
 tryed to run my application, after mody the db.py

 db = DAL('mysql://r...@localhost/database')

 web2py generated a ticket with the following error:

 Traceback (most recent call last):
   File gluon/restricted.py, line 184, in restricted
   File /Users/acabezas/Sites/web2py/web2py.app/Contents/Resources/
 applications/core/models/db.py, line 15, in module
   File gluon/sql.py, line 3580, in DAL
   File gluon/sql.py, line 870, in __init__
   File gluon/sql.py, line 781, in _pool_connection
   File gluon/sql.py, line 870, in lambda
 NameError: global name 'MySQLdb' is not defined

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



[web2py:35678] StackOverflow clone

2009-11-19 Thread Richard

I've fallen in love with the StackOverflow interface! Would anyone be
interested in working on a StackOverflow clone implemented in web2py?

Worked could be based off an existing Django clone: 
http://github.com/cnprog/CNPROG/tree
(example usage here: http://cnprog.com/)

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



[web2py:35679] Re: GAE and belongs

2009-11-19 Thread howesc

oh, so the recent post (http://groups.google.com/group/web2py/
browse_thread/thread/e7a8240881564270) that says belongs in GAE was
made available in version 1.69.1 is incorrect?

On Nov 19, 8:10 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 GAE does not support belongs and does not support OR. You have to do:

 rows = db(db.media_type.name=='paper').select()db
 (db.media_type.name=='cd').select()

 The  is done at the web2py level but since records are exclusive and
 you are not sorting them, there is no major slowdown.

 Massimo

 On Nov 19, 5:49 pm, howesc how...@umich.edu wrote:

  Hello,

  I'm using Google App Engine, and trying to make use of the new
  'belongs' feature in queries (thanks much for adding it in!), and am
  having a problem.  It seems that when i construct the query my list is
  being converted to a unicode string, and then the query generation
  code fails.

  here's my model:

  db.define_table('media_type',
      Field('name', 'string', notnull=True, unique=True,
            requires=[IS_NOT_EMPTY(),
                      IS_NOT_IN_DB(db,'media_type.name')]))

  here's my query:

    rows = db(db.media_type.name.belongs(['paper', 'cd'])).select()

  here's the error:
    /cfhowes/clients/rockriver/source/web2py/applications/rockriver/
  controllers/manage.py:song_media, line 68, in song_media\n  File /
  home/cfhowes/clients/rockriver/source/web2py/gluon/contrib/gql.py,
  line 666, in select\n    (items, tablename, fields) = self._select
  (*fields, **attributes)\n  File /home/cfhowes/clients/rockriver/
  source/web2py/gluon/contrib/gql.py, line 617, in _select\n    items =
  items.filter(cond, val)\n  File /home/cfhowes/Desktop/gae/
  google_appengine/google/appengine/ext/db/__init__.py, line 1882, in
  filter\n    raise BadValueError(\'Argument to the in operator must
  be a list\')\nBadValueError: Argument to the in operator must be a
  list\n

  (sorry, it's how i copied it out of the GAE viewer)

  Here's my proposed solution - but I don't understand what i did well
  enough to know the potential other side effects.  If I modify gql.py
  (from Version 1.72.3 (2009-11-10 09:17:13)) and add the following at
  line 460:

          elif isinstance(obj, list):
              obj = obj
  which keeps the check a few lines later from converting my list to a
  unicode string.  my query now works.

  so, did i do something wrong in my query, or is this fix (or something
  similar) needed to make belongs work in the latest build?

  thanks,

  christian


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



[web2py:35680] select no to delete plug-in creates stacktrace

2009-11-19 Thread Thadeus Burgess
If I delete a plug-in modules file, and it asks yes or no, if I select
no, it will provide this stacktrace.

Filename is

modules/plugin_asdf.py

Traceback (most recent call last):
  File /home/thadeusb/Applications/web2py/gluon/restricted.py, line
184, in restricted

exec ccode in environment
  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/default.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/default.py,
line 1005, in module

  File /home/thadeusb/Applications/web2py/gluon/globals.py, line
103, in lambda

self._caller = lambda f: f()

  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/default.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/default.py,
line 731, in plugin

models=filter_plugins(models),
  File 
/home/thadeusb/Applications/web2py/applications/admin/controllers/default.py
http://127.0.0.1:8000/admin/default/edit/admin/controllers/default.py,
line 727, in filter_plugins

regex=re.compile('^plugin_'+plugin+'(/.*|\..*)?$')
TypeError: cannot concatenate 'str' and 'NoneType' objects


-Thadeus

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