Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Johann Spies
On 8 October 2013 15:24, Niphlod niph...@gmail.com wrote:

 the smartest thing to do would be to avoid orderby when there are less
 records than paginate.
 ...


What we should orderby to then? The only assured field that has an implicit
 index is the id (being a PK). Orderby(ing) a PK should definitely not
 require a full scan.


Why would it be necessary then to do add the id of all the tables involved
in the query?  My workaround is to specify the orderby using the id of one
of the involved tables and that already makes a big difference measured
against a query trying to use three or four fields when ordering.

Regards
Johann


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

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Mike Veltman

I found it. 

It was in db.py

db.define_table('frame',

Field('framename', type='string',
#  #unique=True,
   the problem. Is it 
a bug ?
  label=T('Framename')),
Field('description', type='string',
  label=T('Description')),
Field('netboot', type='string',default=None,
  label=T('Netboot information')),
Field('ip', type='string',
  #unique=True,
  label=T('IP Address')),
Field('servermodel', type='string',default=p6,
  label=T('Server model')),
Field('serial', type='string',default=None,
  label=T('Serial Number')),
Field('lvname', type='string',default=FRAMEx,
  label=T('Frame extension for storage logical volumes')),
Field('framestaterecord_ID', type='integer',
  label=T('Frame State record ID')),
Field('created_on','datetime',default=request.now,
  label=T('Created On'),writable=False,readable=False),
Field('modified_on','datetime',default=request.now,
  label=T('Modified On'),writable=False,readable=False,
  update=request.now),
format='%(framename)s',
migrate=True)



On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:


Ok, I am now fighting with it for two days and it drives me crazy.
My gut feeling says mysql 5.1 -- mysql 5.5 upgrade is the cause. Am I right ? 
And how do I solve it. :-)

*Error ticket for adeploy*
*Ticket ID*
192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed
*class '_mysql_exceptions.OperationalError' (1071, 'Specified key was too 
long; max key length is 767 bytes')*
*Version*
*web2py™*
Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

*Traceback*

1.

Traceback *(*most recent call last*):  *File 
/srv/web-apps/web2py/gluon/restricted.py*, *line 217*, in *restricted
*exec *ccode *in *environment  File 
/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py*, *line 178*, 
in *module*  *File /srv/web-apps/web2py/gluon/dal.py*, *line 7911*, in 
*define_tabletable *= 
**self.*lazy_define_table*(*tablename*,**fields*,***args*)  *File 
/srv/web-apps/web2py/gluon/dal.py*, *line 7948*, in *lazy_define_table
polymodel*=*polymodel*)  *File /srv/web-apps/web2py/gluon/dal.py*, *line 
1029*, in *create_tablefake_migrate*=*fake_migrate*)  *File 
/srv/web-apps/web2py/gluon/dal.py*, *line 1136*, in *migrate_table
*self.*execute*(*sub_query*)  *File /srv/web-apps/web2py/gluon/dal.py*, *line 
1836*, in *execute*return self.*log_execute*(**a*, ***b*)  *File 
/srv/web-apps/web2py/gluon/dal.py*, *line 1830*, in *log_executeret *= 
**self.*cursor*.*execute*(*command*, **a*[*1*:], ***b*)  *File 
/usr/lib64/python2.6/site-packages/MySQLdb/cursors.py*, *line 173*, in 
*execute*self.*errorhandler*(self, *exc*, *value*)  *File 
/usr/lib64/python2.6/site-packages/MySQLdb/connections.py*, *line 36*, in 
*defaulterrorhandler*raise *errorclass*, *errorvalueOperationalError*: 
(*1071*, *'Specified key was too long; max key length is 767 bytes'*)

*

*In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc*
1.
**code object **module* *at 0x168c468*, *file 
/srv/web-apps/web2py/applications/adeploy/compiled/models/db.py*, *line 28**





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Fri, 4 Oct 2013 19:32:36 -0700 (PDT)
IVINH toa...@gmail.com wrote:

 Nginx config:

In my case Nginx is setup as reverse-proxy and it dispatches reuqests to
gunicorn listening on local port.

 routes_in = ((
 (('.*http://demo.ivinh.com.* /*', '/demo')),
 (('.*http://demo1.ivinh.com.* /*', '/demo1'))
 ))

Would you recommend same setup, iow. using one web2py instance  if I
e.g. need to serve 3 indepdendant web sites each at different TLD, like:

http://www.domain1.com/

http://www.domain2.com/

http://www.domain3.com/

or there is some more suitable setup in such use case?


Sincerely,
Gour

-- 
A person is said to be elevated in yoga when, having renounced 
all material desires, he neither acts for sense gratification 
nor engages in fruitive activities.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: onselect ajax...

2013-10-09 Thread Avi A
Great, thanks. 

On Wednesday, October 9, 2013 3:38:19 AM UTC+3, Derek wrote:

 I'm working on a new slice, I'll finish it up tomorrow and post it on 
 web2pyslices. It will do the standard cascaded dropdown lists... car / 
 make...

 On Tuesday, October 8, 2013 5:21:41 PM UTC-7, Derek wrote:

 This recipe might help you understand how to make it work...

 http://www.web2pyslices.com/slice/show/1612/ajax-adding-child-records-to-parent

 Use the 'ajax' function to replace your div (that contains the options 
 list) and let the server render it.

 My particular 'saveAddresses.html' just has {{=houses}} because all I am 
 doing is displaying a dict (web2py makes it look decent). You'd want to 
 build your options widget with it instead of just displaying a dict.
 On Tuesday, October 8, 2013 6:29:03 AM UTC-7, Avi A wrote:

 Still stuck with that...
 Thanks.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Michele Comitini
If you have a properly clustered table,  possibly a readonly table, you
don't need any orderby even paginating through the grid.
In any case if the grid needs ordering, it's up to the grid to take care of
it, not through a magic trick by the DAL.
Here I make the assumption that other people beside me use the DAL outside
the grid without resorting to executesql() every time.
Of course my assumption is falsifiable: I could be proven wrong...


2013/10/9 Anthony abasta...@gmail.com

 Suppose I am new to web2py, but not a newbie to programming and python.  I
 have a big database and I want to publish things out of it with a nice
 framework.  I know that accessing the db is critical.  I heard web2py is
 easy to use.


 I do a simple test.  I want to know if there are more than one record of
 the kind I am looking for:

 len(db(db.long_table.value=='**Am I the only one here?').select(
 db.long_table.**id http://db.long_table.id, limitby(0,2)))

 I expect it faster than count() on a really big table.  Result slow as
 hell.  Consequence is ... ok I will use a better framework and I will post
 somewhere that web2py is nice, but slow, not for serious projects.


 Perhaps the default for a standard select should not be to automatically
 add an orderby, but the context of this thread was pagination within the
 grid. Do you suggest an alternative in that case that would be faster?

 Anthony

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] I think model load order has changed since 2.6.4; global models are no longer loaded first(?)

2013-10-09 Thread Michele Comitini
Tim,

I suppose you should open a ticket about it.  This behavior must be defined
and then wrote in the book.


2013/10/9 Tim Richardson t...@tim-richardson.net

 In trunk, notice that a conditional model calling/calling_db.py
 is loading before
 db.py


 This is not what 2.6.4 does; it loads db.py first.
 I have discovered this because I have a conditional model which relies on
 database variables being created in db.py, and under trunk it breaks.

 The book says that models are executed alphabetically but it doesn't seem
 specific about models which are always executed, and models in directories.

 I assumed that global models would be loaded prior to conditional
 models.




  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 09:51:35 +0200
Khalil KHAMLICHI
khamlichi.kha...@gmail.com wrote:

 supposing you have the correct dns settings for those domaines, you
 only need to modify the routes.py file located inside web2py
 directory .

I did not find any existing routes.py file?

 here is a working file example (I am using it)
 
 # -*- coding: utf-8 -*-
 
 routers = dict(
 BASE = dict(
 domains = {
 'www.example1.com': 'app1',
 'www.example2.com': 'app2',
 }
 ),
 )

With the above one I always get the default 'welcome' app, although set
my domains to map to cloned apps.

I've:

routers = dict(
BASE = dict(
domains = {
'domain1.com': 'welcome',
'domain2.com': 'clone2',
'domain3.com': 'clone3',
}
),
)

If I visit: www.domain2.com/clone2 I get access to 'clone2' app.

Probably I do miss something..will do some more reading...

 hope this helps.

Yes. Is the above-like setup also recommended in the practice?

I'm asking 'cause it really makes deploying web2py-powered sites (aka
apps) breeze in comparison with the fiddling required for django sites.


Sincerely,
Gour

-- 
One who restrains the senses of action but whose mind dwells on 
sense objects certainly deludes himself and is called a pretender.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: How to serve multiple domains and multiple applications on nginx using pattern-based route

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 09:51:35 +0200
Khalil KHAMLICHI
khamlichi.kha...@gmail.com wrote:

 hope this helps.

Ahh...forgot to restart gunicorn. :-(

All is well now or web2py rocks. ;)


Sincerely,
Gour

-- 
As the embodied soul continuously passes, in this body, 
from boyhood to youth to old age, the soul similarly passes 
into another body at death. A sober person is not bewildered 
by such a change.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Occasionally getting this error

2013-10-09 Thread damufo
I have same problem (occasionally)

SO Debian 7 VPS

83.37.153.54.2013-10-09.08-47-01.c139aa5f-0503-4642-933c-a4b3460c70a0
Version  web2py™ Version 2.6.4-stable+timestamp.2013.09.22.01.43.37  
Traceback 

1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.

Traceback (most recent call last):
  File /home/www-data/web2py/gluon/main.py, line 550, in wsgibase
BaseAdapter.close_all_instances('rollback')
  File /home/www-data/web2py/gluon/dal.py, line 558, in close_all_instances
db._adapter.close(action)
  File /home/www-data/web2py/gluon/dal.py, line 538, in close
getattr(self, action)()
  File /home/www-data/web2py/gluon/dal.py, line 1789, in rollback
return self.connection.rollback()
  File /home/www-data/web2py/gluon/contrib/pymysql/connections.py, line 640, 
in rollback
self.errorhandler(None, exc, value)
  File /home/www-data/web2py/gluon/contrib/pymysql/connections.py, line 200, 
in defaulterrorhandler
raise Error(errorclass, errorvalue)
Error: (class 'socket.error', error(32, 'Broken pipe'))

In file: Framework



Any idea?

1.






On Saturday, December 25, 2010 11:01:45 PM UTC+1, Kenneth wrote:

 I have never seen this before I upgraded to a version with the new DAL 
 and it show any very occasionally. Today I got it a lot, so I upgraded 
 to 1.91.4 and so far havn�t got it.


 Kenneth

  I cannot tell. The traceback is in pymysql so I would post there too.
  Can you tell us more?
 
  On Dec 25, 4:02 am, Kenneth Lundstr�mkenneth.t.lundst...@gmail.com
  wrote:
  Apache 2, wsgi, MySQL, Python 2.6.5, web2py 1.90.6
 
  After upgrading to the new DAL I occasionally get this error. Sometimes
  I have to reload the page 1-4 times to get it working.
 
  Should I upgrade to 1.91.4 or do you need some more info?
 
  Kenneth
 
  Error ticket for init
  Ticket ID
 
  xxx.xxx.xxx.xxx.2010-12-25.09-54-54.a54a74d6-70ac-4b4d-b943-5edbf0ac6d23
  Version
  web2py Version 1.90.6 (2010-12-20 17:36:54)
  Python Python 2.6.5: /usr/bin/python
  Traceback
 
  1.
  2.
  3.
  4.
  5.
  6.
  7.
  8.
  9.
  10.
  11.
  12.
  13.
  14.
  15.
  16.
  17.
 
  Traceback (most recent call last):
  File ggg/gluon/main.py, line 446, in wsgibase
  BaseAdapter.close_all_instances(BaseAdapter.commit)
  File ggg/gluon/dal.py, line 271, in close_all_instances
  action(instance)
  File ggg/gluon/dal.py, line 1027, in commit
  return self.connection.commit()
  File ggg/gluon/contrib/pymysql/connections.py, line 549, in 
 commit
  self.errorhandler(None, exc, value)
  File ggg/gluon/contrib/pymysql/connections.py, line 545, in 
 commit
  self._execute_command(COM_QUERY, COMMIT)
  File ggg/gluon/contrib/pymysql/connections.py, line 686, in
  _execute_command
  self._send_command(command, sql)
  File ggg/gluon/contrib/pymysql/connections.py, line 681, in
  _send_command
  sock.send(send_data)
  error: [Errno 32] Broken pipe
 
  Error snapshot help Detailed traceback description
 
  class 'socket.error'([Errno 32] Broken pipe)
 
  inspect attributes
  Exception instance attributes
  __module__ 'socket'
  __getslice__method-wrapper '__getslice__' of error object
  __str__method-wrapper '__str__' of error object
  __getattribute__method-wrapper '__getattribute__' of error object
  __dict__ {}
  __sizeof__built-in method __sizeof__ of error object
  __weakref__ None
  __init__method-wrapper '__init__' of error object
  __setattr__method-wrapper '__setattr__' of error object
  __reduce_ex__built-in method __reduce_ex__ of error object
  __new__built-in method __new__ of type object
  errno 32
  __format__built-in method __format__ of error object
  __class__class 'socket.error'
  filename None
  __doc__ None
  __getitem__method-wrapper '__getitem__' of error object
  __setstate__built-in method __setstate__ of error object
  __reduce__built-in method __reduce__ of error object
  args (32, 'Broken pipe')
  __subclasshook__built-in method __subclasshook__ of type object
  __unicode__built-in method __unicode__ of error object
  strerror 'Broken pipe'
  __delattr__method-wrapper '__delattr__' of error object
  __repr__method-wrapper '__repr__' of error object
  __hash__method-wrapper '__hash__' of error object
  Frames
 
  *
 
  File ggg/gluon/main.py in wsgibase at line 446 code arguments
  variables
  Function argument list
 
  (environ={'DOCUMENT_ROOT': 'ggg/', 'GATEWAY_INTERFACE':
  'CGI/1.1', 'HTTPS': '1', 'HTTP_ACCEPT':
  'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
  'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
  'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
  'en-gb,en;q=0.5', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE':
  
 '__utma=12350507.1333234958.1291477692.1291477692...1.1.utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)',
  'HTTP_HOST': '', ...}, responder=built-in method start_response of
  mod_wsgi.Adapter object)
  Code listing
 
  441.
  442.
  443.
  444.
  445.
  446.
 
  447.
  

[web2py] github issue tracker

2013-10-09 Thread Gour
Hello,

one of the items on web2py's wish list is moving tickets from Google to
Github (https://trello.com/c/u9Iyz3B0/31-move-tickets-to-github).

It would be really nice to have the complete project at Github, so I
wonder if web2py noob can help somehow make it happen sooner than later?


Sincerely,
Gour

-- 
What is night for all beings is the time of awakening 
for the self-controlled; and the time of awakening for 
all beings is night for the introspective sage.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] github issue tracker

2013-10-09 Thread Michele Comitini
Gour,
Could you find some literature to help accomplish the task?  This would
help a lot.

mic

2013/10/9 Gour g...@atmarama.net

 Hello,

 one of the items on web2py's wish list is moving tickets from Google to
 Github (https://trello.com/c/u9Iyz3B0/31-move-tickets-to-github).

 It would be really nice to have the complete project at Github, so I
 wonder if web2py noob can help somehow make it happen sooner than later?


 Sincerely,
 Gour

 --
 What is night for all beings is the time of awakening
 for the self-controlled; and the time of awakening for
 all beings is night for the introspective sage.

 http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: github issue tracker

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 11:20:24 +0200
Michele Comitini
michele.comit...@gmail.com wrote:

 Could you find some literature to help accomplish the task?  This
 would help a lot.

Something like this:

https://github.com/arthur-debert/google-code-issues-migrator ?


Sincerely,
Gour

-- 
Not by merely abstaining from work can one achieve freedom 
from reaction, nor by renunciation alone can one attain perfection.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: github issue tracker

2013-10-09 Thread Michele Comitini
+1

Seems good to me!


2013/10/9 Gour g...@atmarama.net

 On Wed, 9 Oct 2013 11:20:24 +0200
 Michele Comitini
 michele.comit...@gmail.com wrote:

  Could you find some literature to help accomplish the task?  This
  would help a lot.

 Something like this:

 https://github.com/arthur-debert/google-code-issues-migrator ?


 Sincerely,
 Gour

 --
 Not by merely abstaining from work can one achieve freedom
 from reaction, nor by renunciation alone can one attain perfection.

 http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] I think model load order has changed since 2.6.4; global models are no longer loaded first(?)

2013-10-09 Thread Tim Richardson
Issue 1709
https://code.google.com/p/web2py/issues/detail?id=1709 (with demonstration 
app and clear description of the problem)




