[web2py:37118] Re: HELP with new DAL

2009-12-13 Thread mr.freeze
It got further. Worked with a sqlite app but a MySQL app throws this:

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/applications/main/models/db.py, line 22, in
module
db = SQLDB(dal_connection)
  File C:\web2py\gluon\sql.py, line 1312, in __init__
self._adapter = ADAPTERS[self._dbname]
(uri,pool_size,folder,db_codec)
  File C:\web2py\gluon\sql.py, line 410, in __init__
passwd = m.group('passwd')
IndexError: no such group


On Dec 13, 1:00 am, mdipierro mdipie...@cs.depaul.edu wrote:
 oops. I always tested the new DAL isolated. I forgot to integrate it
 with the rest of web2py.
 Done now. Please try again.

 Massimo

 On Dec 13, 12:23 am, mr.freeze nat...@freezable.com wrote:

  I updated and get this now:

  Traceback (most recent call last):
  File C:\\web2py\\gluon\\main.py, line 551, in wsgibase
  SQLDB.close_all_instances(SQLDB.rollback)
  AttributeError: type object 'SQLDB\' has no attribute
  'close_all_instances\'

  On Dec 12, 11:27 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I am rewriting the DAL to make more modular. 75% is done and it is in
   trunk.

   Please take a look. I need one official tester for each supported
   database backend (except sqlite since I can do that)

   Any volunteer?

   Now every supported backend has an adapter and most funcitons are
   delegated to the adapter so it will be easy to extend to other RDBS.
   There are still a few exceptions here and there need to be moved into
   the adapter APIs.

   Comments are appreciated. Hope this is going in the direction that
   people expect.

   Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37119] Re: new DAL('gae')

2009-12-13 Thread Richard
neat! I need to keep closer track of GAE developments ...


On Dec 13, 2:17 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 At some point GAE added support for the IN operator. I do not know
 when but when I found out I added it (belongs maps to IN). Notice that
 this is not the same as LIKE.

 Massimo

 On Dec 12, 6:19 pm, Richard richar...@gmail.com wrote:



  how did you add belongs support for GAE? I remember in a previous
  discussion this was considered not 
  possible/practical:http://code.google.com/p/web2py/issues/detail?id=56can=1

  On Dec 12, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   I have re-factored a lot of code in gluon/contrib/gql.py in order to
   make it leaner, more readable and add new syntax. Now you can do mix
   and match queries like:

   q1=(db.table.id==1)
   q2=(db.table.id0)
   q3=(db.table.field.belongs(('value1','value2','value3')))

   in expressions like

   db(q1)(q2)q3).select()
   db(q1qq3).select()
   db(...).update(...)
   db(...).delete()

   Before this patch, belongs was not supported by web2py on GAE, q1 and
   q2 could not be mixed with other conditions.

   Now you can do for example:

       d=datetime.date.today()
       db.define_table('person',Field('name'),Field('birthday','date'))
       db.person.insert(name='John',birthday=d)
       rows=db(db.person.id0)(db.person.name.belongs(('John',))).count()
       rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
                     (birthday==d).update(name='Jim')

   Moreover the db['_lastsql'] now contains a complete representation of
   the last query on GAE and it can be used for debugging, and both db, db
   (...) and can serialized as a string.

   Please check it and report any problem.

   Also please let me know if you find places in the online documentation
   that have just become obsolete.

   Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37120] Re: HELP with new DAL

2009-12-13 Thread DenesL
Using changeset 21 and mssql :

Traceback (most recent call last):
  File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/hg/applications/w2/models/db.py, line 4, in
module
db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
  File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
self._adapter = ADAPTERS[self._dbname]
(uri,pool_size,folder,db_codec)
  File C:\web2py\hg\gluon\sql.py, line 637, in __init__
uri = uri.find('://')[1]
TypeError: 'int' object is unsubscriptable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.




Re: [web2py:37121] Re: multiple SQLForms and rows datetime problem

2009-12-13 Thread Mikey Jokinen
 I'll try web2py custom date widget first. I also have time picker in the
form and it works fine!

 In ''/take_slice/25 http://www.web2pyslices.com/main/slices/take_slice/25'
month name customize is also good.

So going with these now. This, of course is solved in future! :)

I'll tell how it goes..

2009/12/13 mr.freeze nat...@freezable.com

 If you can get away with just a date, here are two options:
 http://www.web2pyslices.com/main/slices/take_slice/22
 http://www.web2pyslices.com/main/slices/take_slice/25

 The latter should be easy to modify to include the time.

 Hope that helps.

 On Dec 12, 7:36 pm, Mikey J missingtu...@gmail.com wrote:
  So I very much need help to solve this.
  custom widget tutor could also help.
 
  On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:
 
   You're not doing anything wrong. It's either a problem with the
   calendar.js plugin or the way it is implemented in web2py_ajax.html.
 
   On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:
 
This problem comes also with default view.. and Firefox, IE7..  Too
depressed to try opera ;)
 
On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:
 
 Hello,
 
 I've four rows from db, four SQLForms in view.
 {{=form1}}
 {{=form2}}
 {{=form3}}
 {{=form4}}
 forms come from same table and every form has two datetime fields.
 
 calendar only works in first form in view. Does not mather witch
 form
 comes first datetime picker works only in that form
 
 Am I doing something wrong?
 
 

 --

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




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37122] Re: Custom Form Element For Crud.Create

2009-12-13 Thread Mengu
massimo,

thank you for the hints, db.comment.post.default is working as
expected without no additional methods defined. however i also would
like to thank you for that i have also learnt how to do operations
after form insert. :)

annet,

thank you again :)

