Re: [web2py] Re: Still having trouble with format / foreign keys

2015-04-20 Thread Jim Steil
So this fix isn't in the web2py 2.10.4 beta that was built on 4/18?

-Jim

On Mon, Apr 20, 2015 at 4:55 PM, Niphlod niph...@gmail.com wrote:

 we're waiting for 2.10.4 including
 https://github.com/web2py/pydal/issues/135

 On Monday, April 20, 2015 at 9:46:58 PM UTC+2, Jim S wrote:

 I posted in this thread
 https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but posted
 after it was closed.  Evidently, this is fixed but I'm still not seeing my
 'formats' for foreign keys.  Here are the details:

 I have this in my db.py:

 db.define_table('customer',
 Field('customerId', 'id', readable=True, writable=False, label='Customer
 #'),
 Field('name', length=30, required=True, writable=False,
   requires=IS_NOT_EMPTY()),
 Field('city', length=30, writable=False),
 Field('state', length=2, writable=False),
 format='%(customerId)s - %(name)s - %(city)s, %(state)s')

 db.define_table('equip_order',
 Field('id', 'id', readable=False, label='Order #'),
 Field('order_type', 'reference orderType', label='Order Type',
 ondelete='RESTRICT',
requires = IS_IN_DB(db(db.orderType.equipment==True),
'orderType.id', '%(name)s', zero='..')),
 Field('status', length=10, default='New',
requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
 Field('customer', 'reference customer', label='Customer',
 ondelete='RESTRICT'))

 When I display (VIEW MODE) the customer field in the equip_order table in
 a custom SQLFORM.grid form using:

 {{=form.custom.widget.customer}}

 ...it displays the id of the customer, not the name.

 I thought the 'format' on the customer table definition would control
 this. I know I can fix it by changing the definition of the customer field
 in the equip_order table to:

 Field('customer', 'reference customer', label='Customer',
 ondelete='RESTRICT',
represent=lambda x, r: '%s - %s - %s, %s' % (db.customer(x).customerId
 db.customer(x).name,
 db.customer(x).city,
 db.customer(x).state) if x else ''),

 Should I have to do that, or should the 'format' on customer take care of
 it?

 -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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/j4MhaEfBNuQ/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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/d/optout.


[web2py] Re: Still having trouble with format / foreign keys

2015-04-20 Thread Niphlod
we're waiting for 2.10.4 including 
https://github.com/web2py/pydal/issues/135

On Monday, April 20, 2015 at 9:46:58 PM UTC+2, Jim S wrote:

 I posted in this thread 
 https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but posted 
 after it was closed.  Evidently, this is fixed but I'm still not seeing my 
 'formats' for foreign keys.  Here are the details:

 I have this in my db.py:

 db.define_table('customer',
 Field('customerId', 'id', readable=True, writable=False, label='Customer 
 #'),
 Field('name', length=30, required=True, writable=False,
   requires=IS_NOT_EMPTY()),
 Field('city', length=30, writable=False),
 Field('state', length=2, writable=False),
 format='%(customerId)s - %(name)s - %(city)s, %(state)s')

 db.define_table('equip_order',
 Field('id', 'id', readable=False, label='Order #'),
 Field('order_type', 'reference orderType', label='Order Type', 
 ondelete='RESTRICT',
requires = IS_IN_DB(db(db.orderType.equipment==True),
'orderType.id', '%(name)s', zero='..')),
 Field('status', length=10, default='New',
requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT'))

 When I display (VIEW MODE) the customer field in the equip_order table in 
 a custom SQLFORM.grid form using:

 {{=form.custom.widget.customer}}

 ...it displays the id of the customer, not the name.

 I thought the 'format' on the customer table definition would control 
 this. I know I can fix it by changing the definition of the customer field 
 in the equip_order table to:

 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT',
represent=lambda x, r: '%s - %s - %s, %s' % (db.customer(x).customerId
 db.customer(x).name,
 db.customer(x).city,
 db.customer(x).state) if x else ''),

 Should I have to do that, or should the 'format' on customer take care of 
 it?

 -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/d/optout.


Re: [web2py] Re: Still having trouble with format / foreign keys

2015-04-20 Thread Jim S
Ok, finally figured out my problem.

Back when pydal was first announced, I did a pip install of pydal. 
 Subsequently, I did a clean install of web2py using git clone.  Must have 
gotten my pydal stuff out of sync, or didn't update it.

I used pip to uninstall pydal and then ran 

git submodule update --init --recursive 

...in my web2py directory.

Now it all works.  So, I had some modules out of sync between pydal and 
web2py.

What is the proper way to handle these dependencies/requirements when 
upgrading with git?

-Jim

On Monday, April 20, 2015 at 6:31:36 PM UTC-5, Jim S wrote:

 I just grabbed the latest, timestamp looks like this:

 Version 2.10.4-beta+timestamp.2015.04.20.18.00.31

 and still having the same issue.

 -Jim

 On Monday, April 20, 2015 at 6:03:03 PM UTC-5, Massimo Di Pierro wrote:

 re-pushing. Check the nightly built in 20 minutes.

 On Monday, 20 April 2015 16:58:04 UTC-5, Jim S wrote:

 So this fix isn't in the web2py 2.10.4 beta that was built on 4/18?

 -Jim

 On Mon, Apr 20, 2015 at 4:55 PM, Niphlod nip...@gmail.com wrote:

 we're waiting for 2.10.4 including 
 https://github.com/web2py/pydal/issues/135

 On Monday, April 20, 2015 at 9:46:58 PM UTC+2, Jim S wrote:

 I posted in this thread 
 https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but posted 
 after it was closed.  Evidently, this is fixed but I'm still not seeing 
 my 
 'formats' for foreign keys.  Here are the details:

 I have this in my db.py:

 db.define_table('customer',
 Field('customerId', 'id', readable=True, writable=False, 
 label='Customer #'),
 Field('name', length=30, required=True, writable=False,
   requires=IS_NOT_EMPTY()),
 Field('city', length=30, writable=False),
 Field('state', length=2, writable=False),
 format='%(customerId)s - %(name)s - %(city)s, %(state)s')

 db.define_table('equip_order',
 Field('id', 'id', readable=False, label='Order #'),
 Field('order_type', 'reference orderType', label='Order Type', 
 ondelete='RESTRICT',
requires = IS_IN_DB(db(db.orderType.equipment==True),
'orderType.id', '%(name)s', zero='..')),
 Field('status', length=10, default='New',
requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT'))

 When I display (VIEW MODE) the customer field in the equip_order table 
 in a custom SQLFORM.grid form using:

 {{=form.custom.widget.customer}}

 ...it displays the id of the customer, not the name.

 I thought the 'format' on the customer table definition would control 
 this. I know I can fix it by changing the definition of the customer 
 field 
 in the equip_order table to:

 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT',
represent=lambda x, r: '%s - %s - %s, %s' % 
 (db.customer(x).customerId
 db.customer(x).name,
 db.customer(x).city,
 db.customer(x).state) if x else ''),

 Should I have to do that, or should the 'format' on customer take care 
 of it?

 -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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/j4MhaEfBNuQ/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


[web2py] Re: Add field with button on SQLFORM

2015-04-20 Thread Edwood

You may start looking at this code 
http://www.web2pyslices.com/slice/show/1616/widget-select-or-add-option-ng 
and build your solution from there.


On Friday, April 17, 2015 at 10:50:40 PM UTC-4, KevC wrote:

 Hi community!
 Good afternoon, my name is Kevin. 
 I want to know if you could help me. I started to use web2py, but I don't 
 know some things. 
 I want to create fields with a button on SQLFORM and HTML. For example, I 
 have author table and book table, but a book can get several authors and I 
 need to create differents INPUT for save them with book and his fields.
 I have a relation many to many between book and author. Also, I have 
 combined author and book FORM´s.


 I wanna this form:


 Title: |___
 Name author: |___ + -(Where '+', I wanna use it for add more 
 authors in the same form and save them in his respective tables and '-' use 
 it for remove fields If I mistake)
 Lenguaje:  |
 ISBN:   |
 Etc.




 I hope you can help me.
 Greetings.


-- 
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/d/optout.


[web2py] Re: Last version of plugin_wiki?

2015-04-20 Thread Ben Lawrence
Can you please remove it from the book?
http://www.web2py.com/books/default/chapter/34/12/components-and-plugins
regards,
Ben

On Wednesday, April 8, 2015 at 6:10:13 AM UTC-7, Massimo Di Pierro wrote:

 A Paolo says. This is no longer support because almost all of the 
 functionality of the plugin (and more) and now in auth.wiki() and included 
 in every web2py app.

 On Tuesday, 7 April 2015 11:32:09 UTC-5, Najtsirk wrote:


 Hi guys,

 where can I get the latest version of plugin_wiki?

 Best,
 K



-- 
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/d/optout.


[web2py] csv download problem from an SQLFORM.grid populated by an AJAX call

2015-04-20 Thread drmbded
I regularly use the SQLFORM.grid, does exactly what I need with very little 
effort. Recently I've been doing a lot more with AJAX to enhance how my 
pages look and feel. But when combining AJAX with the grid, my CSV 
downloads don't work as expected.

In a simple page with only a combobox an empty DIV and small amount of 
javascript (actually using Nathan Freeze's client tools, excellent bit of 
kit!), selecting an item from the combobox causes an AJAX call back to 
web2py. The AJAX call returns an SQLFORM.grid, looks good!

But when I click the CSV download button Excel opens up with a bunch of 
HTML instead of the CSV contents of the grid. In fact it looks like the 
HTML doesn't include any of the grid's contents.

I believe that the CSV URL that gets created by the SQLFORM.grid is 
presuming that the grid itself is included in the original URL download so 
that the grid will see the CSV download request. Since the grid is download 
through AJAX the CSV URL is incorrect and I just get the original HTML with 
the combobox and empty DIV.

Is there a way to tell the grid what the actual URL should be for the CSV?

Thanks,
-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 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/d/optout.


Re: [web2py] creating DAL from SQL file

2015-04-20 Thread Ron Chatterjee
Yes I did. I forgot to add. The extract_sqlite_models.py didn't work as 
expect. And that may be because I am not doing it right. Thats why I didn't 
mention.


python extract_sqlite_models.py 
C:\Users\...\applications\my_application_name\databases\storage.sqlite

Which generates the following output.

# -*- coding: utf-8 -*-
legacy_db = 
DAL('sqlite://C:/Users/.../applications/my_application_name/databases/storage.sqlite')

legacy_db.define_table('auth_user',
migrate=False)

#
legacy_db.define_table('auth_group',
migrate=False)

#
legacy_db.define_table('auth_membership',
migrate=False)

#
legacy_db.define_table('auth_permission',
migrate=False)

#
legacy_db.define_table('auth_event',
migrate=False)

#
legacy_db.define_table('auth_cas',
migrate=False)

#
legacy_db.define_table('topic',
migrate=False)

#
legacy_db.define_table('comment',
migrate=False)


But these generates empty fields and may be its due to the new version 
(2.10.3) I am not sure. Probably have to open a ticket. Unless I am doing 
something wrong in calling that function.



On Monday, April 20, 2015 at 10:27:17 AM UTC-4, Richard wrote:


 https://github.com/web2py/web2py/blob/master/scripts/extract_sqlite_models.py

 Have you check gluon/scripts/ before ask?

 Richard

 On Sun, Apr 19, 2015 at 5:07 PM, Ron Chatterjee achatte...@gmail.com 
 javascript: wrote:

 I have the following SQL file:

 BEGIN TRANSACTION;
 CREATE TABLE topic(
 id INTEGER PRIMARY KEY AUTOINCREMENT,
 title CHAR(512) NOT NULL,
 is_active CHAR(1),
 created_on TIMESTAMP,
 created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
 modified_on TIMESTAMP,
 modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
 );
 INSERT INTO `topic` VALUES(1,'regergerg','T','2015-04-14 
 14:32:52',1,'2015-04-14 14:32:52',1);
 INSERT INTO `topic` VALUES(2,'egergerger','T','2015-04-14 
 14:33:27',1,'2015-04-14 14:33:27',1);


 Is there a script that will convert this to db.py in other words, spit 
 out the following code?

 db.define_table('topic',
 Field('title', label=T('Title'), notnull=True, 
 requires=IS_NOT_EMPTY()),
 auth.signature,
 format='%(title)s',
 )

 I asked because if I have a large SQL file then creating the table by 
 hand or looking at the schema may take some time. Wondering if there is a 
 script in the script folder that automoatically does this conversion. I 
 know extract_mysql_models.py in the script folder but that only take an 
 existing mysql file and does the conversion. I am not sure if it does SQL 
 to DAL directly. Am I correct? 

 -- 
 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/d/optout.




-- 
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/d/optout.


[web2py] Re: Issue with lookup foreign key / format statement in 2.10.3

2015-04-20 Thread Dave S


On Monday, April 20, 2015 at 10:02:44 AM UTC-7, Jim S wrote:

 Can someone tell me if this is fixed?

 I'm still having issues but maybe I'm doing something wrong:


What version of Web2Py are you running?

/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/d/optout.


Re: [web2py] Re: Issue with lookup foreign key / format statement in 2.10.3

2015-04-20 Thread Jim Steil
I'm running 2.10.4 beta.  Grabbed it from github this morning.

On Mon, Apr 20, 2015 at 5:10 PM, Dave S snidely@gmail.com wrote:



 On Monday, April 20, 2015 at 10:02:44 AM UTC-7, Jim S wrote:

 Can someone tell me if this is fixed?

 I'm still having issues but maybe I'm doing something wrong:


 What version of Web2Py are you running?

 /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 a topic in the
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/web2py/2i9zfAzG2s8/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.


-- 
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/d/optout.


Re: [web2py] Re: Still having trouble with format / foreign keys

2015-04-20 Thread Massimo Di Pierro
re-pushing. Check the nightly built in 20 minutes.

On Monday, 20 April 2015 16:58:04 UTC-5, Jim S wrote:

 So this fix isn't in the web2py 2.10.4 beta that was built on 4/18?

 -Jim

 On Mon, Apr 20, 2015 at 4:55 PM, Niphlod niph...@gmail.com wrote:

 we're waiting for 2.10.4 including 
 https://github.com/web2py/pydal/issues/135

 On Monday, April 20, 2015 at 9:46:58 PM UTC+2, Jim S wrote:

 I posted in this thread 
 https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but posted 
 after it was closed.  Evidently, this is fixed but I'm still not seeing my 
 'formats' for foreign keys.  Here are the details:

 I have this in my db.py:

 db.define_table('customer',
 Field('customerId', 'id', readable=True, writable=False, label='Customer 
 #'),
 Field('name', length=30, required=True, writable=False,
   requires=IS_NOT_EMPTY()),
 Field('city', length=30, writable=False),
 Field('state', length=2, writable=False),
 format='%(customerId)s - %(name)s - %(city)s, %(state)s')

 db.define_table('equip_order',
 Field('id', 'id', readable=False, label='Order #'),
 Field('order_type', 'reference orderType', label='Order Type', 
 ondelete='RESTRICT',
requires = IS_IN_DB(db(db.orderType.equipment==True),
'orderType.id', '%(name)s', zero='..')),
 Field('status', length=10, default='New',
requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT'))

 When I display (VIEW MODE) the customer field in the equip_order table 
 in a custom SQLFORM.grid form using:

 {{=form.custom.widget.customer}}

 ...it displays the id of the customer, not the name.

 I thought the 'format' on the customer table definition would control 
 this. I know I can fix it by changing the definition of the customer field 
 in the equip_order table to:

 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT',
represent=lambda x, r: '%s - %s - %s, %s' % (db.customer(x).customerId
 db.customer(x).name,
 db.customer(x).city,
 db.customer(x).state) if x else ''),

 Should I have to do that, or should the 'format' on customer take care 
 of it?

 -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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/j4MhaEfBNuQ/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


Re: [web2py] Re: Setup.py

2015-04-20 Thread Massimo Di Pierro
It is possible to have a the gluon folder under site packages and the 
applications folder somewhere else. This used to work. I am not sure how 
and when it broke but it has nothing to do with the web2py default folder 
structure. Perhaps the problem is that the options.py example moved from 
web2py/ to web2py/examples/


On Monday, 20 April 2015 09:30:05 UTC-5, AngeloC wrote:

 Hi Massimo, 

 I'm trying to look at it. I have only a question about permission. 
 Applications should run in a writable folder such as the whole web2py. 
 I don't think there is an easy way to give writable permissions to 
 slices of python sitepackage. 

 I don't think also web2py could be disjointed to have the application 
 directory in a path totally different from web2py path. 

 In the end I dont think could be easily feasible to use python package 
 infrastructure to pack web2py. 

 What do you think? 

 Sincerely, Angelo. 

 2015-04-18 4:58 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com: 
  It is very well possible that it does not work. Somebody should adopt 
 it. 
  
  
  On Friday, 17 April 2015 15:05:37 UTC-5, AngeloC wrote: 
  
  Hello List, 
  
  I'm trying to understand how setup.py works. It seems to me that it 
  doesn't work. 
  
  There is no web2py binary in system path or somewhere else. 
  
  It's a bug or feature? 
  
  Thank you! 
  
  Sincerely, Angelo 
  
  -- 
  Profile: http://it.linkedin.com/in/compagnucciangelo 
  
  -- 
  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/d/optout. 



 -- 
 Profile: http://it.linkedin.com/in/compagnucciangelo 


-- 
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/d/optout.


Re: [web2py] Re: question about components

2015-04-20 Thread Ramkrishan Bhatt
Sorry my typo by auto spell correction . I meant ractive.js and Angular.js.

-- 
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/d/optout.


[web2py] Re: question about components

2015-04-20 Thread Gary Cowell
Thanks for the opinions. I'm looking at ractive

On Monday, 20 April 2015 04:30:32 UTC+1, Ramkrishan Bhatt wrote:

 I am agree with Massimo you must try angular or reactive to make SPA. It 
 will surly solve your problem.

-- 
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/d/optout.


[web2py] Re: Web2py: Using images in HTML data

2015-04-20 Thread Sébastien Loix
That's what I thought too

And if it's all coming from static, why don't you just keep in db the path 
from inside the static folder ( in your case images/image.gif) and then 
in your view you build the path img 
src={{appname}}/'static/{{path_from_db}} /


On Sunday, 19 April 2015 04:57:00 UTC+2, Niphlod wrote:

 can't you just use some templating and parse the richbox text, turning 
 /mysitename/static/image.png to /%whatever%/static/image.png ,store that on 
 db, and upon rendering replacing %whatever% with request.application ? 

 On Sunday, April 19, 2015 at 3:18:16 AM UTC+2, Joe Magaro wrote:

 Does anyone have a method for this?

 On Friday, April 17, 2015 at 9:14:59 AM UTC-4, Joe Magaro wrote:

 Thanks Annet: I am aware of web2py URL helpers. I use them inside of my 
 views.

 However in this case, they wont work for me as the data is stored in a 
 table and output to a web page, I require another method.

 On Friday, April 17, 2015 at 3:01:17 AM UTC-4, Annet wrote:

 Hi Joe,

 In the book is an example of how to embed an image using helpers:


 A(IMG(_src=URL('static','logo.png'), _alt=My Logo), 
 _href=URL('default','index'))


 In one of my apps I upload images to a separate app and within that app 
 to separate folders, to 
 embed these images I use:

 img src={{=UPLOADSDOMAIN}}/nodeID{{='%s' 
 %str(request.args(0))}}/{{=row.image}} class=img-responsive /

 where UPLOADSDOMAIN is defined as a constant in a module and references:

 '/dbmodel/static/uploads'

 and nodeID{{='%s' %str(request.args(0))}} references the separate 
 folder and
 row.image contains image_name.png


 Kind regards,

 Annet



-- 
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/d/optout.


Re: [web2py] Re: Still having trouble with format / foreign keys

2015-04-20 Thread Jim S
I just grabbed the latest, timestamp looks like this:

Version 2.10.4-beta+timestamp.2015.04.20.18.00.31

and still having the same issue.

-Jim

On Monday, April 20, 2015 at 6:03:03 PM UTC-5, Massimo Di Pierro wrote:

 re-pushing. Check the nightly built in 20 minutes.

 On Monday, 20 April 2015 16:58:04 UTC-5, Jim S wrote:

 So this fix isn't in the web2py 2.10.4 beta that was built on 4/18?

 -Jim

 On Mon, Apr 20, 2015 at 4:55 PM, Niphlod nip...@gmail.com javascript: 
 wrote:

 we're waiting for 2.10.4 including 
 https://github.com/web2py/pydal/issues/135

 On Monday, April 20, 2015 at 9:46:58 PM UTC+2, Jim S wrote:

 I posted in this thread 
 https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but posted 
 after it was closed.  Evidently, this is fixed but I'm still not seeing my 
 'formats' for foreign keys.  Here are the details:

 I have this in my db.py:

 db.define_table('customer',
 Field('customerId', 'id', readable=True, writable=False, 
 label='Customer #'),
 Field('name', length=30, required=True, writable=False,
   requires=IS_NOT_EMPTY()),
 Field('city', length=30, writable=False),
 Field('state', length=2, writable=False),
 format='%(customerId)s - %(name)s - %(city)s, %(state)s')

 db.define_table('equip_order',
 Field('id', 'id', readable=False, label='Order #'),
 Field('order_type', 'reference orderType', label='Order Type', 
 ondelete='RESTRICT',
requires = IS_IN_DB(db(db.orderType.equipment==True),
'orderType.id', '%(name)s', zero='..')),
 Field('status', length=10, default='New',
requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT'))

 When I display (VIEW MODE) the customer field in the equip_order table 
 in a custom SQLFORM.grid form using:

 {{=form.custom.widget.customer}}

 ...it displays the id of the customer, not the name.

 I thought the 'format' on the customer table definition would control 
 this. I know I can fix it by changing the definition of the customer field 
 in the equip_order table to:

 Field('customer', 'reference customer', label='Customer', 
 ondelete='RESTRICT',
represent=lambda x, r: '%s - %s - %s, %s' % 
 (db.customer(x).customerId
 db.customer(x).name,
 db.customer(x).city,
 db.customer(x).state) if x else ''),

 Should I have to do that, or should the 'format' on customer take care 
 of it?

 -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 a topic in the 
 Google Groups web2py-users group.
 To unsubscribe from this topic, visit 
 https://groups.google.com/d/topic/web2py/j4MhaEfBNuQ/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


Re: [web2py] creating DAL from SQL file

2015-04-20 Thread Richard Vézina
Does the script complete correctly... These scripts are old, and I don't
know many person who have use them... Anyway, 20 tables 50 tables is not
much...

You can write your own which can be basic parser that convert table and
field only and you have to set constrains yourself...

Richard

On Mon, Apr 20, 2015 at 7:55 PM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 Yes I did. I forgot to add. The extract_sqlite_models.py didn't work as
 expect. And that may be because I am not doing it right. Thats why I didn't
 mention.


 python extract_sqlite_models.py
 C:\Users\...\applications\my_application_name\databases\storage.sqlite

 Which generates the following output.

 # -*- coding: utf-8 -*-
 legacy_db =
 DAL('sqlite://C:/Users/.../applications/my_application_name/databases/storage.sqlite')

 legacy_db.define_table('auth_user',
 migrate=False)

 #
 legacy_db.define_table('auth_group',
 migrate=False)

 #
 legacy_db.define_table('auth_membership',
 migrate=False)

 #
 legacy_db.define_table('auth_permission',
 migrate=False)

 #
 legacy_db.define_table('auth_event',
 migrate=False)

 #
 legacy_db.define_table('auth_cas',
 migrate=False)

 #
 legacy_db.define_table('topic',
 migrate=False)

 #
 legacy_db.define_table('comment',
 migrate=False)


 But these generates empty fields and may be its due to the new version
 (2.10.3) I am not sure. Probably have to open a ticket. Unless I am doing
 something wrong in calling that function.



 On Monday, April 20, 2015 at 10:27:17 AM UTC-4, Richard wrote:


 https://github.com/web2py/web2py/blob/master/scripts/extract_sqlite_models.py

 Have you check gluon/scripts/ before ask?

 Richard

 On Sun, Apr 19, 2015 at 5:07 PM, Ron Chatterjee achatte...@gmail.com
 wrote:

 I have the following SQL file:

 BEGIN TRANSACTION;
 CREATE TABLE topic(
 id INTEGER PRIMARY KEY AUTOINCREMENT,
 title CHAR(512) NOT NULL,
 is_active CHAR(1),
 created_on TIMESTAMP,
 created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
 modified_on TIMESTAMP,
 modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
 );
 INSERT INTO `topic` VALUES(1,'regergerg','T','2015-04-14
 14:32:52',1,'2015-04-14 14:32:52',1);
 INSERT INTO `topic` VALUES(2,'egergerger','T','2015-04-14
 14:33:27',1,'2015-04-14 14:33:27',1);


 Is there a script that will convert this to db.py in other words, spit
 out the following code?

 db.define_table('topic',
 Field('title', label=T('Title'), notnull=True,
 requires=IS_NOT_EMPTY()),
 auth.signature,
 format='%(title)s',
 )

 I asked because if I have a large SQL file then creating the table by
 hand or looking at the schema may take some time. Wondering if there is a
 script in the script folder that automoatically does this conversion. I
 know extract_mysql_models.py in the script folder but that only take an
 existing mysql file and does the conversion. I am not sure if it does SQL
 to DAL directly. Am I correct?

 --
 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/d/optout.


  --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] LOAD component inside component

2015-04-20 Thread Richard Vézina
Interresting!

Richard

On Sun, Apr 19, 2015 at 12:54 PM, Dmitry Ermolaev eds.pr...@gmail.com
wrote:

 # -*- coding: utf-8 -*-

 AJ_FROM_SERVER = True
 UPD_TIMEOUT = 6000

 def reload_btn(s):
 return DIV(T('RELOAD'),
 _onclick = 'ajax(%s, [], reload_tag)' %
 URL('aj_load2','reload'),
 _class='btn btn-info')

 def reload():
 session.counter = (int(session.counter or 0)) + 1

 # reload component
 response.js =  jQuery('#show_1').get(0).reload();
 #response.js +=  jQuery('#show_2').get(0).reload();
 return CAT(
 request.now,' ',
 session.counter,
 SCRIPT('$(html,body).animate({scrollTop:50},slow);')
 )

 def show2():

 session.show2 = (int(session.show2 or 0)) + 1
 h=CAT(
 SCRIPT(
 if ( ! $('#show_2').is(':visible')) {
 $('#show_2').animate({ height: 'show' }, 1000);
 }
 ),
 H4('SHOW 2'),
 T('COUNTER 2'),': ',session.show2,
 )
 h += reload_btn(1)

 return h


 def show1():

 session.show1 = (int(session.show1 or 0)) + 1
 session.show2 = 1

 h = CAT(
 SCRIPT(
 if ( ! $('#show_1').is(':visible')) {
 $('#show_1').animate({ height: 'show' }, 1000);
 }
 ),
 H4('SHOW 1'),
 T('COUNTER 1'),': ', session.show1,
 )
 h += LOAD('aj_load2', 'show2', args=[], ajax=True,
 times = 'infinity', timeout=UPD_TIMEOUT,
 target='show_2', # instead _id
 _style='display:none; height:0%;',
 _class='container',
 )

 return h

 def index():
 response.title = None
 #session.forget(response)
 session.forget(request)

 h = CAT()

 h += reload_btn(1)
 h += DIV(_id = 'reload_tag')

 h += LOAD('aj_load2', 'show1', args=[], ajax=True,
 times = 'infinity', timeout=UPD_TIMEOUT * 5,
 target='show_1',
 _style='display:none; height:0%;',
 _class='container',
 )
 return dict( h = DIV(h, _class='row'))


 but after reload show_1 reladind of show_2 do doubles reloads ((


 понедельник, 13 апреля 2015 г., 23:00:39 UTC+3 пользователь Richard
 написал:

 Hello,

 I create a page with multiple components inside of it (the index page is
 basically an empty shell for the components)... But one of there is a form
 in one of the embed component which as a field with a widget that trigger
 modal form allowing to insert a value in another table and select this
 inserted value (something like SELECT_OR_ADD() would do). The problem is
 that my form embeded in the modal which the widget append to the page with
 LOAD() don't load... It hang on loading...

 Any idea?

 Is it even possible to trigger a LOAD inside a LOAD?

 Thanks

 Richard

  --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] Re: question about components

2015-04-20 Thread Michele Comitini
Massimo is talking about ractive.js
ractive.js != reactive

even if adopts the reactive pattern

2015-04-20 5:30 GMT+02:00 Ramkrishan Bhatt ramkrishan.bh...@gmail.com:

 I am agree with Massimo you must try angular or reactive to make SPA. It
 will surly solve your problem.

 --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] Re: Need support for web2py application with over 1 million users.

2015-04-20 Thread Michele Comitini
Hi Sandeep,


To help us try help you, please let us know:
1. database
2. http web server
3. WSGI adapter (eg. uwsgi, fcgi etc..)
4. WSGI execution model (threading, processing)
5. OS

OR if you are running in some PaaS, which one.



2015-04-20 5:25 GMT+02:00 Ramkrishan Bhatt ramkrishan.bh...@gmail.com:

 GAE is better for scale application but developer should know indexing and
 optimized DAL Table. I guess you may facing problem while playing DAL
 objects in function.

 --
 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/d/optout.


-- 
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/d/optout.


[web2py] MENU - active element

2015-04-20 Thread Dmitry Ermolaev
active element in MENU

insert in documentation and in layout.html
=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 
'nav',mobile=is_mobile,li_class='dropdown',ul_class='dropdown-menu',
*active_url=URL()*)

and in css:
.web2py-menu-active a {
color:#C8FF7B;
}



-- 
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/d/optout.


Re: [web2py] Re: Setup.py

2015-04-20 Thread Angelo Compagnucci
Hi Massimo,

I'm trying to look at it. I have only a question about permission.
Applications should run in a writable folder such as the whole web2py.
I don't think there is an easy way to give writable permissions to
slices of python sitepackage.

I don't think also web2py could be disjointed to have the application
directory in a path totally different from web2py path.

In the end I dont think could be easily feasible to use python package
infrastructure to pack web2py.

What do you think?

Sincerely, Angelo.

2015-04-18 4:58 GMT+02:00 Massimo Di Pierro massimo.dipie...@gmail.com:
 It is very well possible that it does not work. Somebody should adopt it.


 On Friday, 17 April 2015 15:05:37 UTC-5, AngeloC wrote:

 Hello List,

 I'm trying to understand how setup.py works. It seems to me that it
 doesn't work.

 There is no web2py binary in system path or somewhere else.

 It's a bug or feature?

 Thank you!

 Sincerely, Angelo

 --
 Profile: http://it.linkedin.com/in/compagnucciangelo

 --
 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/d/optout.



-- 
Profile: http://it.linkedin.com/in/compagnucciangelo

-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread António Ramos
Maybe your online server platform is blocking websockets.
check it with your provider.




2015-04-20 16:02 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 So... I just read something on stackoverflow about that and I think I had
 that idea, just didn't know it was a thing. the i'm executing the
 websocket_messaging.py line from the same server though... not sure why
 that won't work, yet it works when I'm connecting from my local machine.


 On Monday, April 20, 2015 at 3:58:46 PM UTC+1, Samuel Sowah wrote:

 I'm not aware. What exactly do you mean by that please?

 On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax requests
 (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet:
 Name or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com
 :

 Hello,
 I need help getting websocket_messaging.py to work. when I use it
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen,
 screen python websocket_messaging.py -k mykey -p 

 ---
 script
$(document).ready(function(){
   var data;

 $.web2py.web2py_websocket('ws://url:/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 that also worked except it only works when i try and contact it from
 my local app with the script the same as immediately above this 
 statement.
 when I try to load a page hosted online with the same script, it
 doesn't connect, any possible explanation/fix that I can use would be 
 much
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks
 like this
 script
$(document).ready(function(){
   var data;

 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I
 need help.

  --
 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/d/optout.


  --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
I think I'm still a bit lost

On Monday, April 20, 2015 at 4:02:21 PM UTC+1, Samuel Sowah wrote:

 So... I just read something on stackoverflow about that and I think I had 
 that idea, just didn't know it was a thing. i'm executing the 
 websocket_messaging.py line from the same server though... not sure why 
 that won't work, yet it works when I'm connecting from my local machine.

 On Monday, April 20, 2015 at 3:58:46 PM UTC+1, Samuel Sowah wrote:

 I'm not aware. What exactly do you mean by that please?

 On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax requests 
 (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: 
 Name or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com
 :

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from 
 my local app with the script the same as immediately above this 
 statement.
 when I try to load a page hosted online with the same script, it 
 doesn't connect, any possible explanation/fix that I can use would be 
 much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks 
 like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I 
 need help.

  -- 
 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/d/optout.




-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
I'm not aware. What exactly do you mean by that please?

On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax requests 
 (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: Name 
 or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from my 
 local app with the script the same as immediately above this statement.
 when I try to load a page hosted online with the same script, it 
 doesn't connect, any possible explanation/fix that I can use would be much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks 
 like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I need 
 help.

  -- 
 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/d/optout.




-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread António Ramos
try to telnet to that url : and see if your get a black screen

2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 Hello,
 I need help getting websocket_messaging.py to work. when I use it locally
 (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen,
 screen python websocket_messaging.py -k mykey -p 

 ---
 script
$(document).ready(function(){
   var data;

 $.web2py.web2py_websocket('ws://url:/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 that also worked except it only works when i try and contact it from my
 local app with the script the same as immediately above this statement.
 when I try to load a page hosted online with the same script, it doesn't
 connect, any possible explanation/fix that I can use would be much
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks like
 this
 script
$(document).ready(function(){
   var data;

 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I need
 help.

  --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
telnet http://official-notebook.com:
telnet: could not resolve http://official-notebook.com:/telnet: Name or 
service not known

telnet official-notebook.com
Trying 109.123.86.98...
telnet: Unable to connect to remote host: Connection refused





On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com 
 javascript::

 Hello,
 I need help getting websocket_messaging.py to work. when I use it locally 
 (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from my 
 local app with the script the same as immediately above this statement.
 when I try to load a page hosted online with the same script, it doesn't 
 connect, any possible explanation/fix that I can use would be much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks 
 like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I need 
 help.

  -- 
 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/d/optout.




-- 
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/d/optout.


Re: [web2py] creating DAL from SQL file

2015-04-20 Thread Richard Vézina
https://github.com/web2py/web2py/blob/master/scripts/extract_sqlite_models.py

Have you check gluon/scripts/ before ask?

Richard

On Sun, Apr 19, 2015 at 5:07 PM, Ron Chatterjee achatterjee...@gmail.com
wrote:

 I have the following SQL file:

 BEGIN TRANSACTION;
 CREATE TABLE topic(
 id INTEGER PRIMARY KEY AUTOINCREMENT,
 title CHAR(512) NOT NULL,
 is_active CHAR(1),
 created_on TIMESTAMP,
 created_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE,
 modified_on TIMESTAMP,
 modified_by INTEGER REFERENCES auth_user (id) ON DELETE CASCADE
 );
 INSERT INTO `topic` VALUES(1,'regergerg','T','2015-04-14
 14:32:52',1,'2015-04-14 14:32:52',1);
 INSERT INTO `topic` VALUES(2,'egergerger','T','2015-04-14
 14:33:27',1,'2015-04-14 14:33:27',1);


 Is there a script that will convert this to db.py in other words, spit out
 the following code?

 db.define_table('topic',
 Field('title', label=T('Title'), notnull=True,
 requires=IS_NOT_EMPTY()),
 auth.signature,
 format='%(title)s',
 )

 I asked because if I have a large SQL file then creating the table by hand
 or looking at the schema may take some time. Wondering if there is a script
 in the script folder that automoatically does this conversion. I know
 extract_mysql_models.py in the script folder but that only take an
 existing mysql file and does the conversion. I am not sure if it does SQL
 to DAL directly. Am I correct?

 --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
So... I just read something on stackoverflow about that and I think I had 
that idea, just didn't know it was a thing. the i'm executing the 
websocket_messaging.py line from the same server though... not sure why 
that won't work, yet it works when I'm connecting from my local machine.

On Monday, April 20, 2015 at 3:58:46 PM UTC+1, Samuel Sowah wrote:

 I'm not aware. What exactly do you mean by that please?

 On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax requests 
 (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: 
 Name or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from 
 my local app with the script the same as immediately above this statement.
 when I try to load a page hosted online with the same script, it 
 doesn't connect, any possible explanation/fix that I can use would be 
 much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks 
 like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I need 
 help.

  -- 
 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/d/optout.




-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Niphlod
are you aware that websockets have the same limitation as ajax requests 
(same domain) ?

On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: Name 
 or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from my 
 local app with the script the same as immediately above this statement.
 when I try to load a page hosted online with the same script, it doesn't 
 connect, any possible explanation/fix that I can use would be much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it looks 
 like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I need 
 help.

  -- 
 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/d/optout.




-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
Okay, will do Ramos. Thanks

On Monday, April 20, 2015 at 4:05:32 PM UTC+1, Ramos wrote:

 Maybe your online server platform is blocking websockets. 
 check it with your provider.




 2015-04-20 16:02 GMT+01:00 Samuel Sowah sam...@official-notebook.com 
 javascript::

 So... I just read something on stackoverflow about that and I think I had 
 that idea, just didn't know it was a thing. the i'm executing the 
 websocket_messaging.py line from the same server though... not sure why 
 that won't work, yet it works when I'm connecting from my local machine.


 On Monday, April 20, 2015 at 3:58:46 PM UTC+1, Samuel Sowah wrote:

 I'm not aware. What exactly do you mean by that please?

 On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax requests 
 (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: 
 Name or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah sam...@official-notebook.com
 :

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it from 
 my local app with the script the same as immediately above this 
 statement.
 when I try to load a page hosted online with the same script, it 
 doesn't connect, any possible explanation/fix that I can use would be 
 much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it 
 looks like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I 
 need help.

  -- 
 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/d/optout.


  -- 
 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/d/optout.




-- 
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/d/optout.


[web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
Hello,
I need help getting websocket_messaging.py to work. when I use it locally 
(127.0.0.1)
python websocket_messaging.py -k mykey -p 

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


it works. I tried to start it on an online server using screen, 
screen python websocket_messaging.py -k mykey -p 

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

that also worked except it only works when i try and contact it from my 
local app with the script the same as immediately above this statement.
when I try to load a page hosted online with the same script, it doesn't 
connect, any possible explanation/fix that I can use would be much 
appreciated.
Here's what I already tried.

I tried removing the port 888 from the part in the script so it looks like 
this
script
   $(document).ready(function(){
  var data;
  
$.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
   });
/script

I tried restarting websocket_messaging.py without the -p option.
both don't seem to solve the problem. how do I fix this please? I need help.

-- 
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/d/optout.


Re: [web2py] What's the proper way to use URL helper from one app to another (having routed one domain per app)?

2015-04-20 Thread Richard Vézina
I guess you will need scheme=True...

Richard

On Mon, Apr 20, 2015 at 12:46 PM, Lisandro rostagnolisan...@gmail.com
wrote:

 I have one instance of web2py installed on production, with several apps.
 Each app is served by a specific domain. This is acomplished usign
 parameter-based routing system, this what I have in routes.py file:

 # -*- coding: utf-8 -*-
 routers = dict(BASE = dict(\
 default_controller = 'default', \
 default_function = 'index', \
 domains = {\
   'site1.com':'app1', \
   'site2.com':'app2', \
   'site3.com':'app3', \
 }\
 ))

 Now I need to use URL() helper to generate links from one application to
 another.
 Considering the previous configuration, is it ok to generate links in the
 following way?

 From app1, generate a link to go to the site2 homepage:
 URL('default', 'index', host='site2.com')

 From app2, generate a link to go to site3 contact page:
 URL('default', 'contact', host='site3.com')

 Is that the correct approach? Should I include the application parameter
 when using URL() helper in this case?
 Notice that I'm not specifying the application parameter, because it's
 given by the routes.py configuration. Also, if I do, it will be visible on
 the url generated, and I don't want the application to be visible on the
 url. So, is it ok to do it that way? Thanks in advance.

 --
 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/d/optout.


-- 
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/d/optout.


Re: [web2py] websocket_messaging.py not working online

2015-04-20 Thread Samuel Sowah
That doesn't appear to be the case. I send and receive just fine from my 
local server when it loads a page with the script in it.
script
  $(document).ready(function(){
 var data;
 $.web2py.web2py_websocket('ws:
//official-notebook.com:/realtime/mygroup',function(e){data=eval('('+e.
data+')')});
  });
/script

I tried to restart websocket_messaging.py with the -l option to be the ip 
of official-notebook.com. Now I can send messages to it from the online 
server, but it still doesn't CONNECT to when the page loads. I hope I'm 
making sense...

On Monday, April 20, 2015 at 4:06:21 PM UTC+1, Samuel Sowah wrote:

 Okay, will do Ramos. Thanks

 On Monday, April 20, 2015 at 4:05:32 PM UTC+1, Ramos wrote:

 Maybe your online server platform is blocking websockets. 
 check it with your provider.




 2015-04-20 16:02 GMT+01:00 Samuel Sowah sam...@official-notebook.com:

 So... I just read something on stackoverflow about that and I think I 
 had that idea, just didn't know it was a thing. the i'm executing the 
 websocket_messaging.py line from the same server though... not sure why 
 that won't work, yet it works when I'm connecting from my local machine.


 On Monday, April 20, 2015 at 3:58:46 PM UTC+1, Samuel Sowah wrote:

 I'm not aware. What exactly do you mean by that please?

 On Monday, April 20, 2015 at 3:53:24 PM UTC+1, Niphlod wrote:

 are you aware that websockets have the same limitation as ajax 
 requests (same domain) ?

 On Monday, April 20, 2015 at 4:39:08 PM UTC+2, Samuel Sowah wrote:

 telnet http://official-notebook.com:
 telnet: could not resolve http://official-notebook.com:/telnet: 
 Name or service not known

 telnet official-notebook.com
 Trying 109.123.86.98...
 telnet: Unable to connect to remote host: Connection refused





 On Monday, April 20, 2015 at 3:32:32 PM UTC+1, Ramos wrote:

 try to telnet to that url : and see if your get a black screen

 2015-04-20 15:15 GMT+01:00 Samuel Sowah 
 sam...@official-notebook.com:

 Hello,
 I need help getting websocket_messaging.py to work. when I use it 
 locally (127.0.0.1)
 python websocket_messaging.py -k mykey -p 

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


 it works. I tried to start it on an online server using screen, 
 screen python websocket_messaging.py -k mykey -p 

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

 that also worked except it only works when i try and contact it 
 from my local app with the script the same as immediately above this 
 statement.
 when I try to load a page hosted online with the same script, it 
 doesn't connect, any possible explanation/fix that I can use would be 
 much 
 appreciated.
 Here's what I already tried.

 I tried removing the port 888 from the part in the script so it 
 looks like this
 script
$(document).ready(function(){
   var data;
   
 $.web2py.web2py_websocket('ws://url/realtime/mygroup',function(e){data=eval('('+e.data+')')});
});
 /script

 I tried restarting websocket_messaging.py without the -p option.
 both don't seem to solve the problem. how do I fix this please? I 
 need help.

  -- 
 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/d/optout.


  -- 
 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/d/optout.




-- 
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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Niphlod
what are you expecting and what do you see instead ?
returning from controllers is the only supported way.

On Monday, April 20, 2015 at 6:28:14 PM UTC+2, Jim S wrote:

 I have some controller methods that I call using ajax and they return a 
 json string using:

 return response.json(list_of_dictionaries)

 I just realized today that it isn't working on newer releases.  Based on 
 the web2py releases that I have, I can see that it works in 2.9.5 but not 
 2.9.12.  Also, does not work in 2.10.4 beta from today.  I can get it 
 working by simply replacing:

 return response.json(list_of_dictionaries)

 with

 return json.dumps(list_of_dictionaries)

 The problem (at least as I see it) is that backward compatibility is 
 broken.  Was I using it incorrectly to begin with?  If this is a bug I'd be 
 happy to open a ticket.  I'd like some confirmation from others whether or 
 not you see it as a bug or a misuse on my part.

 -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/d/optout.


Re: [web2py] response.json() not working?

2015-04-20 Thread Richard Vézina
https://groups.google.com/forum/#!searchin/web2py/response.json()/web2py/7EJ0-rOd1bo/iR6YWJOSaQgJ

On Mon, Apr 20, 2015 at 12:28 PM, Jim S j...@qlf.com wrote:

 I have some controller methods that I call using ajax and they return a
 json string using:

 return response.json(list_of_dictionaries)

 I just realized today that it isn't working on newer releases.  Based on
 the web2py releases that I have, I can see that it works in 2.9.5 but not
 2.9.12.  Also, does not work in 2.10.4 beta from today.  I can get it
 working by simply replacing:

 return response.json(list_of_dictionaries)

 with

 return json.dumps(list_of_dictionaries)

 The problem (at least as I see it) is that backward compatibility is
 broken.  Was I using it incorrectly to begin with?  If this is a bug I'd be
 happy to open a ticket.  I'd like some confirmation from others whether or
 not you see it as a bug or a misuse on my part.

 -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/d/optout.


-- 
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/d/optout.


Re: [web2py] response.json() not working?

2015-04-20 Thread Niphlod


On Monday, April 20, 2015 at 8:10:56 PM UTC+2, Richard wrote:


 https://groups.google.com/forum/#!searchin/web2py/response.json()/web2py/7EJ0-rOd1bo/iR6YWJOSaQgJ


@richard: that's not helping: @jim is using response.json in a controller, 
that is supported, not in a view, that is not supported.  

-- 
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/d/optout.


Re: [web2py] response.json() not working?

2015-04-20 Thread Richard Vézina
I just saw this post pass I though it could be related... I read that there
seems to have issue with response.json...

Sorry that it not help...

Richard

On Mon, Apr 20, 2015 at 2:13 PM, Niphlod niph...@gmail.com wrote:



 On Monday, April 20, 2015 at 8:10:56 PM UTC+2, Richard wrote:


 https://groups.google.com/forum/#!searchin/web2py/response.json()/web2py/7EJ0-rOd1bo/iR6YWJOSaQgJ


 @richard: that's not helping: @jim is using response.json in a controller,
 that is supported, not in a view, that is not supported.

 --
 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/d/optout.


-- 
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/d/optout.


[web2py] Re: Need advice/help with url rewrite: multiple domains, multiple apps, two apps per domain

2015-04-20 Thread Lisandro
I've just figured it out. I wasn't thinking right.
I realised that, instead of having each site accesing its panel through 
those kind of urls (site1.dev/panel, site2.dev/panel, etc), I could use 
subdomains like panel.site1.dev, panel.site2.dev, etc, and then the thing 
is as easy as editing routes.py with parameter-based routing system, like 
this:

# -*- coding: utf-8 -*-
routers = dict(\
  BASE = dict(\
domains = {\
  'site1.dev':'site1', \
  'panel.site1.dev':'site1_panel', \
  'site2.dev':'site2', \
  'panel.site2.dev':'site2_panel', \
}, \
  )\
)



El miércoles, 15 de abril de 2015, 10:00:35 (UTC-3), Lisandro escribió:

 I have multiple domains with multiple applications. I've gotten it to work 
 using routes.py, with both approaches: parameter-based and pattern-based 
 system. However, there's a couple of things that still I can't achieve.


 1) Two applications per each domain
 In my case, each domain serves two applications: the main one, and a 
 second one. I need the main one to be accessible through / url. And I need 
 the second one to be accessible through an url that  is different to the 
 application name. To clarify:

   *http://site1.dev http://site1.dev* should serve 
 *site1* app
   *http://site1.dev/panel http://site1.dev/panel*   should serve 
 *panel1* app

   *http://site2.dev http://site2.dev* should serve 
 *site2* app
   *http://site2.dev/panel http://site2.dev/panel*   should serve 
 *panel2* app

 Notice that every domain should have the /panel url pointing to the 
 corresponding application (panel1, panel2, etc). 


 2) Restrict access to specific application according the domain
 Whether is parameter-based or pattern-based system, all domains endup 
 having access to all applications, for example, http://site1.dev/site2/ 
  is showing site2 application. But I would like that the domain 
 *site1.dev* can only access the applications site1 and panel1, and 
 nothing else.



 What have I achieved so far? 

  routes.py using parameter-based system -
 # -*- coding: utf-8 -*-

 routers = dict(BASE = dict(\
 domains = {\
   'site1.dev':'site1', \
   'site2.dev':'site2', \
 }))


 This approach is working, however I don't know how to make */panel* url 
 to serve *panel1* application. Also, the problem of the point 2 remains: 
 all domains can access all applications.


  routes.py using pattern-based system -
 # -*- coding: utf-8 -*-

 routes_in = (
 ('.*http://site1.dev.* /*', '/site1'),
 ('.*http://site2.dev.* /*', '/site2'))


 In this case, in addition to the aforementioned problems, I see an error 
 on every url that is not default/index. That is, http://site1.dev/ shows 
 the default/index, but if I click, let's say, on the register url, the 
 browser attempts to load site1.dev/site1/default/user/register but I 
 receive an invalid function error.


 At this point, I'm a bit lost. I'm using nginx, and I asume all this could 
 be done through nginx's rewrite module (however I would like to keep it 
 inside web2py, for portability reasons).
 Also, I must say I've never worked with regular expressions, and in 
 addition, as you can see, this scenario is a little bit different than the 
 classic one-app-per-domain. 

 So, I would really appreciate any advice or help on this. 

 P/S: if someone feels sufficiently trained to resolve the situation, 
 please contact me by private, I'm willing to spend some money to resolve 
 this situation in a professional manner.


-- 
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/d/optout.


[web2py] Re: Issue with lookup foreign key / format statement in 2.10.3

2015-04-20 Thread Jim S
Can someone tell me if this is fixed?

I'm still having issues but maybe I'm doing something wrong:

I have this in my db.py:

db.define_table('customer',
Field('customerId', 'id', readable=True, writable=False, label='Customer 
#'),
Field('name', length=30, required=True, writable=False,
  requires=IS_NOT_EMPTY()),
Field('city', length=30, writable=False),
Field('state', length=2, writable=False),
format='%(customerId)s - %(name)s - %(city)s, %(state)s')

db.define_table('equip_order',
Field('id', 'id', readable=False, label='Order #'),
Field('order_type', 'reference orderType', label='Order Type', 
ondelete='RESTRICT',
   requires = IS_IN_DB(db(db.orderType.equipment==True),
   'orderType.id', '%(name)s', zero='..')),
Field('status', length=10, default='New',
   requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
Field('customer', 'reference customer', label='Customer', 
ondelete='RESTRICT'))

When I display the customer field in the equip_order table in a custom 
SQLFORM.grid form using:

{{=form.custom.widget.customer}}

...it displays the id of the customer, not the name.

I thought the 'format' on the customer table definition would control this. 
I know I can fix it by changing the definition of the customer field in the 
equip_order table to:

Field('customer', 'reference customer', label='Customer', 
ondelete='RESTRICT',
   represent=lambda x, r: '%s - %s - %s, %s' % (db.customer(x).customerId
db.customer(x).name,
db.customer(x).city,
db.customer(x).state) if x else ''),

Should I have to do that, or should the 'format' on customer take care of 
it?

-Jim








On Friday, April 17, 2015 at 9:53:08 PM UTC-5, Massimo Di Pierro wrote:

 No tomorrow.

 On Wednesday, 15 April 2015 13:10:28 UTC-5, Dave S wrote:



 On Tuesday, April 14, 2015 at 2:29:48 PM UTC-7, Niphlod wrote:

 being a bug, we need to ship a new web2py. it got fixed already. we're 
 waiting for Massimo to release a 2.10.4.


 Is that fix included in the nightly builds yet?
  
 /dps


 On Tuesday, April 14, 2015 at 10:51:31 PM UTC+2, wish...@gmail.com 
 wrote:

 I just discovered, there's already a issue posted..

 https://groups.google.com/forum/#!topic/web2py/Tog4tdUl400
 https://github.com/web2py/web2py/issues/904 

 Are there already any solutions yet?

 Thanks  cheers
 Toby

 wish...@gmail.com:

 Hey guys!

 Did 2.10.3-stable+timestamp.2015.04.02.21.42.07 change something in 
 the way* format statements *%(fields)s are handled?

 When referencing another table, the *format statement now seems to be 
 ignored*. Instead only the foreign key id is displayed.

 Example 

 I have the following lookup table

 db.define_table('countries',
 Field('country', 'string'),
 Field('the_geom', 'geometry()'),
 Field.Virtual('latitude', lambda row: db(db.countries.id == 
 row.countries.id
 ).select(db.countries.centroid.st_y()).first()[db.countries.centroid.st_y()]),
 Field.Virtual('longitude', lambda row: db(db.countries.id == 
 row.countries.id
 ).select(db.countries.centroid.st_x()).first()[db.countries.centroid.st_x()]),
* format='%(country)s'*, migrate=True)
 
 Another table is referencing this lookup table

 db.define_table('uploads',
 Field('country',* db.countries*),
 Field('uploaded','date'),
 ...
 migrate=True)
 
 Now I would like to count the number of uploads per country.

 def count_uploads_by_country():
 import datetime
 from datetime import timedelta
 count = db.wifi_zone.id.count()
 result = db(db.uploads.uploaded  datetime.date.today() -  
 timedelta(days=7)).select(*db.uploads.country*, count, groupby = 
 db.uploads.country).render()
 return dict(result=result)
 
 I would expect that a query on the uploads table would display the 
 country name as specified in the format statement, i.e.
 *Country  Uploads per Country*
 *France* 123
 *Italy   *45 
 *Germany   *10

 Until recently this worked perfectly, but following the update to 
 2.10.3 only the country ids are returned, i.e.

 *Country  Uploads per Country**1*   -- foreign id instead of name
 *2*   --45 
 *3*   --10

 db._lastsql shows that the country name isn't even queried:
 SELECT uploads.country, COUNT(uploads.id) FROM uploads WHERE 
 (uploads.last_updated  '2015-04-04') GROUP BY uploads.country;

 Does anybody have a clue, why only the foreign id is displayed, but 
 not the country name according to the format statement?

 Cheers 
 Toby



-- 
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/d/optout.


[web2py] What's the proper way to use URL helper from one app to another (having routed one domain per app)?

2015-04-20 Thread Lisandro
I have one instance of web2py installed on production, with several apps. 
Each app is served by a specific domain. This is acomplished usign 
parameter-based routing system, this what I have in routes.py file:

# -*- coding: utf-8 -*-
routers = dict(BASE = dict(\
default_controller = 'default', \
default_function = 'index', \
domains = {\
  'site1.com':'app1', \
  'site2.com':'app2', \
  'site3.com':'app3', \
}\
))

Now I need to use URL() helper to generate links from one application to 
another. 
Considering the previous configuration, is it ok to generate links in the 
following way?

From app1, generate a link to go to the site2 homepage:
URL('default', 'index', host='site2.com')

From app2, generate a link to go to site3 contact page:
URL('default', 'contact', host='site3.com')

Is that the correct approach? Should I include the application parameter 
when using URL() helper in this case? 
Notice that I'm not specifying the application parameter, because it's 
given by the routes.py configuration. Also, if I do, it will be visible on 
the url generated, and I don't want the application to be visible on the 
url. So, is it ok to do it that way? Thanks in advance.

-- 
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/d/optout.


[web2py] response.json() not working?

2015-04-20 Thread Jim S
I have some controller methods that I call using ajax and they return a 
json string using:

return response.json(list_of_dictionaries)

I just realized today that it isn't working on newer releases.  Based on 
the web2py releases that I have, I can see that it works in 2.9.5 but not 
2.9.12.  Also, does not work in 2.10.4 beta from today.  I can get it 
working by simply replacing:

return response.json(list_of_dictionaries)

with

return json.dumps(list_of_dictionaries)

The problem (at least as I see it) is that backward compatibility is 
broken.  Was I using it incorrectly to begin with?  If this is a bug I'd be 
happy to open a ticket.  I'd like some confirmation from others whether or 
not you see it as a bug or a misuse on my part.

-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/d/optout.


Re: [web2py] response.json() not working?

2015-04-20 Thread Jim S
Richard - I saw that thread too before I posted my message.  I'm assuming 
this is the same issue.  I have a workaround, but just pointing out that 
this used to work and now it doesn't, breaking backward compatibility.

...unless I was just doing it wrong and by chance it worked...

-Jim

On Monday, April 20, 2015 at 1:10:56 PM UTC-5, Richard wrote:


 https://groups.google.com/forum/#!searchin/web2py/response.json()/web2py/7EJ0-rOd1bo/iR6YWJOSaQgJ

 On Mon, Apr 20, 2015 at 12:28 PM, Jim S j...@qlf.com javascript: 
 wrote:

 I have some controller methods that I call using ajax and they return a 
 json string using:

 return response.json(list_of_dictionaries)

 I just realized today that it isn't working on newer releases.  Based on 
 the web2py releases that I have, I can see that it works in 2.9.5 but not 
 2.9.12.  Also, does not work in 2.10.4 beta from today.  I can get it 
 working by simply replacing:

 return response.json(list_of_dictionaries)

 with

 return json.dumps(list_of_dictionaries)

 The problem (at least as I see it) is that backward compatibility is 
 broken.  Was I using it incorrectly to begin with?  If this is a bug I'd be 
 happy to open a ticket.  I'd like some confirmation from others whether or 
 not you see it as a bug or a misuse on my part.

 -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+un...@googlegroups.com javascript:.
 For more options, visit https://groups.google.com/d/optout.




-- 
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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Jim S
Using jQuery and the $.ajax function, I'm returning a json object from my 
controller function using response.json(list_of_dictionaries).

I'm seeing an error in firebug saying:

SyntaxError: JSON.parse: unexpected end of data at ...

Here is the javascript:

$.ajax({url: {{=URL('workorder','get_mixer_dropdown', 
user_signature=True)}},
data: {site:site}})
.fail(function() {
alert('There was a problem retrieving the mixer list.  Please 
contact support.');
})
.success(function(msg) {
options = $.parseJSON(msg);
$('#workorder_mixer').find('option').remove().end()
for (i=0;ioptions.length;i++) {
$('#workorder_mixer').append(
$('option /')
.text(options[i].text)
.val(options[i].id)
);
}
$('#workorder_mixer').attr('disabled',false);
});

The error is on the $.parseJSON(msg) stating that an invalid JSON object 
was returned.  This error doesn't happen on web2py v2.9.5, but does with 
2.10.4 beta.  Returning from the controller isn't the problem.  The problem 
is when I use response.json(list_of_dictionaries) instead of 
json.dumps(list_of_dictionaries) to convert my list to JSON. 
 response.json(list_of_dictionaries) used to work and now it doesn't.

-Jim

On Monday, April 20, 2015 at 1:10:30 PM UTC-5, Niphlod wrote:

 what are you expecting and what do you see instead ?
 returning from controllers is the only supported way.

 On Monday, April 20, 2015 at 6:28:14 PM UTC+2, Jim S wrote:

 I have some controller methods that I call using ajax and they return a 
 json string using:

 return response.json(list_of_dictionaries)

 I just realized today that it isn't working on newer releases.  Based on 
 the web2py releases that I have, I can see that it works in 2.9.5 but not 
 2.9.12.  Also, does not work in 2.10.4 beta from today.  I can get it 
 working by simply replacing:

 return response.json(list_of_dictionaries)

 with

 return json.dumps(list_of_dictionaries)

 The problem (at least as I see it) is that backward compatibility is 
 broken.  Was I using it incorrectly to begin with?  If this is a bug I'd be 
 happy to open a ticket.  I'd like some confirmation from others whether or 
 not you see it as a bug or a misuse on my part.

 -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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Niphlod
there you are! response.json now sets content-type = application/json as 
it's supposed to be (if no specific content-type header is specified)
Previous versions relied on the user setting the right content-type, but we 
noticed that nobody was properly setting it.

tl;dr web2py fixed a behavioural bug, setting the proper content-type, 
and your view worked around a behavioural bug (you didn't set the 
content-type) that wasn't supposed to be there in the first place. Strip 
$.parseJSON: it's useless now because response.json doesn't return a string 
that can be parsed as a json object, but the json object itself.

On Monday, April 20, 2015 at 8:41:25 PM UTC+2, Jim S wrote:

 Using jQuery and the $.ajax function, I'm returning a json object from my 
 controller function using response.json(list_of_dictionaries).

 I'm seeing an error in firebug saying:

 SyntaxError: JSON.parse: unexpected end of data at ...

 Here is the javascript:

 $.ajax({url: {{=URL('workorder','get_mixer_dropdown', 
 user_signature=True)}},
 data: {site:site}})
 .fail(function() {
 alert('There was a problem retrieving the mixer list.  Please 
 contact support.');
 })
 .success(function(msg) {
 options = $.parseJSON(msg);
 $('#workorder_mixer').find('option').remove().end()
 for (i=0;ioptions.length;i++) {
 $('#workorder_mixer').append(
 $('option /')
 .text(options[i].text)
 .val(options[i].id)
 );
 }
 $('#workorder_mixer').attr('disabled',false);
 });

 The error is on the $.parseJSON(msg) stating that an invalid JSON object 
 was returned.  This error doesn't happen on web2py v2.9.5, but does with 
 2.10.4 beta.  Returning from the controller isn't the problem.  The problem 
 is when I use response.json(list_of_dictionaries) instead of 
 json.dumps(list_of_dictionaries) to convert my list to JSON. 
  response.json(list_of_dictionaries) used to work and now it doesn't.

 -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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Niphlod


On Monday, April 20, 2015 at 9:16:49 PM UTC+2, Jim S wrote:

 Shoot, so now I have to have different behavior based on the web2py 
 version.  If I fix this code so it runs properly, it will quit working on 
 my production servers unless I upgrade them to 2.9.12 or later.


Again, the only difference is on setting or not the content-type. Your app 
will work on any web2py if you care to set content-type to application/json 
. older web2py will NEED it, newer will set it if not found. Views will 
need stripping parseJSON as they will happily parse a json object 
automatically.
 

 To make it compatible with both versions I'd need to use 
 json.dumps(list_of_dictionaries) instead of 
 response.json(list_of_dictionaries), right?  But then that is the wrong 
 behavior in the long run, right?


Yes, it's wrong to return a json object as text/html. 

-- 
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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Jim S
Thank you!

I went through and made the changes as suggested and is working fine in 
both environments.

-Jim


On Monday, April 20, 2015 at 2:40:33 PM UTC-5, Niphlod wrote:



 On Monday, April 20, 2015 at 9:16:49 PM UTC+2, Jim S wrote:

 Shoot, so now I have to have different behavior based on the web2py 
 version.  If I fix this code so it runs properly, it will quit working on 
 my production servers unless I upgrade them to 2.9.12 or later.


 Again, the only difference is on setting or not the content-type. Your app 
 will work on any web2py if you care to set content-type to application/json 
 . older web2py will NEED it, newer will set it if not found. Views will 
 need stripping parseJSON as they will happily parse a json object 
 automatically.
  

 To make it compatible with both versions I'd need to use 
 json.dumps(list_of_dictionaries) instead of 
 response.json(list_of_dictionaries), right?  But then that is the wrong 
 behavior in the long run, right?


 Yes, it's wrong to return a json object as text/html. 


-- 
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/d/optout.


[web2py] Re: response.json() not working?

2015-04-20 Thread Jim S
Shoot, so now I have to have different behavior based on the web2py 
version.  If I fix this code so it runs properly, it will quit working on 
my production servers unless I upgrade them to 2.9.12 or later.

To make it compatible with both versions I'd need to use 
json.dumps(list_of_dictionaries) instead of 
response.json(list_of_dictionaries), right?  But then that is the wrong 
behavior in the long run, right?

-Jim

On Monday, April 20, 2015 at 1:45:53 PM UTC-5, Niphlod wrote:

 there you are! response.json now sets content-type = application/json as 
 it's supposed to be (if no specific content-type header is specified)
 Previous versions relied on the user setting the right content-type, but 
 we noticed that nobody was properly setting it.

 tl;dr web2py fixed a behavioural bug, setting the proper content-type, 
 and your view worked around a behavioural bug (you didn't set the 
 content-type) that wasn't supposed to be there in the first place. Strip 
 $.parseJSON: it's useless now because response.json doesn't return a string 
 that can be parsed as a json object, but the json object itself.

 On Monday, April 20, 2015 at 8:41:25 PM UTC+2, Jim S wrote:

 Using jQuery and the $.ajax function, I'm returning a json object from my 
 controller function using response.json(list_of_dictionaries).

 I'm seeing an error in firebug saying:

 SyntaxError: JSON.parse: unexpected end of data at ...

 Here is the javascript:

 $.ajax({url: {{=URL('workorder','get_mixer_dropdown', 
 user_signature=True)}},
 data: {site:site}})
 .fail(function() {
 alert('There was a problem retrieving the mixer list.  Please 
 contact support.');
 })
 .success(function(msg) {
 options = $.parseJSON(msg);
 $('#workorder_mixer').find('option').remove().end()
 for (i=0;ioptions.length;i++) {
 $('#workorder_mixer').append(
 $('option /')
 .text(options[i].text)
 .val(options[i].id)
 );
 }
 $('#workorder_mixer').attr('disabled',false);
 });

 The error is on the $.parseJSON(msg) stating that an invalid JSON object 
 was returned.  This error doesn't happen on web2py v2.9.5, but does with 
 2.10.4 beta.  Returning from the controller isn't the problem.  The problem 
 is when I use response.json(list_of_dictionaries) instead of 
 json.dumps(list_of_dictionaries) to convert my list to JSON. 
  response.json(list_of_dictionaries) used to work and now it doesn't.

 -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/d/optout.


[web2py] Still having trouble with format / foreign keys

2015-04-20 Thread Jim S
I posted in this 
thread https://groups.google.com/forum/#!topic/web2py/2i9zfAzG2s8 but 
posted after it was closed.  Evidently, this is fixed but I'm still not 
seeing my 'formats' for foreign keys.  Here are the details:

I have this in my db.py:

db.define_table('customer',
Field('customerId', 'id', readable=True, writable=False, label='Customer 
#'),
Field('name', length=30, required=True, writable=False,
  requires=IS_NOT_EMPTY()),
Field('city', length=30, writable=False),
Field('state', length=2, writable=False),
format='%(customerId)s - %(name)s - %(city)s, %(state)s')

db.define_table('equip_order',
Field('id', 'id', readable=False, label='Order #'),
Field('order_type', 'reference orderType', label='Order Type', 
ondelete='RESTRICT',
   requires = IS_IN_DB(db(db.orderType.equipment==True),
   'orderType.id', '%(name)s', zero='..')),
Field('status', length=10, default='New',
   requires=IS_IN_SET(('New', 'Submitted', 'Invoiced'))),
Field('customer', 'reference customer', label='Customer', 
ondelete='RESTRICT'))

When I display (VIEW MODE) the customer field in the equip_order table in a 
custom SQLFORM.grid form using:

{{=form.custom.widget.customer}}

...it displays the id of the customer, not the name.

I thought the 'format' on the customer table definition would control this. 
I know I can fix it by changing the definition of the customer field in the 
equip_order table to:

Field('customer', 'reference customer', label='Customer', 
ondelete='RESTRICT',
   represent=lambda x, r: '%s - %s - %s, %s' % (db.customer(x).customerId
db.customer(x).name,
db.customer(x).city,
db.customer(x).state) if x else ''),

Should I have to do that, or should the 'format' on customer take care of 
it?

-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/d/optout.


[web2py] Prince - Print Python Html to PDF

2015-04-20 Thread Ovidio Marinho
Has anyone tried to use it with web2py?

http://www.princexml.com/doc/9.0/python/



   [image: http://itjp.net.br] http://itjp.net.br
 http://itjp.net.b http://itjp.net.brr
  *Ovidio Marinho Falcao Neto*
 ovidio...@gmail.com
Brasil

-- 
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/d/optout.