On Wednesday, 9 October 2013 19:40:19 UTC+11, Michele Comitini wrote:

 Tim,

 I suppose you should open a ticket about it.  This behavior must be 
 defined and then wrote in the book.


 2013/10/9 Tim Richardson t...@tim-richardson.net javascript:

 In trunk, notice that a conditional model calling/calling_db.py
 is loading before
 db.py 


 This is not what 2.6.4 does; it loads db.py first.
 I have discovered this because I have a conditional model which relies on 
 database variables being created in db.py, and under trunk it breaks.

 The book says that models are executed alphabetically but it doesn't seem 
 specific about models which are always executed, and models in directories.

 I assumed that global models would be loaded prior to conditional 
 models.




  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] geocode() return value

2013-10-09 Thread Manuele Pesenti
Il 24/09/13 15:44, Ricardo Cárdenas ha scritto:
 Hi Manuele,

 Thanks for your email. (0,0) in effect represents two possible
 outcomes: /I could not geocode this address/ and also /please try
 again later/. How can I know if it makes sense to retry later?

 best regards -Ricardo
Hi Ricardo,
if you consider to write your own geocode function consider to query the
json service at the address:

http://maps.googleapis.com/maps/api/geocode/json

witch response is much more simply to parse using the python json library :)

M.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] compact grid howto

2013-10-09 Thread Cliff Kachinske
SQLFORM.grid for laptops. Less white space, more data. Screen shot at end 
of post.

in modules, create ui_def.py as follows:
# -*- coding: utf-8 -*-
def uidict():
return dict(widget='',
  header='',
  content='',
  default='',
  cornerall='',
  cornertop='',
  cornerbottom='',
  button='',
  buttontext='',
  buttonadd='icon plus icon-plus',
  buttonback='icon leftarrow icon-arrow-left',
  buttonexport='icon downarrow icon-download',
  buttondelete='',
  buttonedit='',
  buttontable='icon rightarrow icon-arrow-right',
  buttonview='',
  )



Controller:
import ui_def
def index(): 
ui = ui_def.uidict()
query = db.product_family.id0
form = SQLFORM.grid(query, ui=ui)
response.view = 'iindex.html'
return dict(form=form)



Add to layout.html, just before the /head tag:
 
style
  #header {margin-top:0px;}
  div .page-header {margin:5px 0 0}
  .mastheader h1 {font-size:30px}
  .main {padding: 5px 0 15px 0;}
  .web2py_breadcrumbs ul {margin-bottom:10px;}
  .web2py_grid .row_buttons a {padding: 0 5px 0 5px;}
  .web2py_grid tbody td {padding: 0 5px 0 5px;}
  .web2py_grid .row_buttons {min-height: 0;}
  /style


https://lh6.googleusercontent.com/-cpraFI36PLU/UlVQb-LdBZI/AEs/eY-J2pv3bzs/s1600/grid-compact.png

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Setting cookie expiration

2013-10-09 Thread Saurabh Kumar
Hey,

I am facing a little problem that my web2py setup is not setting the cookie
expiration time. So what happens is that the Firefox users get logged put
once they close their browser.

I want to set the cookie expiration time to a month or even more. Does
anybody know a solution?

Thanks,
Saurabh

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Anthony


 Why would it be necessary then to do add the id of all the tables involved 
 in the query?  My workaround is to specify the orderby using the id of one 
 of the involved tables and that already makes a big difference measured 
 against a query trying to use three or four fields when ordering.


With a one-to-many relationship, the primary key of a given record from the 
first table may span more than one page, so there's no guarantee that you 
will get the same set of joined records on a given page when sorting by 
only that primary key. Even if you did happen to get the same set of 
records within a page, you could get different orderings of those records 
within the page on different visits. On the other hand, I believe if you 
order by the primary key of the second table (i.e., the many side of the 
one-to-many), you should always get the same order, as there will only be 
one occurrence of each primary key in the joined set. For a many-to-many 
relationship, you would need to sort on both primary keys.

So, in your case, depending on the relationships between the tables, you 
may not need to sort on all primary keys, but it is not necessarily the 
case that you can just pick any single arbitrary primary key on which to 
sort.

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Anthony
On Wednesday, October 9, 2013 4:22:26 AM UTC-4, Michele Comitini wrote:

 If you have a properly clustered table,  possibly a readonly table, you 
 don't need any orderby even paginating through the grid.


My understanding is that having a clustered index does not guarantee a 
consistent ordering of results on all selects (not sure about read only 
tables).
 

 In any case if the grid needs ordering, it's up to the grid to take care 
 of it, not through a magic trick by the DAL.


Good point -- perhaps orderby_on_limitby should default to False -- then 
the grid can simply set it to True. Actually, I wonder if the grid should 
go further and additionally order on primary keys even when an explicit 
orderby is specified (just in case the orderby field(s) do not contain 
unique values).

Anthony

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread stefaan
Very useful! Thanks.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: DAL query: include aggregate in a SQLFORM.grid column .. no can do?

2013-10-09 Thread Massimo Di Pierro
yes. not supported

On Tuesday, 8 October 2013 06:31:55 UTC-5, Tim Richardson wrote:

 It seems that I can't use aggregate functions to create a column in a 
 SQLFORM.grid (because I can specify only a query, not a set)
 Is this correct? 

 I want to select patients with max visit date in a certain date range, 
 this I can do with 'having', but I also want to show that max visit date in 
 the grid. At the moment I do with with a helper via links (or could be a 
 virtual field).  But this is slow and non-sortable. 

 [What I use now:

 having_qry = (db_ps.visit.VisitDate.max() = low_filter)  (db_ps.visit.
 VisitDate.max() = high_filter)

 lapsed_patients = db_ps()._select(db_ps.visit.PatientNo,groupby=db_ps.
 visit.PatientNo,
  having = having_qry
 grid_query = (db_ps.cm_patient.patient_id.belongs(lapsed_patients))



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: want to Understanding web2py model by noob

2013-10-09 Thread Bapi Roy
Thanks for your reply

On Tuesday, 8 October 2013 02:47:48 UTC+5:30, Anthony wrote:

 web2py does not have an ORM (object relational mapper), so you won't be 
 creating classes to define models. Instead, web2py has a DAL (database 
 abstraction layer). Different conceptualization/implementation, but mostly 
 the same functionality as an ORM. Instead of defining classes, you create 
 instances of the Table class to define data models (a Table object 
 represents a database table or view). Read the book chapter on the DAL for 
 more details: 
 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer
 .

 Anthony

 On Monday, October 7, 2013 10:39:36 AM UTC-4, Bapi Roy wrote:

 I am from PHP with good knowledge of MVC. I am new to python and web2py.

 In PHP model is made from class, does same apply to web2py model ?

 Should I design the web2py model as i did in PHP or something I am 
 missing.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] chat-tornado in web2py using websocket_messaging.py

2013-10-09 Thread Junior Phanter
The class * RequestHandler* (tornado 3.1.1) has e new function *
_When_complete* that is called by the function  *_execute*.

--v--

def _execute(self, transforms, *args, **kwargs):
Executes this request with the given output transforms.
self._transforms = transforms
try:
if self.request.method not in self.SUPPORTED_METHODS:
raise HTTPError(405)
self.path_args = [self.decode_argument(arg) for arg in args]
self.path_kwargs = dict((k, self.decode_argument(v, name=k))
for (k, v) in kwargs.items())
# If XSRF cookies are turned on, reject form submissions without
# the proper cookie
if self.request.method not in (GET, HEAD, OPTIONS) and \
self.application.settings.get(xsrf_cookies):
self.check_xsrf_cookie()
self._when_complete(self.prepare(), self._execute_method)
except Exception as e:
self._handle_request_exception(e)

def _when_complete(self, result, callback):
try:
if result is None:
callback()
elif isinstance(result, Future):
if result.done():
if result.result() is not None:
raise ValueError('Expected None, got %r' % result)
callback()
else:
# Delayed import of IOLoop because it's not available
# on app engine
from tornado.ioloop import IOLoop
IOLoop.current().add_future(
result, functools.partial(self._when_complete,
  callback=callback))
else:
raise ValueError(Expected Future or None, got %r % result)
except Exception as e:
self._handle_request_exception(e)

--^
-


I modified websocket_messaging (in red) and is now working with the
tornado 3.1.1
(tonado 3.0 too), but do not know if you are having the exact result you
had in previous versions.


--vvv
#!/usr/bin/env python

This file is part of the web2py Web Framework
Copyrighted by Massimo Di Pierro mdipie...@cs.depaul.edu
License: LGPLv3 (http://www.gnu.org/licenses/lgpl.html)

Attention: Requires Chrome or Safari. For IE of Firefox you need
https://github.com/gimite/web-socket-js

1) install tornado (*r**equires Tornado 3.0 or late*r)

   easy_install tornado

2) start this app:

   python gluon/contrib/websocket_messaging.py -k mykey -p 

3) from any web2py app you can post messages with

   from gluon.contrib.websocket_messaging import websocket_send
   websocket_send('http://127.0.0.1:','Hello World','mykey','mygroup')

4) from any template you can receive them with

   script
   $(document).ready(function(){
  if(!*$.web2py.*web2py_websocket('ws://127.0.0.1:/realtime/mygroup
',function(e){alert(e.data)}))
 alert(html5 websocket not supported by your browser, try Google
Chrome);
   });
   /script

When the server posts a message, all clients connected to the page will
popup an alert message
Or if you want to send json messages and store evaluated json in a var
called data:

   script
   $(document).ready(function(){
  var data;
  *$.web2py*.web2py_websocket('ws://127.0.0.1:/realtime/mygroup
',function(e){data=eval('('+e.data+')')});
   });
   /script

- All communications between web2py and websocket_messaging will be
digitally signed with hmac.
- All validation is handled on the web2py side and there is no need to
modify websocket_messaging.py
- Multiple web2py instances can talk with one or more websocket_messaging
servers.
- ws://127.0.0.1:/realtime/ must be contain the IP of the
websocket_messaging server.
- Via group='mygroup' name you can support multiple groups of clients
(think of many chat-rooms)

Here is a complete sample web2py action:

def index():
form=LOAD('default','ajax_form',ajax=True)
script=SCRIPT('''
jQuery(document).ready(function(){
  var callback=function(e){alert(e.data)};
  if(!*$.web2py.*web2py_websocket('ws://
127.0.0.1:/realtime/mygroup',callback))
alert(html5 websocket not supported by your browser, try
Google Chrome);
});
''')
return dict(form=form, script=script)

def ajax_form():
form=SQLFORM.factory(Field('message'))
if form.accepts(request,session):
from gluon.contrib.websocket_messaging import websocket_send
websocket_send(
  

[web2py] Load with ajax doesn't work since upgrade 1.6

2013-10-09 Thread Michael Helbling
Hello everybody 

First of all to avoid this question: Yes I copied the appadmin and 
javascript file from the welcome app to my own app ;-) 

My Problem is, that some LOAD(ajax=True) doesn't work any-more (but not all 
loads with ajax). If I change it to LOAD(ajax=False) it works. So it seems 
there is some problem with the javascripts. 

*1. Description of the setup*

   1. 
   
   {{=DIV 
https://moe2.backbone.ch/examples/global/vars/DIV(LOAD(f='getSelection.load', 
args=request https://moe2.backbone.ch/examples/global/vars/request.args, 
ajax=True), _id='Workspace')}} *#I load a selection in the View -- This Load 
WORKS*
   
   2. 
   
   SELECT https://moe2.backbone.ch/examples/global/vars/SELECT(selOptions, 
_size=15, _name='o_id', _onclick=\
   
ajax('+URL(r=request,args=[nav_id,tool_id,ntt_id],f='getForm')+',['o_id'],'Workspace');,
 _class='ff_wide') *#In the selection is an onclick event that works too - it 
loads the form of an order*
   
   3. 
   
   IMG https://moe2.backbone.ch/examples/global/vars/IMG(_src=URL 
https://moe2.backbone.ch/examples/global/vars/URL('static','images/i24_save.png',
 extension=True), _title=T 