On Dec 13, 5:28 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I do not understand what you are tryng to do. If the postid is already
 in the URL (request.args(0)) why to you put it in the form?

 My best guess is that you are trying to do this:

 def view():
     postid = request.args(0)
     ## post.body = post.body.replace(\n, br /)  WARNING
     db.comment.post.readable=False
     db.comment.post.writaable=False
     db.comment.post.default=postid
     commentform = crud.create(db.comment)
     return dict(post=post, commentform=commentform)

 WARNING. The replace you are doing tells me you have XML(post.body) in
 the view. IF this is the case your app has XSS vulnerability. Do not
 do

     {{=XML(post.body.replace(\n, br /))}}

 but do

     {{=XML(post.body.replace(\n, br /),sanitize=True)}}

 or

     {{from gluon.contrib.markdown import WIKI}}
     {{=WIKI(post.body)}}

 Massimo

 On Dec 12, 6:22 pm, Mengu whalb...@gmail.com wrote:





  so far, i have managed to do this:

  def view():
      postid = request.args(0)
      post = db(db.post.id == postid).select()[0]
      post.body = post.body.replace(\n, br /)
      commentform = crud.create(db.comment, onaccept=_setPostId)
      commentform[0].append(XML('input type=hidden name=post
  value='+postid+' /'))
      return dict(post=post, commentform=commentform)

  def _setPostId(form):
      db(db.comment.id == form.vars.id).select()[0].update_record
  (post=request.vars.post)

  however as you can see, it sets the post for the comment after
  inserting the comment despite the fact that the hidden post field has
  a value inside the form which does not get posted. isn't this a bug? i
  also should note that post field is not readable and writable.

  thanks again.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37123] Re: HELP with new DAL

2009-12-13 Thread mdipierro
fixed both issues in trunk. Please try again. Thank you!

On Dec 13, 5:38 am, DenesL denes1...@yahoo.ca wrote:
 Using changeset 21 and mssql :

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/models/db.py, line 4, in
 module
     db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
   File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
     self._adapter = ADAPTERS[self._dbname]
 (uri,pool_size,folder,db_codec)
   File C:\web2py\hg\gluon\sql.py, line 637, in __init__
     uri = uri.find('://')[1]
 TypeError: 'int' object is unsubscriptable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37124] Re: multiple SQLForms and rows datetime problem

2009-12-13 Thread mdipierro
I played around with web2py_ajax.html the problem is that calendar
uses field id to identify the element. If you display twice the same
same form for the same table, the two fields have the same id and
calendar does not distinguish them.

Perhaps the problem will be gone as we move to a different calendar.




On Dec 13, 6:01 am, Mikey Jokinen missingtu...@gmail.com wrote:
  I'll try web2py custom date widget first. I also have time picker in the
 form and it works fine!

  In ''/take_slice/25 http://www.web2pyslices.com/main/slices/take_slice/25'
 month name customize is also good.

 So going with these now. This, of course is solved in future! :)

 I'll tell how it goes..

 2009/12/13 mr.freeze nat...@freezable.com

  If you can get away with just a date, here are two options:
 http://www.web2pyslices.com/main/slices/take_slice/22
 http://www.web2pyslices.com/main/slices/take_slice/25

  The latter should be easy to modify to include the time.

  Hope that helps.

  On Dec 12, 7:36 pm, Mikey J missingtu...@gmail.com wrote:
   So I very much need help to solve this.
   custom widget tutor could also help.

   On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:

You're not doing anything wrong. It's either a problem with the
calendar.js plugin or the way it is implemented in web2py_ajax.html.

On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:

 This problem comes also with default view.. and Firefox, IE7..  Too
 depressed to try opera ;)

 On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:

  Hello,

  I've four rows from db, four SQLForms in view.
  {{=form1}}
  {{=form2}}
  {{=form3}}
  {{=form4}}
  forms come from same table and every form has two datetime fields.

  calendar only works in first form in view. Does not mather witch
  form
  comes first datetime picker works only in that form

  Am I doing something wrong?

  --

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.




Re: [web2py:37125] Re: multiple SQLForms and rows datetime problem

2009-12-13 Thread rashid_aqkhan rashid_aqkhan
i will fuck u if u again mail me.
ok.
no need of ur mail again ok understand

--- On Sun, 12/13/09, mdipierro mdipie...@cs.depaul.edu wrote:


From: mdipierro mdipie...@cs.depaul.edu
Subject: [web2py:37124] Re: multiple SQLForms and rows datetime problem
To: web2py-users web2py@googlegroups.com
Date: Sunday, December 13, 2009, 12:02 PM


I played around with web2py_ajax.html the problem is that calendar
uses field id to identify the element. If you display twice the same
same form for the same table, the two fields have the same id and
calendar does not distinguish them.

Perhaps the problem will be gone as we move to a different calendar.




On Dec 13, 6:01 am, Mikey Jokinen missingtu...@gmail.com wrote:
  I'll try web2py custom date widget first. I also have time picker in the
 form and it works fine!

  In ''/take_slice/25 http://www.web2pyslices.com/main/slices/take_slice/25'
 month name customize is also good.

 So going with these now. This, of course is solved in future! :)

 I'll tell how it goes..

 2009/12/13 mr.freeze nat...@freezable.com

  If you can get away with just a date, here are two options:
 http://www.web2pyslices.com/main/slices/take_slice/22
 http://www.web2pyslices.com/main/slices/take_slice/25

  The latter should be easy to modify to include the time.

  Hope that helps.

  On Dec 12, 7:36 pm, Mikey J missingtu...@gmail.com wrote:
   So I very much need help to solve this.
   custom widget tutor could also help.

   On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:

You're not doing anything wrong. It's either a problem with the
calendar.js plugin or the way it is implemented in web2py_ajax.html.

On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:

 This problem comes also with default view.. and Firefox, IE7..  Too
 depressed to try opera ;)

 On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:

  Hello,

  I've four rows from db, four SQLForms in view.
  {{=form1}}
  {{=form2}}
  {{=form3}}
  {{=form4}}
  forms come from same table and every form has two datetime fields.

  calendar only works in first form in view. Does not mather witch
  form
  comes first datetime picker works only in that form

  Am I doing something wrong?

  --

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.





  

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37126] Re: multiple SQLForms and rows datetime problem

2009-12-13 Thread mr.freeze
Has anyone identified or built a replacement? I could try to find one.

On Dec 13, 11:02 am, mdipierro mdipie...@cs.depaul.edu wrote:
 I played around with web2py_ajax.html the problem is that calendar
 uses field id to identify the element. If you display twice the same
 same form for the same table, the two fields have the same id and
 calendar does not distinguish them.

 Perhaps the problem will be gone as we move to a different calendar.

 On Dec 13, 6:01 am, Mikey Jokinen missingtu...@gmail.com wrote:

   I'll try web2py custom date widget first. I also have time picker in the
  form and it works fine!

   In ''/take_slice/25 
  http://www.web2pyslices.com/main/slices/take_slice/25'
  month name customize is also good.

  So going with these now. This, of course is solved in future! :)

  I'll tell how it goes..

  2009/12/13 mr.freeze nat...@freezable.com

   If you can get away with just a date, here are two options:
  http://www.web2pyslices.com/main/slices/take_slice/22
  http://www.web2pyslices.com/main/slices/take_slice/25

   The latter should be easy to modify to include the time.

   Hope that helps.

   On Dec 12, 7:36 pm, Mikey J missingtu...@gmail.com wrote:
So I very much need help to solve this.
custom widget tutor could also help.

On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:

 You're not doing anything wrong. It's either a problem with the
 calendar.js plugin or the way it is implemented in web2py_ajax.html.

 On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:

  This problem comes also with default view.. and Firefox, IE7..  Too
  depressed to try opera ;)

  On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:

   Hello,

   I've four rows from db, four SQLForms in view.
   {{=form1}}
   {{=form2}}
   {{=form3}}
   {{=form4}}
   forms come from same table and every form has two datetime fields.

   calendar only works in first form in view. Does not mather witch
   form
   comes first datetime picker works only in that form

   Am I doing something wrong?

   --

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.




Re: [web2py:37127] Re: HELP with new DAL

2009-12-13 Thread Nathan Freeze
Now I get this:

Traceback (most recent call last):
  File C:\web2py\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/applications/main/models/db.py
http://127.0.0.1:8000/admin/default/edit/main/models/db.py, line 22,
in module
db = SQLDB(dal_connection)
  File C:\web2py\gluon\sql.py, line 1311, in __init__
self._adapter = ADAPTERS[self._dbname](uri,pool_size,folder,db_codec)
  File C:\web2py\gluon\sql.py, line 416, in __init__
database = m.group('db')
IndexError: no such group



On Sun, Dec 13, 2009 at 10:46 AM, mdipierro mdipie...@cs.depaul.edu wrote:

 fixed both issues in trunk. Please try again. Thank you!

 On Dec 13, 5:38 am, DenesL denes1...@yahoo.ca wrote:
  Using changeset 21 and mssql :
 
  Traceback (most recent call last):
File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
  exec ccode in environment
File C:/web2py/hg/applications/w2/models/db.py, line 4, in
  module
  db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
  self._adapter = ADAPTERS[self._dbname]
  (uri,pool_size,folder,db_codec)
File C:\web2py\hg\gluon\sql.py, line 637, in __init__
  uri = uri.find('://')[1]
  TypeError: 'int' object is unsubscriptable

 --

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




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37128] Re: can't upload w2p from/to changeset 10

2009-12-13 Thread Brian M
Odd, now with rev 25 I'm getting an error message when trying to
upload an app.

Traceback (most recent call last):
  File C:\...\web2py\gluon\main.py, line 436, in wsgibase
parse_get_post_vars(request, environ)
  File C:\...\web2py\gluon\main.py, line 308, in parse_get_post_vars
if len(pvalue):
  File C:\Python26\lib\cgi.py, line 600, in __len__
return len(self.keys())
  File C:\Python26\lib\cgi.py, line 583, in keys
raise TypeError, not indexable
TypeError: not indexable

I managed to get it working again with the following modification to
gluon/main.py

diff --git a/gluon/main.py b/gluon/main.py
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -305,8 +305,11 @@
 else:
 pvalue = listify(value)[:-len(listify
(request.get_vars[key]))]
 request.vars[key] = value
-if len(pvalue):
-request.post_vars[key] = (len(pvalue)1 and pvalue)
or pvalue[0]
+try:
+if len(pvalue):
+request.post_vars[key] = (len(pvalue)1 and
pvalue) or pvalue[0]
+except:
+request.post_vars[key] = pvalue

 def wsgibase(environ, responder):
 

Quick testing shows that I can again successfully upload an app.

~Brian

On Dec 12, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Thanks. I will fix this in trunk. As usual this is because of a new
 feature introduced in 10.

 On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:

  w2p files created with changeset 10 give this error on upload (also
  running changeset 10):

  Traceback (most recent call last):
    File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
      parse_get_post_vars(request, environ)
    File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
      ifpvalue:
    File C:\Python25\lib\cgi.py, line 633, in __len__
      return len(self.keys())
    File C:\Python25\lib\cgi.py, line 609, in keys
      raise TypeError, not indexable
  TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37129] Re: HELP with new DAL

2009-12-13 Thread mdipierro
fixed. reposting.,,

On Dec 13, 12:02 pm, Nathan Freeze nat...@freezable.com wrote:
 Now I get this:

 Traceback (most recent call last):
   File C:\web2py\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/applications/main/models/db.py
 http://127.0.0.1:8000/admin/default/edit/main/models/db.py, line 22,
 in module
     db = SQLDB(dal_connection)
   File C:\web2py\gluon\sql.py, line 1311, in __init__
     self._adapter = ADAPTERS[self._dbname](uri,pool_size,folder,db_codec)
   File C:\web2py\gluon\sql.py, line 416, in __init__
     database = m.group('db')
 IndexError: no such group

 On Sun, Dec 13, 2009 at 10:46 AM, mdipierro mdipie...@cs.depaul.edu wrote:
  fixed both issues in trunk. Please try again. Thank you!

  On Dec 13, 5:38 am, DenesL denes1...@yahoo.ca wrote:
   Using changeset 21 and mssql :

   Traceback (most recent call last):
     File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
       exec ccode in environment
     File C:/web2py/hg/applications/w2/models/db.py, line 4, in
   module
       db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
     File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
       self._adapter = ADAPTERS[self._dbname]
   (uri,pool_size,folder,db_codec)
     File C:\web2py\hg\gluon\sql.py, line 637, in __init__
       uri = uri.find('://')[1]
   TypeError: 'int' object is unsubscriptable

  --

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37130] Re: can't upload w2p from/to changeset 10

2009-12-13 Thread mdipierro
Thank you Brian, for letting me know. I think I fixed it now. Can you
give it a try?

Massimo