https://moe2.backbone.ch/examples/global/vars/T('Save only'), _border=0, 
_style='cursor:pointer;',\
 _onclick=ajax('+URL 
https://moe2.backbone.ch/examples/global/vars/URL(r=request 
https://moe2.backbone.ch/examples/global/vars/request,args=[nav_id,tool_id,ntt_id,'save'],f='saveCustomer')+',+ajaxVars+,'Workspace');)
 *#In the form is an onclick event to the function 'saveCustomer'*
   
   4. 
   
   return LOAD(f='getForm', args=request 
https://moe2.backbone.ch/examples/global/vars/request.args, vars=rvars, 
ajax=True,target='Workspace') *#saveCustomer returns a LOAD to load the Form 
again*
   
   5. The Form doesn't load, the page just displays loading... and the 
   Workspace content looks as follows: 
   div id=Workspace 
   
data-w2p_remote=/sipadm/registration/getForm.load/1/1/1/save?c_id=114999amp;c_type_id=10amp;city=Fribourgamp;clwarn=amp;comments=amp;company=amp;countrycode=champ;creditlimit=0.1amp;email=mhelbling%40backbone.champ;firstname=Alessiaamp;i_account=0amp;i_customer=0amp;i_product=9amp;isAccountReg=valueamp;langcode=framp;lastname=Locatelliamp;login=41325102428amp;mobile=amp;nzip=1700amp;o_billing_date=amp;o_id=131643amp;o_verify_date=amp;pa_id=1amp;phone=021+905+41+11amp;salut=Madameamp;sip_id=24141amp;status_id=0amp;street=Petites+Rames%2C+5loading.../div
   
If I replace in step 4 the ajax=True through ajax=False it works... If I 
copy the link in data-w2p_remote to the address bar, it works too.. 


An other example is our Mail Form. Its a simple page with a Mail Form 
(From:, To:, etc.) and at the bottom we have a Attachment Form embedded 
with a load: 
LOAD(c='mail',f='attachForm',args=args,vars=requesthttps://moe2.backbone.ch/examples/global/vars/request
.vars, ajax=True)

In the HTML the div looks like: div id=c921071710755 
data-w2p_remote=/sipadm/mail/attachForm/3/13/0/202?mail_id=202loading.../div
The path is correct, i can copy the data-w2p_remote path to the address bar 
and it loads perfectly. Our productive system runs still on web2py 2.5.1. 
This problem occurs just on our staging system (web2py 2.7.2) since we 
upgraded it to 2.6.0 with the identical code. 


*2. What I tried to fix it*

   1. after updating, all Loads didn't work, so i had to copy the web2py.js 
   and appadmin from the welcome app to all our apps, then ~50% of the loads 
   worked
   2. i tried to delete all js in the app and copied all new from the 
   welcome app, still no change (jquery was updated through this copy to 
   1.10.2)
   3. i compared the generic views and the layout.html with the welcome 
   app, but there are no differences depending on the js
   4. i replaced the web2py_ajax.html in the app with the new one. 
   5. The permissions on the files are ok (made after every change a chown 
   -R on the folder) and i restartet uwsgi after every change
   
But there is still no change. 

The Firefox debugger shows me a js failure on the loading page: 
[11:32:39.259] Empty string passed to getElementById(). @ jquery.js:3
But i don't know if this is the root of the issue or not. 50% of the jquery 
script is on line 3, so i don't know which part causes this failure. i 
tried to insert more line brakes to the jquery script, but after that 
nothing worked anymore... 


Has anyone an idea, what the root of this issue could be? Or how to find 
out, which part of the jquery script causes the getElementById failure? 

I'm fighting with this problem since a few days and i don't know what to 
try anymore... 


Best Regards 

Michael



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To 

[web2py] Re: DAL query: include aggregate in a SQLFORM.grid column .. no can do?

2013-10-09 Thread Cliff Kachinske
I realize grid is complicated enough as it is. But I would love this:

def grid(
query,

tbody=None,
...)
...
if tbody:
   # call it if it's a function
   # Insert if not
else:
   # build rows as usual
...
)