On Dec 13, 1:26 pm, Brian M bmere...@gmail.com wrote:
 Odd, now with rev 25 I'm getting an error message when trying to
 upload an app.

 Traceback (most recent call last):
   File C:\...\web2py\gluon\main.py, line 436, in wsgibase
     parse_get_post_vars(request, environ)
   File C:\...\web2py\gluon\main.py, line 308, in parse_get_post_vars
     if len(pvalue):
   File C:\Python26\lib\cgi.py, line 600, in __len__
     return len(self.keys())
   File C:\Python26\lib\cgi.py, line 583, in keys
     raise TypeError, not indexable
 TypeError: not indexable

 I managed to get it working again with the following modification to
 gluon/main.py

 diff --git a/gluon/main.py b/gluon/main.py
 --- a/gluon/main.py
 +++ b/gluon/main.py
 @@ -305,8 +305,11 @@
                  else:
                      pvalue = listify(value)[:-len(listify
 (request.get_vars[key]))]
              request.vars[key] = value
 -            if len(pvalue):
 -                request.post_vars[key] = (len(pvalue)1 and pvalue)
 or pvalue[0]
 +            try:
 +                if len(pvalue):
 +                    request.post_vars[key] = (len(pvalue)1 and
 pvalue) or pvalue[0]
 +            except:
 +                request.post_vars[key] = pvalue

  def wsgibase(environ, responder):
      

 Quick testing shows that I can again successfully upload an app.

 ~Brian

 On Dec 12, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote:

  Thanks. I will fix this in trunk. As usual this is because of a new
  feature introduced in 10.

  On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:

   w2p files created with changeset 10 give this error on upload (also
   running changeset 10):

   Traceback (most recent call last):
     File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
       parse_get_post_vars(request, environ)
     File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
       ifpvalue:
     File C:\Python25\lib\cgi.py, line 633, in __len__
       return len(self.keys())
     File C:\Python25\lib\cgi.py, line 609, in keys
       raise TypeError, not indexable
   TypeError: not indexable



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37131] Re: HELP with new DAL

2009-12-13 Thread mr.freeze
Works now!

On Dec 13, 2:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 fixed. reposting.,,

 On Dec 13, 12:02 pm, Nathan Freeze nat...@freezable.com wrote:

  Now I get this:

  Traceback (most recent call last):
    File C:\web2py\gluon\restricted.py, line 184, in restricted
      exec ccode in environment
    File C:/web2py/applications/main/models/db.py
  http://127.0.0.1:8000/admin/default/edit/main/models/db.py, line 22,
  in module
      db = SQLDB(dal_connection)
    File C:\web2py\gluon\sql.py, line 1311, in __init__
      self._adapter = ADAPTERS[self._dbname](uri,pool_size,folder,db_codec)
    File C:\web2py\gluon\sql.py, line 416, in __init__
      database = m.group('db')
  IndexError: no such group

  On Sun, Dec 13, 2009 at 10:46 AM, mdipierro mdipie...@cs.depaul.edu wrote:
   fixed both issues in trunk. Please try again. Thank you!

   On Dec 13, 5:38 am, DenesL denes1...@yahoo.ca wrote:
Using changeset 21 and mssql :

Traceback (most recent call last):
  File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
    exec ccode in environment
  File C:/web2py/hg/applications/w2/models/db.py, line 4, in
module
    db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
  File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
    self._adapter = ADAPTERS[self._dbname]
(uri,pool_size,folder,db_codec)
  File C:\web2py\hg\gluon\sql.py, line 637, in __init__
    uri = uri.find('://')[1]
TypeError: 'int' object is unsubscriptable

   --

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37132] Re: HELP with new DAL

2009-12-13 Thread mdipierro
Can you try edit the doctest at the bottom of sql.py to run with your
db and see if passes all tests?


On Dec 13, 2:09 pm, mr.freeze nat...@freezable.com wrote:
 Works now!

 On Dec 13, 2:02 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  fixed. reposting.,,

  On Dec 13, 12:02 pm, Nathan Freeze nat...@freezable.com wrote:

   Now I get this:

   Traceback (most recent call last):
     File C:\web2py\gluon\restricted.py, line 184, in restricted
       exec ccode in environment
     File C:/web2py/applications/main/models/db.py
   http://127.0.0.1:8000/admin/default/edit/main/models/db.py, line 22,
   in module
       db = SQLDB(dal_connection)
     File C:\web2py\gluon\sql.py, line 1311, in __init__
       self._adapter = ADAPTERS[self._dbname](uri,pool_size,folder,db_codec)
     File C:\web2py\gluon\sql.py, line 416, in __init__
       database = m.group('db')
   IndexError: no such group

   On Sun, Dec 13, 2009 at 10:46 AM, mdipierro mdipie...@cs.depaul.edu 
   wrote:
fixed both issues in trunk. Please try again. Thank you!

On Dec 13, 5:38 am, DenesL denes1...@yahoo.ca wrote:
 Using changeset 21 and mssql :

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/models/db.py, line 4, in
 module
     db3=SQLDB(mssql://usr:p...@localhost/w2pdb)
   File C:\web2py\hg\gluon\sql.py, line 1312, in __init__
     self._adapter = ADAPTERS[self._dbname]
 (uri,pool_size,folder,db_codec)
   File C:\web2py\hg\gluon\sql.py, line 637, in __init__
     uri = uri.find('://')[1]
 TypeError: 'int' object is unsubscriptable

--

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



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37133] Re: HELP with new DAL

2009-12-13 Thread DenesL
The first time I accessed appadmin/select/db3?query=db3.test.id0
it worked fine but after inserting a record (which never inserted even
after the msg said it did)
it produces a flash msg saying:

Invalid Query
'_db_codec'

note: it is a mssql db.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37134] Re: HELP with new DAL

2009-12-13 Thread mdipierro
fixed, please try again.

On Dec 13, 2:24 pm, DenesL denes1...@yahoo.ca wrote:
 The first time I accessed appadmin/select/db3?query=db3.test.id0
 it worked fine but after inserting a record (which never inserted even
 after the msg said it did)
 it produces a flash msg saying:

 Invalid Query
 '_db_codec'

 note: it is a mssql db.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37135] Substring in new DAL

2009-12-13 Thread rfx_labs
Hi Massimo,

this doesn't work any more:
nw.ekartikel.Name[4:]

  File /PATH/web2py/gluon/sql.py, line 2742, in __getslice__
s = self._db._adapter.SUBSTRING(d)
TypeError: SUBSTRING() takes exactly 4 arguments (2 given)


Martin

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37137] Re: can't upload w2p from/to changeset 10

2009-12-13 Thread Brian M
Seems to be working now - Thanks Massimo

On Dec 13, 2:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Thank you Brian, for letting me know. I think I fixed it now. Can you
 give it a try?

 Massimo

 On Dec 13, 1:26 pm, Brian M bmere...@gmail.com wrote:

  Odd, now with rev 25 I'm getting an error message when trying to
  upload an app.

  Traceback (most recent call last):
    File C:\...\web2py\gluon\main.py, line 436, in wsgibase
      parse_get_post_vars(request, environ)
    File C:\...\web2py\gluon\main.py, line 308, in parse_get_post_vars
      if len(pvalue):
    File C:\Python26\lib\cgi.py, line 600, in __len__
      return len(self.keys())
    File C:\Python26\lib\cgi.py, line 583, in keys
      raise TypeError, not indexable
  TypeError: not indexable

  I managed to get it working again with the following modification to
  gluon/main.py

  diff --git a/gluon/main.py b/gluon/main.py
  --- a/gluon/main.py
  +++ b/gluon/main.py
  @@ -305,8 +305,11 @@
                   else:
                       pvalue = listify(value)[:-len(listify
  (request.get_vars[key]))]
               request.vars[key] = value
  -            if len(pvalue):
  -                request.post_vars[key] = (len(pvalue)1 and pvalue)
  or pvalue[0]
  +            try:
  +                if len(pvalue):
  +                    request.post_vars[key] = (len(pvalue)1 and
  pvalue) or pvalue[0]
  +            except:
  +                request.post_vars[key] = pvalue

   def wsgibase(environ, responder):
       

  Quick testing shows that I can again successfully upload an app.

  ~Brian

  On Dec 12, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote:

   Thanks. I will fix this in trunk. As usual this is because of a new
   feature introduced in 10.

   On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:

w2p files created with changeset 10 give this error on upload (also
running changeset 10):

Traceback (most recent call last):
  File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
    parse_get_post_vars(request, environ)
  File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
    ifpvalue:
  File C:\Python25\lib\cgi.py, line 633, in __len__
    return len(self.keys())
  File C:\Python25\lib\cgi.py, line 609, in keys
    raise TypeError, not indexable
TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37138] Re: HELP with new DAL

2009-12-13 Thread Brian M
Tested with PostgreSQL 8.4 and Massimo's CRM app - seems to be working
OK.

(I did get a KeyError: '_db_codec' error for a while, but it went away
with a later revision.)

On Dec 13, 2:24 pm, DenesL denes1...@yahoo.ca wrote:
 The first time I accessed appadmin/select/db3?query=db3.test.id0
 it worked fine but after inserting a record (which never inserted even
 after the msg said it did)
 it produces a flash msg saying:

 Invalid Query
 '_db_codec'

 note: it is a mssql db.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37139] Re: Substring in new DAL

2009-12-13 Thread mdipierro
thanks! uploading to trunk.

Massimo

On Dec 13, 4:26 pm, rfx_labs l...@reproflex.de wrote:
 this is the patch for this:

 @@ -151,7 +151,7 @@
          return 'Random()'
      def NOT_NULL(self,default):
          return 'NOT NULL DEFAULT %s' % default
 -    def SUBSTRING(self,fieldname,pos,lenght):
 +    def SUBSTRING(self,fieldname,pos,length):
          return 'SUBSTR(%s,%s,%s)' % (fieldname, pos, length)
      def PRIMARY_KEY(self,key):
          return 'PRIMARY KEY(%s)' % key
 @@ -386,7 +386,7 @@
          }
      def RANDOM(self):
          return 'RAND()'
 -    def SUBSTRING(self,fieldname,pos,lenght):
 +    def SUBSTRING(self,fieldname,pos,length):
          return 'SUBSTRING(%s,%s,%s)' % (fieldname, pos, length)
      def DROP(self,table,mode):
          # breaks db integrity but without this mysql does not drop
 table
 @@ -605,7 +605,7 @@
          return 'LEFT OUTER JOIN'
      def RANDOM(self):
          return 'NEWID()'
 -    def SUBSTRING(self,fieldname,pos,lenght):
 +    def SUBSTRING(self,fieldname,pos,length):
          return 'SUBSTRING(%s,%s,%s)' % (fieldname, pos, length)
      def PRIMARY_KEY(self,key):
          return 'PRIMARY KEY CLUSTERED (%s)' % key
 @@ -731,7 +731,7 @@
          return 'RAND()'
      def NOT_NULL(self,default):
          return 'DEFAULT %s NOT NULL', default
 -    def SUBSTRING(self,fieldname,pos,lenght):
 +    def SUBSTRING(self,fieldname,pos,length):
          return 'SUBSTRING(%s,%s,%s)' % (fieldname, pos, length)
      def DROP(self,table,mode):
          return ['DROP TABLE %s %s;' % (table, mode), 'DROP GENERATOR
 GENID_%s;' % table]
 @@ -2738,8 +2738,8 @@
      def __getslice__(self, start, stop):
          if start  0 or stop  start:
              raise SyntaxError, 'not supported: %s - %s' % (start,
 stop)
 -        d = dict(field=str(self), pos=start + 1, length=stop - start)
 -        s = self._db._adapter.SUBSTRING(d)
 +        d = dict(fieldname=str(self), pos=start + 1, length=stop -
 start)
 +        s = self._db._adapter.SUBSTRING(**d)
          return Expression(s, 'string', self._db)

      def __getitem__(self, i):

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37140] Re: HELP with new DAL

2009-12-13 Thread mdipierro
It would help if somebody could check the regular expressions in the
new DAL (in *Adapter.__init__) vs those in the old DAL (in
SQLDB.__init__) to check I did not do mistakes in cut and paste.

Massimo

On Dec 13, 5:13 pm, Brian M bmere...@gmail.com wrote:
 Tested with PostgreSQL 8.4 and Massimo's CRM app - seems to be working
 OK.

 (I did get a KeyError: '_db_codec' error for a while, but it went away
 with a later revision.)

 On Dec 13, 2:24 pm, DenesL denes1...@yahoo.ca wrote:

  The first time I accessed appadmin/select/db3?query=db3.test.id0
  it worked fine but after inserting a record (which never inserted even
  after the msg said it did)
  it produces a flash msg saying:

  Invalid Query
  '_db_codec'

  note: it is a mssql db.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.




Re: [web2py:37141] Re: multiple SQLForms and rows datetime problem

2009-12-13 Thread Mikey Jokinen
Thanks and if quickfix (ie. with this calendar widget) comes in mind... I'll
be fixed too ;)
Any way to do something for id...  I guess should learn form factory!

Mikko
-