On Tuesday, October 8, 2013 7:31:55 AM UTC-4, Tim Richardson wrote:

 It seems that I can't use aggregate functions to create a column in a 
 SQLFORM.grid (because I can specify only a query, not a set)
 Is this correct? 

 I want to select patients with max visit date in a certain date range, 
 this I can do with 'having', but I also want to show that max visit date in 
 the grid. At the moment I do with with a helper via links (or could be a 
 virtual field).  But this is slow and non-sortable. 

 [What I use now:

 having_qry = (db_ps.visit.VisitDate.max() = low_filter)  (db_ps.visit.
 VisitDate.max() = high_filter)

 lapsed_patients = db_ps()._select(db_ps.visit.PatientNo,groupby=db_ps.
 visit.PatientNo,
  having = having_qry
 grid_query = (db_ps.cm_patient.patient_id.belongs(lapsed_patients))



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Two loaded components on one page - How can I refresh both on submit of sqlform.grid in one?

2013-10-09 Thread Jim S
All working now, Thanks Niphlod...

-Jim

On Tuesday, October 8, 2013 4:49:30 PM UTC-5, Jim S wrote:

 Niphlod - once again you have decoded my poorly worded question and given 
 me the solution.  Yes, I'm talking about checkboxes and refreshing the 
 second grid in a separate component.  I will give this a try and report 
 back.

 Thanks  -Jim

 On Tuesday, October 8, 2013 4:28:59 PM UTC-5, Niphlod wrote:

 let's go with the uber-difficult setup (assuming that you meant grid 
 with checkboxes and the submit button is the one that shows up when you 
 pass a lambda to selectable)


 def grid1():
 a = 'grid1 %s' % request.now
 grid = SQLFORM.grid(db.auth_user, formname='grid1', user_signature=
 False, selectable=lambda ids: redirect(URL(vars=dict(check=ids
 #something was checked, on reload trigger a component refresh on 
 grid2_div
 if request.vars.check:
 response.js = $.web2py.component('%s', 'grid2_div') % URL(
 'grid2.load')
 return locals()

 def grid2():
 a = 'grid2 %s' % request.now
 grid = SQLFORM.grid(db.auth_user, formname='grid2', user_signature=
 False)
 return locals()

 def grid_all():
 a = LOAD('default', 'grid1.load', ajax=True, target='grid1_div')
 b = LOAD('default', 'grid2.load', ajax=True, target='grid2_div')
 return locals()



 or, you leave out the response.js part and include in grid1.html the 
 following js snippet

 $('#grid1_div .web2py_grid .web2py_table form').submit(
  function() {
  var action = $('#grid2_div').data('w2p_remote');
  $.web2py.component(action, 'grid2_div')
  }
 )

 voilà: good to go.

 On Tuesday, October 8, 2013 11:05:26 PM UTC+2, Niphlod wrote:

 let's see...what is a grid with select boxes ? you mean checkboxes ? 
 how is it configured the first grid to be refreshed ?

 On Tuesday, October 8, 2013 10:53:56 PM UTC+2, Jim S wrote:

 I have a SQLFORM.grid in a loaded component on my page with select 
 boxes.  When I click on the submit button I want to refresh the grid, but 
 when that is done I also want to refresh the grid in the other loaded 
 component that is on the page.

 Is this making sense?  

 Anyone know how I can do that?

 -Jim



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Help me test model subfolders

2013-10-09 Thread Massimo Di Pierro
There is a problem with sorting of model subfolders in 2.7.2. We made some 
changes in trunk. Please help me check that:

[ ] if you have a byte-compiled app, it still runs fine
[ ] if you byte-compiler an app with trunk, it runs fine
[ ] models are executed in this order:
models/*.py (alphabetically) then  
models/controller*.py(alphabetically) then
models/controller/function/*.py (also alphabetically)
[ ] if you set response.models_to_run (described in the book) the filter 
works correctly for normal apps and byte code compiled apps.





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Execute Command On Remote Server Via SSH from Web2py

2013-10-09 Thread Jason Gray
Hi All,

I'm not sure that this is exactly a web2py question, but it seems like this 
is where the smart people hang out so I'll post here in hopes of some help.

I am trying to execute a command like this from within a web2py page:

ssh pi@remotehost.local /etc/scripts/script.sh parameter1 parameter2  
/etc/scripts/logs/script.txt

I have ssh keys installed so the user pi can log in to remotehost.local 
password free and it works from the terminal

However, I have web2py installed in apache using this script:

http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh

So I think it is a user/permissions/account issue that I am not sure how to 
troubleshoot.

Any ideas or suggestions?

Jason

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Load with ajax doesn't work since upgrade 1.6

2013-10-09 Thread Massimo Di Pierro
You need to copy web2py.js from the latest welcome app into your old app.

On Wednesday, 9 October 2013 04:57:20 UTC-5, Michael Helbling wrote:

 Hello everybody 

 First of all to avoid this question: Yes I copied the appadmin and 
 javascript file from the welcome app to my own app ;-) 

 My Problem is, that some LOAD(ajax=True) doesn't work any-more (but not 
 all loads with ajax). If I change it to LOAD(ajax=False) it works. So it 
 seems there is some problem with the javascripts. 

 *1. Description of the setup*

1. 

{{=DIV 
 https://moe2.backbone.ch/examples/global/vars/DIV(LOAD(f='getSelection.load',
  args=request https://moe2.backbone.ch/examples/global/vars/request.args, 
 ajax=True), _id='Workspace')}} *#I load a selection in the View -- This Load 
 WORKS*

2. 

SELECT https://moe2.backbone.ch/examples/global/vars/SELECT(selOptions, 
 _size=15, _name='o_id', _onclick=\

 ajax('+URL(r=request,args=[nav_id,tool_id,ntt_id],f='getForm')+',['o_id'],'Workspace');,
  _class='ff_wide') *#In the selection is an onclick event that works too - it 
 loads the form of an order*

3. 

IMG https://moe2.backbone.ch/examples/global/vars/IMG(_src=URL 
 https://moe2.backbone.ch/examples/global/vars/URL('static','images/i24_save.png',
  extension=True), _title=T 
 https://moe2.backbone.ch/examples/global/vars/T('Save only'), _border=0, 
 _style='cursor:pointer;',\
  _onclick=ajax('+URL 
 https://moe2.backbone.ch/examples/global/vars/URL(r=request 
 https://moe2.backbone.ch/examples/global/vars/request,args=[nav_id,tool_id,ntt_id,'save'],f='saveCustomer')+',+ajaxVars+,'Workspace');)
  *#In the form is an onclick event to the function 'saveCustomer'*

4. 

return LOAD(f='getForm', args=request 
 https://moe2.backbone.ch/examples/global/vars/request.args, vars=rvars, 
 ajax=True,target='Workspace') *#saveCustomer returns a LOAD to load the Form 
 again*

5. The Form doesn't load, the page just displays loading... and the 
Workspace content looks as follows: 
div id=Workspace 

 data-w2p_remote=/sipadm/registration/getForm.load/1/1/1/save?c_id=114999amp;c_type_id=10amp;city=Fribourgamp;clwarn=amp;comments=amp;company=amp;countrycode=champ;creditlimit=0.1amp;firstname=Alessiaamp;i_account=0amp;i_customer=0amp;i_product=9amp;isAccountReg=valueamp;langcode=framp;amp;login=41325102428amp;mobile=amp;nzip=1700amp;o_billing_date=amp;o_id=131643amp;o_verify_date=amp;pa_id=1amp;phone=021+905+41+11amp;salut=Madameamp;sip_id=24141amp;status_id=0loading.../div

 If I replace in step 4 the ajax=True through ajax=False it works... If I 
 copy the link in data-w2p_remote to the address bar, it works too.. 


 An other example is our Mail Form. Its a simple page with a Mail Form 
 (From:, To:, etc.) and at the bottom we have a Attachment Form embedded 
 with a load: 
 LOAD(c='mail',f='attachForm',args=args,vars=requesthttps://moe2.backbone.ch/examples/global/vars/request
 .vars, ajax=True)

 In the HTML the div looks like: div id=c921071710755 
 data-w2p_remote=/sipadm/mail/attachForm/3/13/0/202?mail_id=202loading.../div
 The path is correct, i can copy the data-w2p_remote path to the address 
 bar and it loads perfectly. Our productive system runs still on web2py 
 2.5.1. This problem occurs just on our staging system (web2py 2.7.2) since 
 we upgraded it to 2.6.0 with the identical code. 


 *2. What I tried to fix it*

1. after updating, all Loads didn't work, so i had to copy the 
web2py.js and appadmin from the welcome app to all our apps, then ~50% of 
the loads worked
2. i tried to delete all js in the app and copied all new from the 
welcome app, still no change (jquery was updated through this copy to 
1.10.2)
3. i compared the generic views and the layout.html with the welcome 
app, but there are no differences depending on the js
4. i replaced the web2py_ajax.html in the app with the new one. 
5. The permissions on the files are ok (made after every change a 
chown -R on the folder) and i restartet uwsgi after every change

 But there is still no change. 

 The Firefox debugger shows me a js failure on the loading page: 
 [11:32:39.259] Empty string passed to getElementById(). @ jquery.js:3
 But i don't know if this is the root of the issue or not. 50% of the 
 jquery script is on line 3, so i don't know which part causes this failure. 
 i tried to insert more line brakes to the jquery script, but after that 
 nothing worked anymore... 


 Has anyone an idea, what the root of this issue could be? Or how to find 
 out, which part of the jquery script causes the getElementById failure? 

 I'm fighting with this problem since a few days and i don't know what to 
 try anymore... 


 Best Regards 

 Michael





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- 

[web2py] Re: DAL query: include aggregate in a SQLFORM.grid column .. no can do?

2013-10-09 Thread Massimo Di Pierro
?

On Wednesday, 9 October 2013 09:21:41 UTC-5, Cliff Kachinske wrote:

 I realize grid is complicated enough as it is. But I would love this:

 def grid(
 query,
 
 tbody=None,
 ...)
 ...
 if tbody:
# call it if it's a function
# Insert if not
 else:
# build rows as usual
 ...
 )



 On Tuesday, October 8, 2013 7:31:55 AM UTC-4, Tim Richardson wrote:

 It seems that I can't use aggregate functions to create a column in a 
 SQLFORM.grid (because I can specify only a query, not a set)
 Is this correct? 

 I want to select patients with max visit date in a certain date range, 
 this I can do with 'having', but I also want to show that max visit date in 
 the grid. At the moment I do with with a helper via links (or could be a 
 virtual field).  But this is slow and non-sortable. 

 [What I use now:

 having_qry = (db_ps.visit.VisitDate.max() = low_filter)  (db_ps.visit.
 VisitDate.max() = high_filter)

 lapsed_patients = db_ps()._select(db_ps.visit.PatientNo,groupby=db_ps.
 visit.PatientNo,
  having = having_qry
 grid_query = (db_ps.cm_patient.patient_id.belongs(lapsed_patients))



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] mandrill SMTP

2013-10-09 Thread Mirek Zvolský
I try set parameters for mandrillapp.com:
mail.settings.server = 'smtp.mandrillapp.com:587'
mail.settings.sender = 'mirek@zvol...@gmail.com'
mail.settings.login = 'mirek@zvol...@gmail.com:my_API_key_here'

F.e. Request_reset_password will write mail sent. However it doesn't work.
With smtp.gmail.com it works.
I'm not sure, if I can use domain 'gmail.com' in sender/login (or mandrill 
gives some address?). Or some settings in web interface of mandrill are 
necessary?
Or sending domain need to be as parameter? And is it possible set with 
gluon.tools.Mail?

In mandrillapp web interface I don't see the mail at all. In fact I don't 
know where to seek for him.

From telnet I have tested basic accessibilty (not login or more) of 
smtp.mandrillapp.com:587. It is accessible.

Not very important, but if somebody want try mandrill..

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: mandrill SMTP

2013-10-09 Thread Mirek Zvolský
Here f.e. settings from Heroku - domain heroku.com is parametr here:

ActionMailer::Base.smtp_settings = {
:port =   '587',
:address ='smtp.mandrillapp.com',
:user_name =  ENV['MANDRILL_USERNAME'],
:password =   ENV['MANDRILL_APIKEY'],
:domain = 'heroku.com',
:authentication = :plain
}ActionMailer::Base.delivery_method = :smtp

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Massimo DiPierro
Should'd grid elements be ordered to allow pagination?

On Oct 8, 2013, at 6:45 PM, Michele Comitini wrote:

 Whenever there is a big performance impact it's better not to make 
 assumptions on what is the most common use case.
 I hate to hear the web2py is slow refrain because it's false if you have a 
 good knowledge of web2py.  What concerns me is that doing hidden things that 
 impact on performance scares the newcomer and the casual tester.
 
 ---
 Suppose I am new to web2py, but not a newbie to programming and python.  I 
 have a big database and I want to publish things out of it with a nice 
 framework.  I know that accessing the db is critical.  I heard web2py is easy 
 to use.
 
 I do a simple test.  I want to know if there are more than one record of the 
 kind I am looking for:
 
 len(db(db.long_table.value=='Am I the only one 
 here?').select(db.long_table.id, limitby(0,2)))
 
 I expect it faster than count() on a really big table.  Result slow as hell.  
 Consequence is ... ok I will use a better framework and I will post somewhere 
 that web2py is nice, but slow, not for serious projects.
 ---
 
 Even worse in older releases doing a db.long_table(value='Am I the only one 
 here?') was slow, very slow and those shortcuts in web2py code are used 
 everywhere.  To the casual user it was the clear sign that no one did serious 
 testing on a large database.
 
 mic
 
 
 
 2013/10/8 Niphlod niph...@gmail.com
 the smartest thing to do would be to avoid orderby when there are less 
 records than paginate.
 However, it's unusual to have a query misbehaving for a couple hundreds 
 records, and I really don't see the point on using grid with paginate=1.
 Given that pagination is 99% of the time required, we need to orderby on 
 something
 What we should orderby to then? The only assured field that has an implicit 
 index is the id (being a PK). Orderby(ing) a PK should definitely not require 
 a full scan.
 I don't see any particular case other than exceptional misbehaving tables to 
 turn off the ordering.
 
 
 On Tuesday, October 8, 2013 1:53:50 PM UTC+2, Anthony wrote:
 
 db.table(id=3) is for returning the sole matching record, so you don't have 
 to worry about the database's arbitrary ordering of results. But when using 
 limitby to return a particular subset of records (e.g., when doing 
 pagination), don't you need to specify an orderby to guarantee that the 
 results on each query will remain in the same order?
 
 Yes you need to do it, and you need to do it in a proper way.  That is why i 
 think that forcing orderby when limitby is used is not a good idea.  Seems 
 just a hack for the grid, not a generic approach.  IMHO it's better to be 
 explicit.
 Consider that on datasets of size comparable to the window imposed by the 
 limitby, the result is that if one uses limitby then he goes slower than 
 without it, because of the implicit orderby. Maybe he wonders why (and all 
 sorts of bad things about web2py ;- )
 
 I suppose we could default orderby_on_limitby to False in the general case 
 and leave it to the developer to explicitly orderby when using limitby, but 
 what do you propose for the grid?
 
 Anthony
 
 -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Conflict between Apache2 and web2py

2013-10-09 Thread Miguel Sánchez
Hello Massimo and list members

I'm sociologist from Colombia.  technology entusiastic and have a server 
for humanitarian and professional  purposes. 

I have an entry question and a second one is about my technical 
difficulties
First Almost a month ago I knew web2py and I liked it a lot!!!, and I 
would like to have my website running on it because I found it powefull, 
secure and scalable, also I like to hack, and with new challenges I could 
learned  few things of computing. 
  
But, I don't know anything about python, I ' m not a programmer but I use 
linux from almost ten years and I know the basics to mount a server by 
myself (needing help obviously). 
What do you suggest to me?: continue installing web2py or   go back to my 
joomla platform and shutdown and go with web2py like the popular saying 
here ?

The second question, not less important, and the reason to write to you 


The problem is In my VPS Server If I run python web2py  it works fine 
in 8000 port but inmediately   My other Apache Virtual Host falls down. 
When I kill web2py, Apache goes again up when I restart it.

In contrast, tests on my  personal lapton go  well with Apache and web2py

Activating by   mod_wsgi and mod_proxy alternatives. None of them works.



So,
Could yo help me please. My project release is in November and I have a lot 
of work to do  so in website content. 
Thank you 
*
Miguel Sanchez
Bogota/ Colombia
@kublaykan




Here, some details*


My Server has these caracteristics

VPS on EC2 Amazon  Linux  3.2.0-54-virtual #82-Ubuntu SMP Tue Sep 10 
20:31:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Apache/2.2.22 
PHP Version 5.3.10-1ubuntu3.8

Loaded modules core mod_log_config mod_logio prefork http_core mod_so 
mod_alias mod_auth_basic mod_authn_file mod_authz_default 
mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi 
mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_proxy 
mod_proxy_html mod_proxy_http mod_reqtimeout mod_rewrite mod_setenvif 
mod_ssl mod_status mod_userdir mod_wsgi 
Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, 
file, glob, data, http, ftp, phar, zip Registered Stream Socket Transports tcp, 
udp, unix, udg, ssl, sslv3, tls Registered Stream Filters zlib.*, bzip2.*, 
convert.iconv.*, string.rot13, string.toupper, string.tolower, 
string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.* 

Virtual Directory support disabled  (and I use my sites-enabled with 
a2ensite /// (I tought that I was using virtual directory with my 
sites-available Virtual...configs)  

my /etc/apache2 view

drwxr-xr-x   7 root root  4096 Oct  9 15:43 .
drwxr-xr-x 116 root root  4096 Oct  9 16:29 ..
-rw-r--r--   1 root root  8358 Oct  9 16:31 apache2.conf
drwxr-xr-x   2 root root  4096 Oct  6 20:02 conf.d
-rw-r--r--   1 root root  1322 Feb  7  2012 envvars
-rw-r--r--   1 root root 1 Oct  9 15:43 httpd.conf
-rw-r--r--   1 root root 31063 Feb  7  2012 magic
drwxr-xr-x   2 root root 12288 Oct  9 13:08 mods-available
drwxr-xr-x   2 root root  4096 Oct  9 16:27 mods-enabled
-rw-r--r--   1 root root   757 Oct  8 15:23 ports.conf
drwxr-xr-x   2 root root  4096 Oct  9 16:13 sites-available
drwxr-xr-x   2 root root  4096 Oct  9 16:56 sites-enabled
-rw-r--r--   1 root root   977 Oct  9 13:39 ssl


In /var/www I have a default index page, an ushahidi platform in a sub 
domain (or virtual host) and other map application in other subdomain.



I followed the instructions on implementation recepies at 
http://www.web2py.com/books/default/chapter/36/13/recetas-de-implementacion#Configuraci%C3%B3n-con-Apache

1. Installed modules

2. Changed my  default file in /etc/apache2/sites-available  as suggested

3. Downloaded and located WEB2PY in  /var/www/web2py   asigned them to 
www-data:www-data   

First I Tried configuring  with 
mod_wsgi and  SSL content  (suggested in your page   *With this option 
nothing happened


then with 
mod_proxy * using this  server says that 

ProxyRequests are not permited 

other logs says that the mod_proxy version is earlier than my python version . 
Googling I found that
I could reconfigure the module, but I found that difference between versions 
couldn't be the problem, so I didn't used 
that option.

ALTERNATIVES USED

1. Enabled an alternate web2py in /etc/apache2/sites-available  

2. Tried to comment Proxy requests but then Apache didn't know how to execute 
web2py.py  


3.Created a web2py file in  /etc/apache2/sites-available 


So,

Could yo help me please. 
Thanks
Miguel Sanchez
@kublaykan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more 

[web2py] Re: Conflict between Apache2 and web2py

2013-10-09 Thread Massimo Di Pierro
Hello Miguel,

I am sorry you are having problems with Apache. 

First of all let me say that web2py requires programming. If you prefer to 
use a system that does not require programming like Joomla and if that 
works for you, that use Joomla. If instead you require programming (for 
example you need to implement your own forms and workflow) than you need 
web2py and in Joomla things will only be more complex.

Anyway, you should make your decision based on Apache problems. There is no 
reason to. They both interact with apache in more or less the same way.

Can you tell us more about your apache setup? specifically can we see the 
virtual host you use for web2py? Do find an error in the apache log?


On Wednesday, 9 October 2013 13:04:03 UTC-5, Miguel Sánchez wrote:

 Hello Massimo and list members

 I'm sociologist from Colombia.  technology entusiastic and have a server 
 for humanitarian and professional  purposes. 

 I have an entry question and a second one is about my technical 
 difficulties
 First Almost a month ago I knew web2py and I liked it a lot!!!, and I 
 would like to have my website running on it because I found it powefull, 
 secure and scalable, also I like to hack, and with new challenges I could 
 learned  few things of computing. 
   
 But, I don't know anything about python, I ' m not a programmer but I use 
 linux from almost ten years and I know the basics to mount a server by 
 myself (needing help obviously). 
 What do you suggest to me?: continue installing web2py or   go back to my 
 joomla platform and shutdown and go with web2py like the popular saying 
 here ?

 The second question, not less important, and the reason to write to you 


 The problem is In my VPS Server If I run python web2py  it works fine 
 in 8000 port but inmediately   My other Apache Virtual Host falls down. 
 When I kill web2py, Apache goes again up when I restart it.

 In contrast, tests on my  personal lapton go  well with Apache and web2py

 Activating by   mod_wsgi and mod_proxy alternatives. None of them works.



 So,
 Could yo help me please. My project release is in November and I have a 
 lot of work to do  so in website content. 
 Thank you 
 *
 Miguel Sanchez
 Bogota/ Colombia
 @kublaykan




 Here, some details*


 My Server has these caracteristics

 VPS on EC2 Amazon  Linux  3.2.0-54-virtual #82-Ubuntu SMP Tue Sep 10 
 20:31:18 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

 Apache/2.2.22 
 PHP Version 5.3.10-1ubuntu3.8

 Loaded modules core mod_log_config mod_logio prefork http_core mod_so 
 mod_alias mod_auth_basic mod_authn_file mod_authz_default 
 mod_authz_groupfile mod_authz_host mod_authz_user mod_autoindex mod_cgi 
 mod_deflate mod_dir mod_env mod_mime mod_negotiation mod_php5 mod_proxy 
 mod_proxy_html mod_proxy_http mod_reqtimeout mod_rewrite mod_setenvif 
 mod_ssl mod_status mod_userdir mod_wsgi 
 Registered PHP Streams https, ftps, compress.zlib, compress.bzip2, php, 
 file, glob, data, http, ftp, phar, zip Registered Stream Socket 
 Transports tcp, udp, unix, udg, ssl, sslv3, tls Registered Stream Filters 
 zlib.*, 
 bzip2.*, convert.iconv.*, string.rot13, string.toupper, string.tolower, 
 string.strip_tags, convert.*, consumed, dechunk, mcrypt.*, mdecrypt.* 

 Virtual Directory support disabled  (and I use my sites-enabled with 
 a2ensite /// (I tought that I was using virtual directory with my 
 sites-available Virtual...configs)  

 my /etc/apache2 view

 drwxr-xr-x   7 root root  4096 Oct  9 15:43 .
 drwxr-xr-x 116 root root  4096 Oct  9 16:29 ..
 -rw-r--r--   1 root root  8358 Oct  9 16:31 apache2.conf
 drwxr-xr-x   2 root root  4096 Oct  6 20:02 conf.d
 -rw-r--r--   1 root root  1322 Feb  7  2012 envvars
 -rw-r--r--   1 root root 1 Oct  9 15:43 httpd.conf
 -rw-r--r--   1 root root 31063 Feb  7  2012 magic
 drwxr-xr-x   2 root root 12288 Oct  9 13:08 mods-available
 drwxr-xr-x   2 root root  4096 Oct  9 16:27 mods-enabled
 -rw-r--r--   1 root root   757 Oct  8 15:23 ports.conf
 drwxr-xr-x   2 root root  4096 Oct  9 16:13 sites-available
 drwxr-xr-x   2 root root  4096 Oct  9 16:56 sites-enabled
 -rw-r--r--   1 root root   977 Oct  9 13:39 ssl
 

 In /var/www I have a default index page, an ushahidi platform in a sub 
 domain (or virtual host) and other map application in other subdomain.

 

 I followed the instructions on implementation recepies at 
 http://www.web2py.com/books/default/chapter/36/13/recetas-de-implementacion#Configuraci%C3%B3n-con-Apache

 1. Installed modules

 2. Changed my  default file in /etc/apache2/sites-available  as suggested

 3. Downloaded and located WEB2PY in  /var/www/web2py   asigned them to 
 www-data:www-data   

 First I Tried configuring  with 
 mod_wsgi and  SSL content  (suggested in your page   *With this option 
 nothing happened


 then with 
 mod_proxy * using this  server says that 

 ProxyRequests are not permited 

 other logs says that the mod_proxy version is earlier than my python version 
 . Googling I found 

Re: [web2py] Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Niphlod


On Wednesday, October 9, 2013 8:05:47 PM UTC+2, Massimo Di Pierro wrote:

 Should'd grid elements be ordered to allow pagination?


definitely.  assuming a set where

1  a
2  b
3  c
4  d

you need a way to tell the backend that you want only the first two 
records. With no explicit ordering, some backends return the data as its 
stored (and it could be very well 4,2,3,1 on the first round and 3,2,4,1 on 
the second). 
There's no pagination (meaning a solid way to show [1,2] and then [3,4]) 
with no order by. You can safely assume that some backends do a random 
orderby (random here means the path of least resistance) when fetching 
records.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: mandrill SMTP

2013-10-09 Thread Niphlod
really more a question on mandrill than web2py.

http://help.mandrill.com/entries/23744737-Where-do-I-find-my-SMTP-credentials-

On Wednesday, October 9, 2013 7:28:49 PM UTC+2, Mirek Zvolský wrote:

 Here f.e. settings from Heroku - domain heroku.com is parametr here:

 ActionMailer::Base.smtp_settings = {
 :port =   '587',
 :address ='smtp.mandrillapp.com',
 :user_name =  ENV['MANDRILL_USERNAME'],
 :password =   ENV['MANDRILL_APIKEY'],
 :domain = 'heroku.com',
 :authentication = :plain
 }ActionMailer::Base.delivery_method = :smtp



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread Niphlod
I'd almost publish a plugin for it :P

On Wednesday, October 9, 2013 3:30:03 PM UTC+2, stefaan wrote:

 Very useful! Thanks.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: github issue tracker

2013-10-09 Thread Niphlod
on the other end, we never crossed the discussion about the fact that 
posting an issue to google code requires no signup like posting an issue on 
github, and that you can't add attachments to github issues.

On Wednesday, October 9, 2013 12:18:57 PM UTC+2, Michele Comitini wrote:

 +1

 Seems good to me!


 2013/10/9 Gour go...@atmarama.net javascript:

 On Wed, 9 Oct 2013 11:20:24 +0200
 Michele Comitini
 michele@gmail.com javascript: wrote:

  Could you find some literature to help accomplish the task?  This
  would help a lot.

 Something like this:

 https://github.com/arthur-debert/google-code-issues-migrator ?


 Sincerely,
 Gour

 --
 Not by merely abstaining from work can one achieve freedom
 from reaction, nor by renunciation alone can one attain perfection.

 http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Niphlod
sorry for being late. This is from web2py's 2.6.0 changelog.

Attention MySQL users: The length of string fields changed from 255 to 512 
bytes. If you have migrations enabled this will trigger a large migration. 
To prevent it, first set migrate_enabled=False, upgrade, check everything 
is ok, then add length=255 to your string Fields, then re-enable migrations 
with migrate_enabled=True if needed.

tl;dr: remember to ALWAYS set length= for strings.

tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a 
too large column. 


On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman 
wrote:

   

 I found it. 

  

 It was in db.py

  

 db.define_table('frame',

  

 Field('framename', type='string',

 # #unique=True,  
 the problem. Is it a bug ?

 label=T('Framename')),

 Field('description', type='string',

 label=T('Description')),

 Field('netboot', type='string',default=None,

 label=T('Netboot information')),

 Field('ip', type='string',

 #unique=True,

 label=T('IP Address')),

 Field('servermodel', type='string',default=p6,

 label=T('Server model')),

 Field('serial', type='string',default=None,

 label=T('Serial Number')),

 Field('lvname', type='string',default=FRAMEx,

 label=T('Frame extension for storage logical volumes')),

 Field('framestaterecord_ID', type='integer',

 label=T('Frame State record ID')),

 Field('created_on','datetime',default=request.now,

 label=T('Created On'),writable=False,readable=False),

 Field('modified_on','datetime',default=request.now,

 label=T('Modified On'),writable=False,readable=False,

 update=request.now),

 format='%(framename)s',

 migrate=True)

  

  

  

 On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:

 Ok, I am now fighting with it for two days and it drives me crazy.

 My gut feeling says mysql 5.1 -- mysql 5.5 upgrade is the cause. Am I 
 right ? And how do I solve it. :-)

  

 Error ticket for adeploy

 Ticket ID

 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed

 class '_mysql_exceptions.OperationalError' (1071, 'Specified key was too 
 long; max key length is 767 bytes')

 Version
   
 web2py™
  
 Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

 Traceback

  
   
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
  
 Traceback (most recent call last):
 File /srv/web-apps/web2py/gluon/restricted.py, line 217, in restricted
 exec ccode in environment
 File /srv/web-apps/web2py/applications/adeploy/compiled/models/db.py, line 
 178, in module
 File /srv/web-apps/web2py/gluon/dal.py, line 7911, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
 File /srv/web-apps/web2py/gluon/dal.py, line 7948, in lazy_define_table
 polymodel=polymodel)
 File /srv/web-apps/web2py/gluon/dal.py, line 1029, in create_table
 fake_migrate=fake_migrate)
 File /srv/web-apps/web2py/gluon/dal.py, line 1136, in migrate_table
 self.execute(sub_query)
 File /srv/web-apps/web2py/gluon/dal.py, line 1836, in execute
 return self.log_execute(*a, **b)
 File /srv/web-apps/web2py/gluon/dal.py, line 1830, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
 File /usr/lib64/python2.6/site-packages/MySQLdb/cursors.py, line 173, in 
 execute
 self.errorhandler(self, exc, value)
 File /usr/lib64/python2.6/site-packages/MySQLdb/connections.py, line 36, 
 in defaulterrorhandler
 raise errorclass, errorvalue
 OperationalError: (1071, 'Specified key was too long; max key length is 
 767 bytes')

 In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc
   
 1.
  
 code object module at 0x168c468, file 
 /srv/web-apps/web2py/applications/adeploy/compiled/models/db.py, line 28
 

  

  





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: onselect ajax...

2013-10-09 Thread Derek
It's up... 

http://www.web2pyslices.com/slice/show/1724/cascading-dropdowns-simplified

I'm not sure if it's using the web2py best practices, and I did write it on 
2.5.1 so I don't know if it would work with the latest version (I assume 
so). In any case, it's the most basic way to do it, and it keeps the 
separation of concerns of MVC in mind. Let me know if you have questions.

Thanks,
Derek

On Wednesday, October 9, 2013 1:11:57 AM UTC-7, Avi A wrote:

 Great, thanks. 

 On Wednesday, October 9, 2013 3:38:19 AM UTC+3, Derek wrote:

 I'm working on a new slice, I'll finish it up tomorrow and post it on 
 web2pyslices. It will do the standard cascaded dropdown lists... car / 
 make...

 On Tuesday, October 8, 2013 5:21:41 PM UTC-7, Derek wrote:

 This recipe might help you understand how to make it work...

 http://www.web2pyslices.com/slice/show/1612/ajax-adding-child-records-to-parent

 Use the 'ajax' function to replace your div (that contains the options 
 list) and let the server render it.

 My particular 'saveAddresses.html' just has {{=houses}} because all I am 
 doing is displaying a dict (web2py makes it look decent). You'd want to 
 build your options widget with it instead of just displaying a dict.
 On Tuesday, October 8, 2013 6:29:03 AM UTC-7, Avi A wrote:

 Still stuck with that...
 Thanks.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Derek

On Wednesday, October 9, 2013 6:13:58 AM UTC-7, Anthony wrote:

 On Wednesday, October 9, 2013 4:22:26 AM UTC-4, Michele Comitini wrote:

 If you have a properly clustered table,  possibly a readonly table, you 
 don't need any orderby even paginating through the grid.


 My understanding is that having a clustered index does not guarantee a 
 consistent ordering of results on all selects (not sure about read only 
 tables).


You are correct. Order is not guaranteed unless you specifically request 
it. Order may be changed due to how the database reads the tables. For 
example, it may be paging through results 100-200 for another user, and you 
request the whole table. It would be faster to load those 200+ and then 
start reading from the top of the table again until it hits the 200 mark. 
It may have a cached copy in ram that was ordered by a different column. 
There are any number of things that can affect the ordering of the data 
that is returned if you didn't specify an order. A clustered index is not a 
guarantee that the selects you use without an order clause will order the 
data in a specific way. The database should load data whichever way is 
fastest.

 

 In any case if the grid needs ordering, it's up to the grid to take care 
 of it, not through a magic trick by the DAL.


 Good point -- perhaps orderby_on_limitby should default to False -- then 
 the grid can simply set it to True. Actually, I wonder if the grid should 
 go further and additionally order on primary keys even when an explicit 
 orderby is specified (just in case the orderby field(s) do not contain 
 unique values).


No, it should preserve the order you set. If you know enough to set the 
order, you can add columns to the order easily enough.
 


 Anthony


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Derek


On Wednesday, October 9, 2013 11:05:47 AM UTC-7, Massimo Di Pierro wrote:

 Should'd grid elements be ordered to allow pagination?


Yes, if you are going to scroll through a window of results, your rows 10 - 
20 can change depending on the order returned by the database. If you don't 
specify an order by clause, you're only lucky if you order stays the same 
between database calls. You may be lucky 99% of the time, but that 1% of 
the time your order is changed by the database (because you didn't tell it 
you wanted a specific order) your paging will screw up. 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: github issue tracker

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 11:44:28 -0700 (PDT)
Niphlod niph...@gmail.com wrote:

 on the other end, we never crossed the discussion about the fact
 that posting an issue to google code requires no signup like posting
 an issue on github, and that you can't add attachments to github
 issues.

Well, then the answer is Bitbucket which on top of that provides
downloads as well. ;)

It's not that I'm big fan of Github, just consider it's better than
GoogleCode, nothing else. :-)


Sincerely,
Gour

-- 
He who is satisfied with gain which comes of its own accord, who 
is free from duality and does not envy, who is steady in both 
success and failure, is never entangled, although performing actions.

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Execute Command On Remote Server Via SSH from Web2py

2013-10-09 Thread dhmorgan
is web2py running under user pi?

On Wednesday, October 9, 2013 9:57:00 AM UTC-5, Jason Gray wrote:

 Hi All,

 I'm not sure that this is exactly a web2py question, but it seems like 
 this is where the smart people hang out so I'll post here in hopes of some 
 help.

 I am trying to execute a command like this from within a web2py page:

 ssh pi@remotehost.local /etc/scripts/script.sh parameter1 parameter2  
 /etc/scripts/logs/script.txt

 I have ssh keys installed so the user pi can log in to remotehost.local 
 password free and it works from the terminal

 However, I have web2py installed in apache using this script:


 http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh

 So I think it is a user/permissions/account issue that I am not sure how 
 to troubleshoot.

 Any ideas or suggestions?

 Jason


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: github issue tracker

2013-10-09 Thread Niphlod


 Well, then the answer is Bitbucket which on top of that provides 
 downloads as well. ;) 

  
What downloads ? 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread Dave S

On Wednesday, October 9, 2013 5:51:11 AM UTC-7, Cliff Kachinske wrote:

 SQLFORM.grid for laptops. Less white space, more data. Screen shot at end 
 of post.


How are you detecting a laptop?  Are you basing this on the user agent 
screen size?

/dps


 

 in modules, create ui_def.py as follows:
 # -*- coding: utf-8 -*-
 def uidict():
 return dict(widget='',
   header='',
   content='',
   default='',
   cornerall='',
   cornertop='',
   cornerbottom='',
   button='',
   buttontext='',
   buttonadd='icon plus icon-plus',
   buttonback='icon leftarrow icon-arrow-left',
   buttonexport='icon downarrow icon-download',
   buttondelete='',
   buttonedit='',
   buttontable='icon rightarrow icon-arrow-right',
   buttonview='',
   )



 Controller:
 import ui_def
 def index(): 
 ui = ui_def.uidict()
 query = db.product_family.id0
 form = SQLFORM.grid(query, ui=ui)
 response.view = 'iindex.html'
 return dict(form=form)



 Add to layout.html, just before the /head tag:
  
 style
   #header {margin-top:0px;}
   div .page-header {margin:5px 0 0}
   .mastheader h1 {font-size:30px}
   .main {padding: 5px 0 15px 0;}
   .web2py_breadcrumbs ul {margin-bottom:10px;}
   .web2py_grid .row_buttons a {padding: 0 5px 0 5px;}
   .web2py_grid tbody td {padding: 0 5px 0 5px;}
   .web2py_grid .row_buttons {min-height: 0;}
   /style



 https://lh6.googleusercontent.com/-cpraFI36PLU/UlVQb-LdBZI/AEs/eY-J2pv3bzs/s1600/grid-compact.png


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: github issue tracker

2013-10-09 Thread Gour
On Wed, 9 Oct 2013 12:56:49 -0700 (PDT)
Niphlod niph...@gmail.com wrote:

 What downloads ? 

E.g. http://tortoisehg.bitbucket.org/download/index.html

But now I see that it seems Github has brought the feature back. :-)


Sincerely,
Gour

-- 
Many, many births both you and I have passed. I can remember 
all of them, but you cannot, O subduer of the enemy!

http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Blank screen from app/admin/edit button

2013-10-09 Thread Dave S
On Tuesday, October 8, 2013 11:23:31 AM UTC-7, Niphlod wrote:

 On Tuesday, October 8, 2013 7:36:45 PM UTC+2, Dave S wrote:

 On Monday, October 7, 2013 11:45:14 PM UTC-7, Niphlod wrote:

 I think you just need to ctrl+f5 reloading the cache of the browser. If 
 anyone isn't able to edit files through the admin app, it would rain hell 
 on web2py's developers :P


 You are right again, sir.  Thank goodness for people who know what they 
 are doing (and usually, what we are doing, too).

 /dps


 If it was a bug, it was a hell of one big bug. I mean, it **could** happen 
 that a release is made turning some feature on or off, but being unable to 
 edit files was too big to pass unnoticed. 


Hmmm, each time I go to edit for the first time after restarting the 
browser, I need to do CTRL-F5, usually followed by an F5 to load the CSS. 
 Is this an Opera issue, a setting in the browser cache, or are the default 
headers encouraging this behavior?

/dps
 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread Cliff Kachinske
Dave S
Not at all. I'm ignoring handhelds right now and assuming desktop users 
will also appreciate the extra space.

On Wednesday, October 9, 2013 4:05:32 PM UTC-4, Dave S wrote:


 On Wednesday, October 9, 2013 5:51:11 AM UTC-7, Cliff Kachinske wrote:

 SQLFORM.grid for laptops. Less white space, more data. Screen shot at end 
 of post.


 How are you detecting a laptop?  Are you basing this on the user agent 
 screen size?

 /dps


  

 in modules, create ui_def.py as follows:
 # -*- coding: utf-8 -*-
 def uidict():
 return dict(widget='',
   header='',
   content='',
   default='',
   cornerall='',
   cornertop='',
   cornerbottom='',
   button='',
   buttontext='',
   buttonadd='icon plus icon-plus',
   buttonback='icon leftarrow icon-arrow-left',
   buttonexport='icon downarrow icon-download',
   buttondelete='',
   buttonedit='',
   buttontable='icon rightarrow icon-arrow-right',
   buttonview='',
   )



 Controller:
 import ui_def
 def index(): 
 ui = ui_def.uidict()
 query = db.product_family.id0
 form = SQLFORM.grid(query, ui=ui)
 response.view = 'iindex.html'
 return dict(form=form)



 Add to layout.html, just before the /head tag:
  
 style
   #header {margin-top:0px;}
   div .page-header {margin:5px 0 0}
   .mastheader h1 {font-size:30px}
   .main {padding: 5px 0 15px 0;}
   .web2py_breadcrumbs ul {margin-bottom:10px;}
   .web2py_grid .row_buttons a {padding: 0 5px 0 5px;}
   .web2py_grid tbody td {padding: 0 5px 0 5px;}
   .web2py_grid .row_buttons {min-height: 0;}
   /style



 https://lh6.googleusercontent.com/-cpraFI36PLU/UlVQb-LdBZI/AEs/eY-J2pv3bzs/s1600/grid-compact.png



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread Cliff Kachinske
Niphlod,

Maybe I almost will. :)

On Wednesday, October 9, 2013 2:41:16 PM UTC-4, Niphlod wrote:

 I'd almost publish a plugin for it :P

 On Wednesday, October 9, 2013 3:30:03 PM UTC+2, stefaan wrote:

 Very useful! Thanks.



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Blank screen from app/admin/edit button

2013-10-09 Thread Niphlod
does it happen only on opera? if yes, what build on what os ?

On Wednesday, October 9, 2013 10:20:49 PM UTC+2, Dave S wrote:

 On Tuesday, October 8, 2013 11:23:31 AM UTC-7, Niphlod wrote:

 On Tuesday, October 8, 2013 7:36:45 PM UTC+2, Dave S wrote:

 On Monday, October 7, 2013 11:45:14 PM UTC-7, Niphlod wrote:

 I think you just need to ctrl+f5 reloading the cache of the browser. If 
 anyone isn't able to edit files through the admin app, it would rain hell 
 on web2py's developers :P


 You are right again, sir.  Thank goodness for people who know what they 
 are doing (and usually, what we are doing, too).

 /dps


 If it was a bug, it was a hell of one big bug. I mean, it **could** 
 happen that a release is made turning some feature on or off, but being 
 unable to edit files was too big to pass unnoticed. 


 Hmmm, each time I go to edit for the first time after restarting the 
 browser, I need to do CTRL-F5, usually followed by an F5 to load the CSS. 
  Is this an Opera issue, a setting in the browser cache, or are the default 
 headers encouraging this behavior?

 /dps
  


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: github issue tracker

2013-10-09 Thread Niphlod
yep, lot of peoples (me included) switched to hosting binaries on 
bitbucket. I assume they noticed and they got the feature back (kind of) 
letting releases to include binaries.

On Wednesday, October 9, 2013 10:15:48 PM UTC+2, Gour wrote:

 On Wed, 9 Oct 2013 12:56:49 -0700 (PDT) 
 Niphlod nip...@gmail.com javascript: wrote: 

  What downloads ? 

 E.g. http://tortoisehg.bitbucket.org/download/index.html 

 But now I see that it seems Github has brought the feature back. :-) 


 Sincerely, 
 Gour 

 -- 
 Many, many births both you and I have passed. I can remember 
 all of them, but you cannot, O subduer of the enemy! 

 http://www.atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810 




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Anthony


 Good point -- perhaps orderby_on_limitby should default to False -- then 
 the grid can simply set it to True. Actually, I wonder if the grid should 
 go further and additionally order on primary keys even when an explicit 
 orderby is specified (just in case the orderby field(s) do not contain 
 unique values).


 No, it should preserve the order you set. If you know enough to set the 
 order, you can add columns to the order easily enough.


Not sure I agree with that. Users typically specify an orderby only because 
they would like the records displayed in a particular order, not because 
they are seeking to explicitly handle pagination. Let's say I'm listing US 
addresses in a grid and specify orderby=db.address.state. In that case, I'm 
saying I want addresses sorted by state, and within state, I don't care 
about the order. But I'm not saying that I want pagination to fail in case 
records from a given state happen to span from one page to the next. Just 
because I want to order by state doesn't mean I know enough to provide all 
the necessary orderby fields to guarantee proper pagination. If the grid 
does this for me when I specify no orderby, why shouldn't it do it for me 
when I do specify an orderby?

Anthony 

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Blank screen from app/admin/edit button

2013-10-09 Thread Dave S
On Wednesday, October 9, 2013 1:34:11 PM UTC-7, Niphlod wrote:

 does it happen only on opera? if yes, what build on what os ?


Seems to happen on Firefox 18 on Fedora 16, but the CTRL-F5 works without 
requiring an F5 after.

Opera is 12.16 Build 1860 , and it describes the OS as i686, 
3.6.10-2.fc16.i686.PAE

Those are the two browsers local to the server; I may try remote access 
later.

/dps


On Wednesday, October 9, 2013 10:20:49 PM UTC+2, Dave S wrote:

 On Tuesday, October 8, 2013 11:23:31 AM UTC-7, Niphlod wrote:

 On Tuesday, October 8, 2013 7:36:45 PM UTC+2, Dave S wrote:

 On Monday, October 7, 2013 11:45:14 PM UTC-7, Niphlod wrote:

 I think you just need to ctrl+f5 reloading the cache of the browser. 
 If anyone isn't able to edit files through the admin app, it would rain 
 hell on web2py's developers :P


 You are right again, sir.  Thank goodness for people who know what they 
 are doing (and usually, what we are doing, too).

 /dps


 If it was a bug, it was a hell of one big bug. I mean, it **could** 
 happen that a release is made turning some feature on or off, but being 
 unable to edit files was too big to pass unnoticed. 


 Hmmm, each time I go to edit for the first time after restarting the 
 browser, I need to do CTRL-F5, usually followed by an F5 to load the CSS. 
  Is this an Opera issue, a setting in the browser cache, or are the default 
 headers encouraging this behavior?

 /dps
  



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: compact grid howto

2013-10-09 Thread Dave S
On Wednesday, October 9, 2013 1:21:09 PM UTC-7, Cliff Kachinske wrote:

 Dave S
 Not at all. I'm ignoring handhelds right now and assuming desktop users 
 will also appreciate the extra space.


Okay.

/dps
 

 On Wednesday, October 9, 2013 4:05:32 PM UTC-4, Dave S wrote:


 On Wednesday, October 9, 2013 5:51:11 AM UTC-7, Cliff Kachinske wrote:

 SQLFORM.grid for laptops. Less white space, more data. Screen shot at 
 end of post.


 How are you detecting a laptop?  Are you basing this on the user agent 
 screen size?

 /dps


  

 in modules, create ui_def.py as follows:
 # -*- coding: utf-8 -*-
 def uidict():
 return dict(widget='',
   header='',
   content='',
   default='',
   cornerall='',
   cornertop='',
   cornerbottom='',
   button='',
   buttontext='',
   buttonadd='icon plus icon-plus',
   buttonback='icon leftarrow icon-arrow-left',
   buttonexport='icon downarrow icon-download',
   buttondelete='',
   buttonedit='',
   buttontable='icon rightarrow icon-arrow-right',
   buttonview='',
   )



 Controller:
 import ui_def
 def index(): 
 ui = ui_def.uidict()
 query = db.product_family.id0
 form = SQLFORM.grid(query, ui=ui)
 response.view = 'iindex.html'
 return dict(form=form)



 Add to layout.html, just before the /head tag:
  
 style
   #header {margin-top:0px;}
   div .page-header {margin:5px 0 0}
   .mastheader h1 {font-size:30px}
   .main {padding: 5px 0 15px 0;}
   .web2py_breadcrumbs ul {margin-bottom:10px;}
   .web2py_grid .row_buttons a {padding: 0 5px 0 5px;}
   .web2py_grid tbody td {padding: 0 5px 0 5px;}
   .web2py_grid .row_buttons {min-height: 0;}
   /style



 https://lh6.googleusercontent.com/-cpraFI36PLU/UlVQb-LdBZI/AEs/eY-J2pv3bzs/s1600/grid-compact.png



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Derek
You have a point, if it's a grid or smartgrid, and paging is enabled, it 
should be sorted by the developer's preference, and secondly by the primary 
key, whether that's an ID or something else.

On Wednesday, October 9, 2013 1:41:04 PM UTC-7, Anthony wrote:


 Good point -- perhaps orderby_on_limitby should default to False -- then 
 the grid can simply set it to True. Actually, I wonder if the grid should 
 go further and additionally order on primary keys even when an explicit 
 orderby is specified (just in case the orderby field(s) do not contain 
 unique values).


 No, it should preserve the order you set. If you know enough to set the 
 order, you can add columns to the order easily enough.


 Not sure I agree with that. Users typically specify an orderby only 
 because they would like the records displayed in a particular order, not 
 because they are seeking to explicitly handle pagination. Let's say I'm 
 listing US addresses in a grid and specify orderby=db.address.state. In 
 that case, I'm saying I want addresses sorted by state, and within state, I 
 don't care about the order. But I'm not saying that I want pagination to 
 fail in case records from a given state happen to span from one page to the 
 next. Just because I want to order by state doesn't mean I know enough to 
 provide all the necessary orderby fields to guarantee proper pagination. If 
 the grid does this for me when I specify no orderby, why shouldn't it do it 
 for me when I do specify an orderby?

 Anthony 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Michele Comitini
Just to avoid confusion, when I say clustered I am talking about
postgresql.  See:
http://www.postgresql.org/docs/current/interactive/sql-cluster.html




2013/10/9 Derek sp1d...@gmail.com

 You have a point, if it's a grid or smartgrid, and paging is enabled, it
 should be sorted by the developer's preference, and secondly by the primary
 key, whether that's an ID or something else.


 On Wednesday, October 9, 2013 1:41:04 PM UTC-7, Anthony wrote:


 Good point -- perhaps orderby_on_limitby should default to False -- then
 the grid can simply set it to True. Actually, I wonder if the grid should
 go further and additionally order on primary keys even when an explicit
 orderby is specified (just in case the orderby field(s) do not contain
 unique values).


 No, it should preserve the order you set. If you know enough to set the
 order, you can add columns to the order easily enough.


 Not sure I agree with that. Users typically specify an orderby only
 because they would like the records displayed in a particular order, not
 because they are seeking to explicitly handle pagination. Let's say I'm
 listing US addresses in a grid and specify orderby=db.address.state. In
 that case, I'm saying I want addresses sorted by state, and within state, I
 don't care about the order. But I'm not saying that I want pagination to
 fail in case records from a given state happen to span from one page to the
 next. Just because I want to order by state doesn't mean I know enough to
 provide all the necessary orderby fields to guarantee proper pagination. If
 the grid does this for me when I specify no orderby, why shouldn't it do it
 for me when I do specify an orderby?

 Anthony

  --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: Why does Web2py add 'orderby' to grid queries?

2013-10-09 Thread Derek
If you have a properly clustered table,  possibly a readonly table, you 
don't need any orderby even paginating through the grid.
Maybe. It appears that will only work if there is a covering index used in 
the query. I don't think Web2Py specifies which indexes are used for a 
query, so even if the data is physically ordered correctly, and you are 
using postgres, you aren't guaranteed that multiple result sets would have 
the same order unless you specify an order (or web2py knows that it's using 
a clustered index and the table is indexed and it's readonly).

Regardless, cluster is not part of the SQL standard, so we can't rely on 
one specific implementation.

On Wednesday, October 9, 2013 2:53:23 PM UTC-7, Michele Comitini wrote:

 Just to avoid confusion, when I say clustered I am talking about 
 postgresql.  See: 
 http://www.postgresql.org/docs/current/interactive/sql-cluster.html




 2013/10/9 Derek sp1...@gmail.com javascript:

 You have a point, if it's a grid or smartgrid, and paging is enabled, it 
 should be sorted by the developer's preference, and secondly by the primary 
 key, whether that's an ID or something else.


 On Wednesday, October 9, 2013 1:41:04 PM UTC-7, Anthony wrote:


 Good point -- perhaps orderby_on_limitby should default to False -- then 
 the grid can simply set it to True. Actually, I wonder if the grid should 
 go further and additionally order on primary keys even when an explicit 
 orderby is specified (just in case the orderby field(s) do not contain 
 unique values).


 No, it should preserve the order you set. If you know enough to set the 
 order, you can add columns to the order easily enough.


 Not sure I agree with that. Users typically specify an orderby only 
 because they would like the records displayed in a particular order, not 
 because they are seeking to explicitly handle pagination. Let's say I'm 
 listing US addresses in a grid and specify orderby=db.address.state. In 
 that case, I'm saying I want addresses sorted by state, and within state, I 
 don't care about the order. But I'm not saying that I want pagination to 
 fail in case records from a given state happen to span from one page to the 
 next. Just because I want to order by state doesn't mean I know enough to 
 provide all the necessary orderby fields to guarantee proper pagination. If 
 the grid does this for me when I specify no orderby, why shouldn't it do it 
 for me when I do specify an orderby?

 Anthony 

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] unable to run latest version from source code

2013-10-09 Thread jarrodwilcox
I just downloaded sourcecode today 10/09/2013. Running on Windows 7 with 64 
bit python, I get following error message.
 
Does anyone else have this issue?  Any suggestions for where to get started?
 
Jarrod 
 
 
Python 2.7.3 |EPD_free 7.1-2 (32-bit)| (default, Aug  8 2013, 05:30:12) 
[MSC v.1
500 64 bit (AMD64)] on win32
Type packages, demo, upgrade or enthought for more information.
 quit()
 
C:\web2py_source5\web2pypython web2py.py
No handlers could be found for logger web2py
Traceback (most recent call last):
  File web2py.py, line 18, in module
import gluon.widget
  File C:\web2py_source5\web2py\gluon\__init__.py, line 15, in module
from globals import current
  File C:\web2py_source5\web2py\gluon\globals.py, line 18, in module
from gluon.streamer import streamer, stream_file_or_304_or_206, 
DEFAULT_CHUN
K_SIZE
  File C:\web2py_source5\web2py\gluon\streamer.py, line 15, in module
import rewrite
  File C:\web2py_source5\web2py\gluon\rewrite.py, line 24, in module
import urllib
  File C:\Python27\Lib\urllib.py, line 26, in module
import socket
  File C:\Python27\Lib\socket.py, line 47, in module
import _socket
ImportError: DLL load failed: %1 is not a valid Win32 application.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: one more web2py e-commerce app :)

2013-10-09 Thread Derek
Why is a light purple hat $2 less than a white one?

On Tuesday, October 8, 2013 5:42:10 AM UTC-7, Adi wrote:

 hmm... it's a broad question, so please ask anything more specific and 
 i'll be glad to answer. 

 Here are some of my observations...

 What was important to me, were speed, mobile readiness (bootstrap 
 responsive design), sending scheduled notification e-mails through 
 scheduler, rather than real-time, and all those are provided out of the box 
 in web2py. Suggestions and help from Niphlod and other members of the group 
 were a big help too. This particular application is fully integrated with 
 Paypal api, but a previous one was integrated with Paymentech api as well 
 (another payment processor in Canada/USA). Integration with api's was easy 
 and smooth.

 For the e-commerce app I would suggest you retrieve the static data 
 (product details, lookup values, etc) up-front, and cache it in some shape 
 and form, since customers move around a lot, and ask for same data 
 repetitively. Same is with images. Of course there is a difference how much 
 data you are dealing with, if your store sells in one or many countries, or 
 offers 100k or 20 items. 

 I deployed on nginx (out of the box script provided), mariadb (a version 
 of mysql), and zipped all app files through scripts/zip_static_files.py, so 
 the speed is satisfactory on a low memory node (cloud server). A good code 
 optimization would speed up the performance even further, but need to get 
 some time to rewrite sections of the code.

 
 Good luck with your app/website, and if I can answer anything more please 
 ask. 



 On Tue, Oct 8, 2013 at 6:59 AM, Gael Princivalle 
 gaelpri...@gmail.comjavascript:
  wrote:

 Hi Adi. Congratulations for this website. I also need to build an 
 e-commerce website and I want to make it with web2py. Can you give me some 
 suggestions ?

 Il giorno lunedì 16 settembre 2013 16:30:19 UTC+2, Adi ha scritto:

 Just completed a core system at nammuhats.com. Can't praise enough how 
 easy, (and rock solid) is to build systems with web2py :)

 Once again, thanks Massimo and all contributors for the best framework!

  -- 
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 --- 
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/groups/opt_out.



  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: unable to run latest version from source code

2013-10-09 Thread Derek
Make sure you install this:
http://sourceforge.net/projects/pywin32/

On Wednesday, October 9, 2013 3:20:10 PM UTC-7, jarrodwilcox wrote:

 I just downloaded sourcecode today 10/09/2013. Running on Windows 7 with 
 64 bit python, I get following error message.
  
 Does anyone else have this issue?  Any suggestions for where to get 
 started?
  
 Jarrod 
  
  
 Python 2.7.3 |EPD_free 7.1-2 (32-bit)| (default, Aug  8 2013, 05:30:12) 
 [MSC v.1
 500 64 bit (AMD64)] on win32
 Type packages, demo, upgrade or enthought for more information.
  quit()
  
 C:\web2py_source5\web2pypython web2py.py
 No handlers could be found for logger web2py
 Traceback (most recent call last):
   File web2py.py, line 18, in module
 import gluon.widget
   File C:\web2py_source5\web2py\gluon\__init__.py, line 15, in module
 from globals import current
   File C:\web2py_source5\web2py\gluon\globals.py, line 18, in module
 from gluon.streamer import streamer, stream_file_or_304_or_206, 
 DEFAULT_CHUN
 K_SIZE
   File C:\web2py_source5\web2py\gluon\streamer.py, line 15, in module
 import rewrite
   File C:\web2py_source5\web2py\gluon\rewrite.py, line 24, in module
 import urllib
   File C:\Python27\Lib\urllib.py, line 26, in module
 import socket
   File C:\Python27\Lib\socket.py, line 47, in module
 import _socket
 ImportError: DLL load failed: %1 is not a valid Win32 application.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: one more web2py e-commerce app :)

2013-10-09 Thread Adnan Smajlovic
:)

There are only few hats left in this color, so they are just on small
special now, but we also send absolutely free hat to anyone who's going
through chemotherapy
http://nammuhats.com/page_view/6/Chemotherapy-Hatstreatment.


On Wed, Oct 9, 2013 at 6:26 PM, Derek sp1d...@gmail.com wrote:

 Why is a light purple hat $2 less than a white one?



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Re: onvalidation upload size

2013-10-09 Thread __pyslan__ - Ayslan Jenken
Hello everybody.

This happens both in development environment as in staging environment.

If someone can help me...


Thanks!



On Wed, Oct 9, 2013 at 2:34 AM, __pyslan__ - Ayslan Jenken 
ayslan.pyt...@gmail.com wrote:

 Massimo, the strange behavior continues to occur...

 I had to make a change and store the number of lines that the file has.
 Added a function to the oncreate SQLFORM.grid as follows:

 def set_total_emails(form):
 print request.vars.file_name
 form.vars.file_name = request.post_vars.file_name
 sent_file = request.vars.file_name.file
 file_name = request.vars.file_name.filename

 extension_file = file_name.split('.')[-1]
 if extension_file == 'csv':
 import csv
 file_lines = list(csv.reader(sent_file, delimiter=',',
 quoting=csv.QUOTE_NONE))
 elif extension_file == 'txt':
 file_lines = list(sent_file.readlines())

 db(db.files_uploaded.id == form.vars.id).update(total_lines =
 len(file_lines))


 If I do not enter the print request.vars.file_name I can not get the
 total rows, it returns 0.

 Note: web2py 2.7.2

 Is there any other way I can do the same thing?


 Thanks!!





 On Fri, Jul 26, 2013 at 4:52 AM, Massimo Di Pierro 
 massimo.dipie...@gmail.com wrote:

 This is very very strange. One possibility is that something is wrong
 with your version of python. Another possibility is that you are using
 current.request incorrectly in one of your modules (for example request =
 current.request used outside a function).


 On Thursday, 25 July 2013 18:55:54 UTC-5, __pyslan__ wrote:

 Works with:

 print request
 print request.vars
 print request.vars.file_name

 But if i put for example:
 print request.var._formname
 Doesn't work! I have to print something related with file_name field.




 On Thu, Jul 25, 2013 at 8:30 PM, __pyslan__ - Ayslan Jenken 
 ayslan...@gmail.com wrote:

 I'm sorry, web2py version is 2.5.1.


 On Thu, Jul 25, 2013 at 8:27 PM, __pyslan__ - Ayslan Jenken 
 ayslan...@gmail.com wrote:

 I don't understand too, I do not see any connection, but I'm sure...
 Without print request command the file uploaded has 0 bytes. With print
 request command the file uploaded has the correct size...


 On Thu, Jul 25, 2013 at 10:04 AM, Massimo Di Pierro 
 massimo@gmail.com wrote:

 Are you sure about your point 2. I do not see how adding a print
 statement can affect the working (or not working) of this form.


 On Tuesday, 23 July 2013 21:18:07 UTC-5, __pyslan__ wrote:

 Hello everybody.


 I'm trying upload files with SQLFORM.grid.

 Model:

 FilesUploaded = db.define_table('files_**uploade**d',
 Field('name', notnull=True, label=T(Name)),
 Field('file_name', 'upload', notnull=False, label=T(File)),
 Field('owner_group', 'reference auth_group', notnull=True, 
 label=T(Owner Group)),
 Field('creation', 'datetime', notnull=True, 
 default=datetime.datetime.now(), label=T(Creation)),
 format='%(name)s')


 Constraints:

 FilesUploaded.owner_group.compute = lambda row: 
 auth.user_groups.keys()[0]FilesUploaded.owner_group.readable = 
 FalseFilesUploaded.owner_group.writable = False




 FilesUploaded.creation.writable = 
 FalseFilesUploaded.file_name.requires = 
 IS_LENGTH(maxsize=(1024*(1024*5)), error_message=T(Send files with 
 a maximum size of) +  5GB.)


 def upload_validation(form):
 sent_file = request.vars.file_name.file
 file_name = request.vars.file_name.filename
 extension_file = file_name.split('.')[-1]

 if extension_file == 'csv':
 import csv
 file_lines = list(csv.reader(sent_file, delimiter=',', 
 quoting=csv.QUOTE_NONE))
 elif extension_file == 'txt':
 file_lines = list(sent_file.readlines())
 else:
 form.errors.file_name = T(The file types supported are .csv or 
 .txt)
 return False

 max_lines = 10

 if len(lines)  max_lines:
 form.errors.file_name = T(Maximum quantity per upload is 
 %(qty)s lines.) % dict(qty = max_lines)
 return False

 Controller:

 form=SQLFORM.grid(query, csv=False, fields=fields, links=links, 
 user_signature=True, onvalidation=upload_validation)



 1 - The file size is 0 bytes after upload.
 2 - But, if I put the command print request on the last line of
 upload_validation function, works fine.


 If anyone can help me, I appreciate!


 __pyslan__


  --

 ---
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To unsubscribe from this group and stop receiving emails from it,
 send an email to web2py+un...@**googlegroups.com.

 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .






  --

 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, 

[web2py] Re: unable to run latest version from source code

2013-10-09 Thread Massimo Di Pierro
Is this an upgrade? Did it work before?

On Wednesday, 9 October 2013 17:20:10 UTC-5, jarrodwilcox wrote:

 I just downloaded sourcecode today 10/09/2013. Running on Windows 7 with 
 64 bit python, I get following error message.
  
 Does anyone else have this issue?  Any suggestions for where to get 
 started?
  
 Jarrod 
  
  
 Python 2.7.3 |EPD_free 7.1-2 (32-bit)| (default, Aug  8 2013, 05:30:12) 
 [MSC v.1
 500 64 bit (AMD64)] on win32
 Type packages, demo, upgrade or enthought for more information.
  quit()
  
 C:\web2py_source5\web2pypython web2py.py
 No handlers could be found for logger web2py
 Traceback (most recent call last):
   File web2py.py, line 18, in module
 import gluon.widget
   File C:\web2py_source5\web2py\gluon\__init__.py, line 15, in module
 from globals import current
   File C:\web2py_source5\web2py\gluon\globals.py, line 18, in module
 from gluon.streamer import streamer, stream_file_or_304_or_206, 
 DEFAULT_CHUN
 K_SIZE
   File C:\web2py_source5\web2py\gluon\streamer.py, line 15, in module
 import rewrite
   File C:\web2py_source5\web2py\gluon\rewrite.py, line 24, in module
 import urllib
   File C:\Python27\Lib\urllib.py, line 26, in module
 import socket
   File C:\Python27\Lib\socket.py, line 47, in module
 import _socket
 ImportError: DLL load failed: %1 is not a valid Win32 application.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] SQLTABLE and foreign key fields

2013-10-09 Thread James Thompson
When using SQLTABLE (or something like: {{=query_results}}) to display rows 
in a view, foreign key fields display data from their related table.
Is web2py doing individual queries for each of these fields?


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Tracking the date/time of a field change.

2013-10-09 Thread James Thompson
It looks like in a DAL callback, the original values of the record are not 
available?
So I would need to do read the old row from the database to get the old 
values of the row to determine if the value of a field has changed?
Thanks.

On Monday, October 7, 2013 10:35:25 AM UTC-10, Niphlod wrote:

 why don't you use callbacks ? they are the most useful feature in DAL's in 
 my POV.

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#before-and-after-callbacks

 On Monday, October 7, 2013 8:55:29 PM UTC+2, James Thompson wrote:

 I thought default=request.now and update=request.net reflect changes in 
 the record as a whole?
 I'm looking for something that only updates when the value of the status 
 field changes. 

 On Monday, October 7, 2013 3:31:33 AM UTC-10, 黄祥 wrote:

 i think you can achieve it with default.
 e.g. 
 Field('f_status_change_dt', type='datetime',
   label=T('Status Change Dt')*, default=request.now*)

 or if you set auth.signature or record_versioning, web2py automatically 
 do that for you.

 ref:

 http://web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Record-versioning

 http://web2py.com/books/default/chapter/29/09/access-control#Record-versioning

 best regards,
 stifan



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] requires=IS_DATE() leads to type 'exceptions.AttributeError'('str' object has no attribute 'year')

2013-10-09 Thread Ryan Matlock
I'm pretty new to web2py, so I'm probably making a silly mistake.  In any 
case, the error goes something like this:

In db.py, I have something like

db.define_table(my_table,
   Field(name),
   Field(the_date,
   requires=IS_EMPTY_OR(IS_DATE()),
   widget=SQLFORM.widgets.date.widget),
   format = %(name)s)

Then I go to the appadmin and pick a date using the widget, and end up with 
something like 2013-10-09.  When I submit it, I get an internal error, 
and it seems that the relevant parts of the ticket are the following:

Traceback (most recent call last):
  File 
/Applications/web2py/web2py.app/Contents/Resources/gluon/restricted.py, 
line 217, in restricted
  File 
/Applications/web2py/web2py.app/Contents/Resources/applications/service/views/appadmin.html,
 
line 189, in module
  File 
/Applications/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py, line 
2924, in __init__
  File /Applications/web2py/web2py.app/Contents/Resources/gluon/dal.py, 
line 9641, in formatter
  File 
/Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py, 
line 2701, in formatter
  File 
/Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py, 
line 2277, in formatter
AttributeError: 'str' object has no attribute 'year'
Error snapshot  help
type 'exceptions.AttributeError'('str' object has no attribute 'year')

and 

Function argument list

(self=gluon.validators.IS_DATE object, value='2013-10-09')

I'm a little confused as to why the validator is confused by a date 
properly formatted by the date widget.  When I comment out the 
requires=IS_EMPTY_OR(IS_DATE()) line in my db.py file, the error goes 
away.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] 1071, 'Specified key was too long; max key length is 767 bytes'

2013-10-09 Thread Mark Li
Just wanted to chime in on this.

For me, I had to add a length=255 to all my unique=True fields, even 
after adding length=255 for the string fields.

On Wednesday, October 9, 2013 11:46:48 AM UTC-7, Niphlod wrote:

 sorry for being late. This is from web2py's 2.6.0 changelog.

 Attention MySQL users: The length of string fields changed from 255 to 512 
 bytes. If you have migrations enabled this will trigger a large migration. 
 To prevent it, first set migrate_enabled=False, upgrade, check everything 
 is ok, then add length=255 to your string Fields, then re-enable migrations 
 with migrate_enabled=True if needed.

 tl;dr: remember to ALWAYS set length= for strings.

 tl;dr n.2 : Mysql has huge issues. One of them is that you can't index a 
 too large column. 


 On Wednesday, October 9, 2013 9:25:51 AM UTC+2, Gwayne aka Mike Veltman 
 wrote:

   

 I found it. 

  

 It was in db.py

  

 db.define_table('frame',

  

 Field('framename', type='string',

 # #unique=True,  
 the problem. Is it a bug ?

 label=T('Framename')),

 Field('description', type='string',

 label=T('Description')),

 Field('netboot', type='string',default=None,

 label=T('Netboot information')),

 Field('ip', type='string',

 #unique=True,

 label=T('IP Address')),

 Field('servermodel', type='string',default=p6,

 label=T('Server model')),

 Field('serial', type='string',default=None,

 label=T('Serial Number')),

 Field('lvname', type='string',default=FRAMEx,

 label=T('Frame extension for storage logical volumes')),

 Field('framestaterecord_ID', type='integer',

 label=T('Frame State record ID')),

 Field('created_on','datetime',default=request.now,

 label=T('Created On'),writable=False,readable=False),

 Field('modified_on','datetime',default=request.now,

 label=T('Modified On'),writable=False,readable=False,

 update=request.now),

 format='%(framename)s',

 migrate=True)

  

  

  

 On Tuesday 08 October 2013 13:41:31 Mike Veltman wrote:

 Ok, I am now fighting with it for two days and it drives me crazy.

 My gut feeling says mysql 5.1 -- mysql 5.5 upgrade is the cause. Am I 
 right ? And how do I solve it. :-)

  

 Error ticket for adeploy

 Ticket ID

 192.168.2.106.2013-10-08.12-46-19.24f3f1a5-d637-4522-965b-fed4958115ed

 class '_mysql_exceptions.OperationalError' (1071, 'Specified key was 
 too long; max key length is 767 bytes')

 Version
   
 web2py™
  
 Version 2.7.2-stable+timestamp.2013.10.07.13.52.24

 Traceback

  
   
 1.
 2.
 3.
 4.
 5.
 6.
 7.
 8.
 9.
 10.
 11.
 12.
 13.
 14.
 15.
 16.
 17.
 18.
 19.
 20.
 21.
 22.
  
 Traceback (most recent call last):
 File /srv/web-apps/web2py/gluon/restricted.py, line 217, in restricted
 exec ccode in environment
 File /srv/web-apps/web2py/applications/adeploy/compiled/models/db.py, line 
 178, in module
 File /srv/web-apps/web2py/gluon/dal.py, line 7911, in define_table
 table = self.lazy_define_table(tablename,*fields,**args)
 File /srv/web-apps/web2py/gluon/dal.py, line 7948, in lazy_define_table
 polymodel=polymodel)
 File /srv/web-apps/web2py/gluon/dal.py, line 1029, in create_table
 fake_migrate=fake_migrate)
 File /srv/web-apps/web2py/gluon/dal.py, line 1136, in migrate_table
 self.execute(sub_query)
 File /srv/web-apps/web2py/gluon/dal.py, line 1836, in execute
 return self.log_execute(*a, **b)
 File /srv/web-apps/web2py/gluon/dal.py, line 1830, in log_execute
 ret = self.cursor.execute(command, *a[1:], **b)
 File /usr/lib64/python2.6/site-packages/MySQLdb/cursors.py, line 173, in 
 execute
 self.errorhandler(self, exc, value)
 File /usr/lib64/python2.6/site-packages/MySQLdb/connections.py, line 36, 
 in defaulterrorhandler
 raise errorclass, errorvalue
 OperationalError: (1071, 'Specified key was too long; max key length is 
 767 bytes')

 In file: /srv/web-apps/web2py/applications/adeploy/compiled/models/db.pyc
   
 1.
  
 code object module at 0x168c468, file 
 /srv/web-apps/web2py/applications/adeploy/compiled/models/db.py, line 
 28

  

  





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: requires=IS_DATE() leads to type 'exceptions.AttributeError'('str' object has no attribute 'year')

2013-10-09 Thread Massimo Di Pierro
   Field(the_date,
   requires=IS_EMPTY_OR(IS_DATE()),
   widget=SQLFORM.widgets.date.widget),

should be 

   Field('the_date',type='date')

the requires and the widget are default.

On Wednesday, 9 October 2013 13:41:11 UTC-5, Ryan Matlock wrote:

 I'm pretty new to web2py, so I'm probably making a silly mistake.  In any 
 case, the error goes something like this:

 In db.py, I have something like

 db.define_table(my_table,
Field(name),
Field(the_date,
requires=IS_EMPTY_OR(IS_DATE()),
widget=SQLFORM.widgets.date.widget),
format = %(name)s)

 Then I go to the appadmin and pick a date using the widget, and end up 
 with something like 2013-10-09.  When I submit it, I get an internal 
 error, and it seems that the relevant parts of the ticket are the following:

 Traceback (most recent call last):
   File 
 /Applications/web2py/web2py.app/Contents/Resources/gluon/restricted.py, 
 line 217, in restricted
   File 
 /Applications/web2py/web2py.app/Contents/Resources/applications/service/views/appadmin.html,
  
 line 189, in module
   File 
 /Applications/web2py/web2py.app/Contents/Resources/gluon/sqlhtml.py, line 
 2924, in __init__
   File /Applications/web2py/web2py.app/Contents/Resources/gluon/dal.py, 
 line 9641, in formatter
   File 
 /Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py, 
 line 2701, in formatter
   File 
 /Applications/web2py/web2py.app/Contents/Resources/gluon/validators.py, 
 line 2277, in formatter
 AttributeError: 'str' object has no attribute 'year'
 Error snapshot  help
 type 'exceptions.AttributeError'('str' object has no attribute 'year')

 and 

 Function argument list

 (self=gluon.validators.IS_DATE object, value='2013-10-09')

 I'm a little confused as to why the validator is confused by a date 
 properly formatted by the date widget.  When I comment out the 
 requires=IS_EMPTY_OR(IS_DATE()) line in my db.py file, the error goes 
 away.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] field show in grid is not sequential

2013-10-09 Thread 黄祥
hi,

i realize that in the new version of web2py 2.7.x the field show in grid is 
not sequential without explicit it in the fields.

e.g.
models/db.py
db.define_table('model',
Field('model'),
Field('brand', 'reference brand'),
Field('product_number'),
format='%(model)s')

controller/default.py
def model():
grid = SQLFORM.grid(db.model)
return locals()

Result testing with 2.7.x version (both from source and windows binary)
Product Number  Id Brand Model

Result testing with 2.5.1 version (both from source and windows binary)
Id Model Brand Product Number

if i want to get the same result like on 2.5.1 version in 2.7.x version i 
must explicit define the field i want to show in sequent
controller/default.py
def model():
fields = [db.model.id, db.model.model, db.model.brand, 
db.model.product_number]
grid = SQLFORM.grid(db.model, fields = fields)
return locals()

Result testing with 2.7.x version (both from source and windows binary)
Id Model Brand Product Number

how can i get the field show in grid same sequent like i describe on models 
without explicit it using fields in 2.7.x version?

p.s.
i want to testing for higher version to report as comparation but i can't 
download the version  2.5.1
e.g. 
http://web2py.com/examples/static/2.5.2/web2py_src.zip

it return :
invalid request

thanks and best regards,
stifan


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: SQLTABLE and foreign key fields

2013-10-09 Thread Massimo Di Pierro
It depends. It may. 

For example given:

db.define_table('person',Field('name'),format='%(name)s')
db.define_table('dog',Field('name'),Field('owner','reference dog'))

if you do:

SQLFORM.grid(db.dog.owner==db.person.id)

it will do a recursive select for each row to find a representation of 
db.dog.owner.

You can disabled this:

db.dog.owner.represent = None
SQLFORM.grid(db.dog.represent==db.person.id)

or hide it

db.dog.owner.readable = False
SQLFORM.grid(db.dog.represent==db.person.id)

or cache it:

db.dog.owner.represent = lambda v,r: cache.ram('person-%s'%v, lambda v=v: v 
and '%(name)s'%db.person(v), None)
SQLFORM.grid(db.dog.represent==db.person.id)

You can always add the {{=response.toolbar()}} to see all the database 
queries.


On Wednesday, 9 October 2013 14:39:07 UTC-5, James Thompson wrote:

 When using SQLTABLE (or something like: {{=query_results}}) to display 
 rows in a view, foreign key fields display data from their related table.
 Is web2py doing individual queries for each of these fields?




-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: Tracking the date/time of a field change.

2013-10-09 Thread 黄祥
had you already take a look record versioning?

taken from book :
Record versioning
_enable_record_versioning

It is possible to ask web2py to save every copy of a record when the record 
is individually modified.

so if you combine record versioning, auth signature that have modified date 
field with before and after callback (to compare the archieve table with 
the original one), i think you can get what you want.

best regards,
stifan

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Custom Auth

2013-10-09 Thread GregD
We have to use tables from sql server (aspnet_user and aspnet_membership) 
for our authentication.

So we've extended Auth like this

from gluon.tools import Auth
def MyNewAuth 
  ...
  # we copied the Login method from Auth to here
 ...
 # use the following code to decipher the password from aspnet_membership
 # rowa and rowb was used earlier to get username and password from 
aspnet_users, etc...
  b64salt = str(rowa.PasswordSalt)

   b64hash = str(rowa.Password)

   binsalt = b64decode(b64salt)

   password_string = str(form.vars.pswd).encode(utf16)

   password_string = utf16tobin(password_string)

   m1 = hashlib.sha1()

   m1.update(binsalt + password_string)

   if b64encode(m1.digest()) == b64hash:
   ...
Now how do we continue using extended Auth class so that we can use 
authentication throughout app?

I hope this makes sense. If not, I can elaborate further. Just let me know.

On Tuesday, October 8, 2013 4:08:25 PM UTC-5, viniciusban wrote:

 Web2py Auth is a class. 

 You should extend it and in models/db.py you should have something like: 
 auth = MyExtendedAuth() 


 On Tue, Oct 8, 2013 at 2:54 PM, GregD gregor...@gadgroup.comjavascript: 
 wrote: 
  We created a form in the index controller to authenticate users to a 
  database that utilize asp.net membership for authentication.  However, 
 we 
  need to turn on Authentication for all forms now, but can't seem to do 
 it 
  since we didn't use the web2py built-in authentication mechanism. 
  
  Is it possible to move the code we created in the controller to the 
 model so 
  that we can simply add authentication to all forms/pages?  If so, how? 
  Is 
  there another way to accomplish this? 
  
  
  -- 
  Resources: 
  - http://web2py.com 
  - http://web2py.com/book (Documentation) 
  - http://github.com/web2py/web2py (Source code) 
  - https://code.google.com/p/web2py/issues/list (Report Issues) 
  --- 
  You received this message because you are subscribed to the Google 
 Groups 
  web2py-users group. 
  To unsubscribe from this group and stop receiving emails from it, send 
 an 
  email to web2py+un...@googlegroups.com javascript:. 
  For more options, visit https://groups.google.com/groups/opt_out. 


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] Re: unable to run latest version from source code

2013-10-09 Thread jarrodwilcox
Massimo, Derek
 
Thanks for replies!
 
This is a new installation of latest web2py version.  I have had the 
earlier web2py versions working from sourcecode for some time.  However, 
win32 was installed from Mark Hammond's site for another project since I 
last used web2py. Both pywin and win32 can be imported in python at this 
point.
 
Jarrod
 
 
 

On Wednesday, October 9, 2013 6:20:10 PM UTC-4, jarrodwilcox wrote:

 I just downloaded sourcecode today 10/09/2013. Running on Windows 7 with 
 64 bit python, I get following error message.
  
 Does anyone else have this issue?  Any suggestions for where to get 
 started?
  
 Jarrod 
  
  
 Python 2.7.3 |EPD_free 7.1-2 (32-bit)| (default, Aug  8 2013, 05:30:12) 
 [MSC v.1
 500 64 bit (AMD64)] on win32
 Type packages, demo, upgrade or enthought for more information.
  quit()
  
 C:\web2py_source5\web2pypython web2py.py
 No handlers could be found for logger web2py
 Traceback (most recent call last):
   File web2py.py, line 18, in module
 import gluon.widget
   File C:\web2py_source5\web2py\gluon\__init__.py, line 15, in module
 from globals import current
   File C:\web2py_source5\web2py\gluon\globals.py, line 18, in module
 from gluon.streamer import streamer, stream_file_or_304_or_206, 
 DEFAULT_CHUN
 K_SIZE
   File C:\web2py_source5\web2py\gluon\streamer.py, line 15, in module
 import rewrite
   File C:\web2py_source5\web2py\gluon\rewrite.py, line 24, in module
 import urllib
   File C:\Python27\Lib\urllib.py, line 26, in module
 import socket
   File C:\Python27\Lib\socket.py, line 47, in module
 import _socket
 ImportError: DLL load failed: %1 is not a valid Win32 application.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Re: [web2py] Custom Auth

2013-10-09 Thread Vinicius Assef
Actually, you must understand Auth to extend it.
Mainly to authenticate user and put its data on session (login).

You don't need to make an Auth subclass, but compose a solution doing
the same thing.
Or you can think about login_bare, too.


On Wed, Oct 9, 2013 at 11:22 PM, GregD gregory.do...@gadgroup.com wrote:
 We have to use tables from sql server (aspnet_user and aspnet_membership)
 for our authentication.

 So we've extended Auth like this

 from gluon.tools import Auth
 def MyNewAuth
   ...
   # we copied the Login method from Auth to here
  ...
  # use the following code to decipher the password from aspnet_membership
  # rowa and rowb was used earlier to get username and password from
 aspnet_users, etc...
   b64salt = str(rowa.PasswordSalt)

b64hash = str(rowa.Password)

binsalt = b64decode(b64salt)

password_string = str(form.vars.pswd).encode(utf16)

password_string = utf16tobin(password_string)

m1 = hashlib.sha1()

m1.update(binsalt + password_string)

if b64encode(m1.digest()) == b64hash:

...
 Now how do we continue using extended Auth class so that we can use
 authentication throughout app?

 I hope this makes sense. If not, I can elaborate further. Just let me know.

 On Tuesday, October 8, 2013 4:08:25 PM UTC-5, viniciusban wrote:

 Web2py Auth is a class.

 You should extend it and in models/db.py you should have something like:
 auth = MyExtendedAuth()


 On Tue, Oct 8, 2013 at 2:54 PM, GregD gregor...@gadgroup.com wrote:
  We created a form in the index controller to authenticate users to a
  database that utilize asp.net membership for authentication.  However,
  we
  need to turn on Authentication for all forms now, but can't seem to do
  it
  since we didn't use the web2py built-in authentication mechanism.
 
  Is it possible to move the code we created in the controller to the
  model so
  that we can simply add authentication to all forms/pages?  If so, how?
  Is
  there another way to accomplish this?
 
 
  --
  Resources:
  - http://web2py.com
  - http://web2py.com/book (Documentation)
  - http://github.com/web2py/web2py (Source code)
  - https://code.google.com/p/web2py/issues/list (Report Issues)
  ---
  You received this message because you are subscribed to the Google
  Groups
  web2py-users group.
  To unsubscribe from this group and stop receiving emails from it, send
  an
  email to web2py+un...@googlegroups.com.
  For more options, visit https://groups.google.com/groups/opt_out.

 --
 Resources:
 - http://web2py.com
 - http://web2py.com/book (Documentation)
 - http://github.com/web2py/web2py (Source code)
 - https://code.google.com/p/web2py/issues/list (Report Issues)
 ---
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/groups/opt_out.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


[web2py] missing 'index' in url with routes.py?

2013-10-09 Thread Apple Mason
I'm trying to shorten the url from something like:

www.example.com/myapp/default/index?page=1

to 

www.example/com/index?page=1

I'm using pagination on the index page, so that's why you see the ?page=1

My routes.py is pretty standard:

routers = dict(
# base router
BASE=dict(
default_application='myapp',
),
myapp = dict(
default_controller='default',
default_function='index',
functions=['index', 'dostuff', 'download'],
),
)


Everything seems fine, except the index page is this:

www.example.com/?page=1

I'm missing the word 'index' in the url.


-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.