2009/12/13 mr.freeze nat...@freezable.com

 Has anyone identified or built a replacement? I could try to find one.

 On Dec 13, 11:02 am, mdipierro mdipie...@cs.depaul.edu wrote:
  I played around with web2py_ajax.html the problem is that calendar
  uses field id to identify the element. If you display twice the same
  same form for the same table, the two fields have the same id and
  calendar does not distinguish them.
 
  Perhaps the problem will be gone as we move to a different calendar.
 
  On Dec 13, 6:01 am, Mikey Jokinen missingtu...@gmail.com wrote:
 
I'll try web2py custom date widget first. I also have time picker in
 the
   form and it works fine!
 
In ''/take_slice/25 
 http://www.web2pyslices.com/main/slices/take_slice/25'
   month name customize is also good.
 
   So going with these now. This, of course is solved in future! :)
 
   I'll tell how it goes..
 
   2009/12/13 mr.freeze nat...@freezable.com
 
If you can get away with just a date, here are two options:
   http://www.web2pyslices.com/main/slices/take_slice/22
   http://www.web2pyslices.com/main/slices/take_slice/25
 
The latter should be easy to modify to include the time.
 
Hope that helps.
 
On Dec 12, 7:36 pm, Mikey J missingtu...@gmail.com wrote:
 So I very much need help to solve this.
 custom widget tutor could also help.
 
 On 13 joulu, 02:31, mr.freeze nat...@freezable.com wrote:
 
  You're not doing anything wrong. It's either a problem with the
  calendar.js plugin or the way it is implemented in
 web2py_ajax.html.
 
  On Dec 12, 5:49 pm, Mikey J missingtu...@gmail.com wrote:
 
   This problem comes also with default view.. and Firefox, IE7..
  Too
   depressed to try opera ;)
 
   On 13 joulu, 00:45, Mikey J missingtu...@gmail.com wrote:
 
Hello,
 
I've four rows from db, four SQLForms in view.
{{=form1}}
{{=form2}}
{{=form3}}
{{=form4}}
forms come from same table and every form has two datetime
 fields.
 
calendar only works in first form in view. Does not mather
 witch
form
comes first datetime picker works only in that form
 
Am I doing something wrong?
 
--
 
You received this message because you are subscribed to the Google
 Groups
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to
web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
.
For more options, visit this group at
   http://groups.google.com/group/web2py?hl=en.
 
 

 --

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




--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37142] Re: HELP with new DAL

2009-12-13 Thread Brian M
I went through both an older version of gluon/sql.py (hg rev 11 I
think) and the current trunk version and searched for all of the
re.compile lines. They all appear to be matching up just fine.  (Other
than the new DAL doesn't need all those nasty self._uri[8:] etc
substrings anymore).

~Brian

On Dec 13, 5:52 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 It would help if somebody could check the regular expressions in the
 new DAL (in *Adapter.__init__) vs those in the old DAL (in
 SQLDB.__init__) to check I did not do mistakes in cut and paste.

 Massimo

 On Dec 13, 5:13 pm, Brian M bmere...@gmail.com wrote:

  Tested with PostgreSQL 8.4 and Massimo's CRM app - seems to be working
  OK.

  (I did get a KeyError: '_db_codec' error for a while, but it went away
  with a later revision.)

  On Dec 13, 2:24 pm, DenesL denes1...@yahoo.ca wrote:

   The first time I accessed appadmin/select/db3?query=db3.test.id0
   it worked fine but after inserting a record (which never inserted even
   after the msg said it did)
   it produces a flash msg saying:

   Invalid Query
   '_db_codec'

   note: it is a mssql db.

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37143] Murky

2009-12-13 Thread Jonathan Lundell
It's not yet to beta, per the developer, but I'm finding Murky a very nice, 
lightweight hg GUI for OS X.

http://jens.mooseyard.com/2009/04/murky-a-mercurial-client-app/

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37144] Re: HELP with new DAL

2009-12-13 Thread DenesL
_db_codec problem gone but got a couple new mssql problems with rev.27
on winXP:

Traceback (most recent call last):
  File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
308, in module
  File C:\web2py\hg\gluon\globals.py, line 103, in lambda
self._caller = lambda f: f()
  File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
128, in insert
if form.accepts(request.vars, session):
  File C:\web2py\hg\gluon\sqlhtml.py, line 903, in accepts
self.vars.id = self.table.insert(**fields)
  File C:\web2py\hg\gluon\sql.py, line 1954, in insert
self._db._adapter.execute(query)
  File C:\web2py\hg\gluon\sql.py, line 187, in execute
return self.cursor.execute(*a, **b)
DataError: ('22018', [22018] [Microsoft][ODBC SQL Server Driver][SQL
Server]Conversion failed when converting the varchar value 'F' to data
type bit. (245) (SQLExecDirectW))

and

Traceback (most recent call last):
  File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
exec ccode in environment
  File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
308, in module
  File C:\web2py\hg\gluon\globals.py, line 103, in lambda
self._caller = lambda f: f()
  File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
128, in insert
if form.accepts(request.vars, session):
  File C:\web2py\hg\gluon\sqlhtml.py, line 858, in accepts
newfilename = field.store(source_file, original_filename)
  File C:\web2py\hg\gluon\sql.py, line 2652, in store
dest_file = open(pathfilename, 'wb')
IOError: [Errno 2] No such file or directory: 'C:\\web2py\\hg\
\applications\\w2/databases\\..\\uploads\
\test.uplo1.acf8c8d362d9.4152524f424154482e545854.TXT'

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37145] Re: can't upload w2p from/to changeset 10

2009-12-13 Thread DenesL
Works for me too with rev.27


On Dec 13, 6:08 pm, Brian M bmere...@gmail.com wrote:
 Seems to be working now - Thanks Massimo

 On Dec 13, 2:07 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  Thank you Brian, for letting me know. I think I fixed it now. Can you
  give it a try?

  Massimo

  On Dec 13, 1:26 pm, Brian M bmere...@gmail.com wrote:

   Odd, now with rev 25 I'm getting an error message when trying to
   upload an app.

   Traceback (most recent call last):
     File C:\...\web2py\gluon\main.py, line 436, in wsgibase
       parse_get_post_vars(request, environ)
     File C:\...\web2py\gluon\main.py, line 308, in parse_get_post_vars
       if len(pvalue):
     File C:\Python26\lib\cgi.py, line 600, in __len__
       return len(self.keys())
     File C:\Python26\lib\cgi.py, line 583, in keys
       raise TypeError, not indexable
   TypeError: not indexable

   I managed to get it working again with the following modification to
   gluon/main.py

   diff --git a/gluon/main.py b/gluon/main.py
   --- a/gluon/main.py
   +++ b/gluon/main.py
   @@ -305,8 +305,11 @@
                    else:
                        pvalue = listify(value)[:-len(listify
   (request.get_vars[key]))]
                request.vars[key] = value
   -            if len(pvalue):
   -                request.post_vars[key] = (len(pvalue)1 and pvalue)
   or pvalue[0]
   +            try:
   +                if len(pvalue):
   +                    request.post_vars[key] = (len(pvalue)1 and
   pvalue) or pvalue[0]
   +            except:
   +                request.post_vars[key] = pvalue

    def wsgibase(environ, responder):
        

   Quick testing shows that I can again successfully upload an app.

   ~Brian

   On Dec 12, 9:25 am, mdipierro mdipie...@cs.depaul.edu wrote:

Thanks. I will fix this in trunk. As usual this is because of a new
feature introduced in 10.

On Dec 11, 9:40 pm, DenesL denes1...@yahoo.ca wrote:

 w2p files created with changeset 10 give this error on upload (also
 running changeset 10):

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\main.py, line 436, in wsgibase
     parse_get_post_vars(request, environ)
   File C:\web2py\hg\gluon\main.py, line 308, in parse_get_post_vars
     ifpvalue:
   File C:\Python25\lib\cgi.py, line 633, in __len__
     return len(self.keys())
   File C:\Python25\lib\cgi.py, line 609, in keys
     raise TypeError, not indexable
 TypeError: not indexable

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37146] Re: HELP with new DAL

2009-12-13 Thread mdipierro
Thank you Brian!

On Dec 13, 7:34 pm, Brian M bmere...@gmail.com wrote:
 I went through both an older version of gluon/sql.py (hg rev 11 I
 think) and the current trunk version and searched for all of the
 re.compile lines. They all appear to be matching up just fine.  (Other
 than the new DAL doesn't need all those nasty self._uri[8:] etc
 substrings anymore).

 ~Brian

 On Dec 13, 5:52 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  It would help if somebody could check the regular expressions in the
  new DAL (in *Adapter.__init__) vs those in the old DAL (in
  SQLDB.__init__) to check I did not do mistakes in cut and paste.

  Massimo

  On Dec 13, 5:13 pm, Brian M bmere...@gmail.com wrote:

   Tested with PostgreSQL 8.4 and Massimo's CRM app - seems to be working
   OK.

   (I did get a KeyError: '_db_codec' error for a while, but it went away
   with a later revision.)

   On Dec 13, 2:24 pm, DenesL denes1...@yahoo.ca wrote:

The first time I accessed appadmin/select/db3?query=db3.test.id0
it worked fine but after inserting a record (which never inserted even
after the msg said it did)
it produces a flash msg saying:

Invalid Query
'_db_codec'

note: it is a mssql db.



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37147] Re: HELP with new DAL

2009-12-13 Thread mdipierro
About the first problem:

Could you check the if at line 661 in sql.py is executed? It should
be.

About the second problem: This is a mercurial problem. I guess the
uploads folder is not there and should be created.

Massimo

On Dec 13, 7:53 pm, DenesL denes1...@yahoo.ca wrote:
 _db_codec problem gone but got a couple new mssql problems with rev.27
 on winXP:

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 308, in module
   File C:\web2py\hg\gluon\globals.py, line 103, in lambda
     self._caller = lambda f: f()
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 128, in insert
     if form.accepts(request.vars, session):
   File C:\web2py\hg\gluon\sqlhtml.py, line 903, in accepts
     self.vars.id = self.table.insert(**fields)
   File C:\web2py\hg\gluon\sql.py, line 1954, in insert
     self._db._adapter.execute(query)
   File C:\web2py\hg\gluon\sql.py, line 187, in execute
     return self.cursor.execute(*a, **b)
 DataError: ('22018', [22018] [Microsoft][ODBC SQL Server Driver][SQL
 Server]Conversion failed when converting the varchar value 'F' to data
 type bit. (245) (SQLExecDirectW))

 and

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 308, in module
   File C:\web2py\hg\gluon\globals.py, line 103, in lambda
     self._caller = lambda f: f()
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 128, in insert
     if form.accepts(request.vars, session):
   File C:\web2py\hg\gluon\sqlhtml.py, line 858, in accepts
     newfilename = field.store(source_file, original_filename)
   File C:\web2py\hg\gluon\sql.py, line 2652, in store
     dest_file = open(pathfilename, 'wb')
 IOError: [Errno 2] No such file or directory: 'C:\\web2py\\hg\
 \applications\\w2/databases\\..\\uploads\
 \test.uplo1.acf8c8d362d9.4152524f424154482e545854.TXT'

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37148] Re: new DAL('gae')

2009-12-13 Thread Robin B
IN is not magic, and evaluates1 db query for each member, and should
be used carefully.

q3=(db.table.field.belongs(('value1','value2','value3')))

evaluates 3 db queries to get the result,

Robin

On Dec 13, 5:33 am, Richard richar...@gmail.com wrote:
 neat! I need to keep closer track of GAE developments ...

 On Dec 13, 2:17 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  At some point GAE added support for the IN operator. I do not know
  when but when I found out I added it (belongs maps to IN). Notice that
  this is not the same as LIKE.

  Massimo

  On Dec 12, 6:19 pm, Richard richar...@gmail.com wrote:

   how did you add belongs support for GAE? I remember in a previous
   discussion this was considered not 
   possible/practical:http://code.google.com/p/web2py/issues/detail?id=56can=1

   On Dec 12, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:

I have re-factored a lot of code in gluon/contrib/gql.py in order to
make it leaner, more readable and add new syntax. Now you can do mix
and match queries like:

q1=(db.table.id==1)
q2=(db.table.id0)
q3=(db.table.field.belongs(('value1','value2','value3')))

in expressions like

db(q1)(q2)q3).select()
db(q1qq3).select()
db(...).update(...)
db(...).delete()

Before this patch, belongs was not supported by web2py on GAE, q1 and
q2 could not be mixed with other conditions.

Now you can do for example:

    d=datetime.date.today()
    db.define_table('person',Field('name'),Field('birthday','date'))
    db.person.insert(name='John',birthday=d)
    rows=db(db.person.id0)(db.person.name.belongs(('John',))).count()
    rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
                  (birthday==d).update(name='Jim')

Moreover the db['_lastsql'] now contains a complete representation of
the last query on GAE and it can be used for debugging, and both db, db
(...) and can serialized as a string.

Please check it and report any problem.

Also please let me know if you find places in the online documentation
that have just become obsolete.

Massimo

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37149] Re: HELP with new DAL

2009-12-13 Thread mdipierro
I think I fixed the two problems in trunk. Please give it a try.

For everybody else on these lists... these problems reported in this
thread refer to testing the new DAL in trunk. It is a major rewrite.
We are testing is step by step. None of these problems affect the old
DAL in stable.

Massimo

On Dec 13, 7:53 pm, DenesL denes1...@yahoo.ca wrote:
 _db_codec problem gone but got a couple new mssql problems with rev.27
 on winXP:

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 308, in module
   File C:\web2py\hg\gluon\globals.py, line 103, in lambda
     self._caller = lambda f: f()
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 128, in insert
     if form.accepts(request.vars, session):
   File C:\web2py\hg\gluon\sqlhtml.py, line 903, in accepts
     self.vars.id = self.table.insert(**fields)
   File C:\web2py\hg\gluon\sql.py, line 1954, in insert
     self._db._adapter.execute(query)
   File C:\web2py\hg\gluon\sql.py, line 187, in execute
     return self.cursor.execute(*a, **b)
 DataError: ('22018', [22018] [Microsoft][ODBC SQL Server Driver][SQL
 Server]Conversion failed when converting the varchar value 'F' to data
 type bit. (245) (SQLExecDirectW))

 and

 Traceback (most recent call last):
   File C:\web2py\hg\gluon\restricted.py, line 184, in restricted
     exec ccode in environment
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 308, in module
   File C:\web2py\hg\gluon\globals.py, line 103, in lambda
     self._caller = lambda f: f()
   File C:/web2py/hg/applications/w2/controllers/appadmin.py, line
 128, in insert
     if form.accepts(request.vars, session):
   File C:\web2py\hg\gluon\sqlhtml.py, line 858, in accepts
     newfilename = field.store(source_file, original_filename)
   File C:\web2py\hg\gluon\sql.py, line 2652, in store
     dest_file = open(pathfilename, 'wb')
 IOError: [Errno 2] No such file or directory: 'C:\\web2py\\hg\
 \applications\\w2/databases\\..\\uploads\
 \test.uplo1.acf8c8d362d9.4152524f424154482e545854.TXT'

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37150] Re: new DAL('gae')

2009-12-13 Thread mdipierro
Unless I misunderstand. web2py is not breaking this in 3 GAE queries.
It maps the belongs in the GAE IN operator. Since the IN is executed
at the entity level, before data is aggregated, ordered and filtered,
I do not think there is any significant overhead. Or at least there
should not be. Yet I do not know how GAE is implemented and I have not
benchmarked it.

Massimo

On Dec 13, 11:17 pm, Robin B robi...@gmail.com wrote:
 IN is not magic, and evaluates1 db query for each member, and should
 be used carefully.

 q3=(db.table.field.belongs(('value1','value2','value3')))

 evaluates 3 db queries to get the result,

 Robin

 On Dec 13, 5:33 am, Richard richar...@gmail.com wrote:

  neat! I need to keep closer track of GAE developments ...

  On Dec 13, 2:17 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   At some point GAE added support for the IN operator. I do not know
   when but when I found out I added it (belongs maps to IN). Notice that
   this is not the same as LIKE.

   Massimo

   On Dec 12, 6:19 pm, Richard richar...@gmail.com wrote:

how did you add belongs support for GAE? I remember in a previous
discussion this was considered not 
possible/practical:http://code.google.com/p/web2py/issues/detail?id=56can=1

On Dec 12, 4:42 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 I have re-factored a lot of code in gluon/contrib/gql.py in order to
 make it leaner, more readable and add new syntax. Now you can do mix
 and match queries like:

 q1=(db.table.id==1)
 q2=(db.table.id0)
 q3=(db.table.field.belongs(('value1','value2','value3')))

 in expressions like

 db(q1)(q2)q3).select()
 db(q1qq3).select()
 db(...).update(...)
 db(...).delete()

 Before this patch, belongs was not supported by web2py on GAE, q1 and
 q2 could not be mixed with other conditions.

 Now you can do for example:

     d=datetime.date.today()
     db.define_table('person',Field('name'),Field('birthday','date'))
     db.person.insert(name='John',birthday=d)
     rows=db(db.person.id0)(db.person.name.belongs(('John',))).count()
     rows=db(db.person.id==1)(db.person.name.belongs(('John',)))\
                   (birthday==d).update(name='Jim')

 Moreover the db['_lastsql'] now contains a complete representation of
 the last query on GAE and it can be used for debugging, and both db, 
 db
 (...) and can serialized as a string.

 Please check it and report any problem.

 Also please let me know if you find places in the online documentation
 that have just become obsolete.

 Massimo



--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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:37151] Re: Recaptcha not working in Login

2009-12-13 Thread ed
Hi hamdy,
 I assume you upgraded your web2py to the latest svn version
 Now you can do :

 def login():
 auth.settings.login_catpcha = Recaptcha
 (request,public_key,private_key)
 form = auth.login()

Yes, i upgraded to the latest version 1.72.3 by clicking click to
check for upgrades in web2py admin. Restarted the server, I tried the
above code and also modified login_catpcha to login_captcha.
Unfortunately both versions did not display the Recaptcha letters.


using latest svn version and removing lines :

I don't know where to find the code below. I didn't find it in
web2py_src.zip. Assuming there is a file such as this which folder
will i put it.

'''
   if self.settings.login_captcha != None:
form[0].insert(-1, TR('', self.settings.login_captcha,
''))'''


 from tools.py
I managed to have ed's code running :
so something like this :

if request.args(0) == 'login':
from gluon.tools import Recaptcha
form = auth.login()
form[0].insert(-1, TR('',  Recaptcha(request, 'pub',
'private'))
form[0][-1][1].append(INPUT
(_type='button',_value='Cancel',_onclick=window.location='%s';%URL
(r=request,f='index')))
return dict(form=form)
Other versions did not ran too.
Thanks Hamdy

--

You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@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.