[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Massimo Di Pierro
+1000


On Saturday, 21 April 2012 19:11:37 UTC-5, stefaan wrote:
>
>
> > This new look that Google Groups has implemented is seriously
> > debilitating
>
> +200
>
>
>

Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Carlos
Hi Bruce,

It would be awesome if I could use web2py to connect to the remote MySQL 
server (using DAL to manipulate the database, instead of raw SQL commands), 
I really hope so, but I still can't confirm this, until maybe Monday or 
Tuesday when I will have more information about this.

I'll likely come back here again to ask more related questions, when I 
actually have more specific information.

Thanks again for your input!

   Carlos

On Saturday, April 21, 2012 9:15:17 PM UTC-5, Bruce Wade wrote:
>
> If you are going to have access to the database server, then why not just 
> write the api with web2py and use web2py DAL to connect and execute 
> commands. Otherwise you will need another RPC server or something on the 
> database server to do mysql queries. 
>
> Like this site I did: 96.126.99.73 has web2py running on 3 different 
> servers that visitors are dynamically connected to (using stickiness). Each 
> of them servers connect to 3 different databases on completely different 
> servers depending on what information they need.
>
> On Sat, Apr 21, 2012 at 7:02 PM, Carlos  wrote:
>
>> Thanks for your responses Bruce and Jonathan.
>>
>> With respect to Bruce's questions:
>>
>> >> Do you want to basically get a request from the client and pass that 
>> request to a server/mysql which will determine what to do with the request, 
>> return you data and that data is returned back to the client?
>>
>> Basically, yes.
>>
>> >> How is the non-web2py server listening for connections? Does it 
>> already have an api programmed or is that also your task?
>>
>> There's no api, it's also part of my question, do you recommend any 
>> specific api to connect a web2py server (SYS) to a remote non-web2py MySql 
>> server (SERVER)?, I will likely have remote access to the computer where 
>> MySQL runs, but I have no idea how to configure such server to accept 
>> remote connections to execute remote SQL commands from my web2py SYS server.
>>
>> Thanks again.
>>
>> On Saturday, April 21, 2012 1:57:27 PM UTC-5, Bruce Wade wrote:
>>>
>>> Hi Carlos,
>>>
>>> Thanks for clarifying. 
>>>
>>> Do you know how can my web2py server connect remotely to a non-web2py 
>>> server to execute some SQL commands?
>>>
>>> I think you need to think about this at a python level more then a 
>>> web2py level. web2py uses python which means yes you can connect to 
>>> whatever non-web2py server that handles network protocols in one way or 
>>> another. 
>>>
>>> Do you want to basically get a request from the client and pass that 
>>> request to a server/mysql which will determine what to do with the request, 
>>> return you data and that data is returned back to the client?
>>>
>>> How is the non-web2py server listening for connections? Does it already 
>>> have an api programmed or is that also your task?
>>>
>>>
>>> On Sat, Apr 21, 2012 at 11:20 AM, Carlos wrote:
>>>
 Hi Bruce,

 Thanks, but that's not the case.

 My web2py system is already a complete cloud SaaS server, with a single 
 postgresql db, multi-tenancy, multi-apps, single-sign-on, etc.

 And one potential customer (tenant), who will use all the other apps in 
 the cloud, requires this new scenario/app where my system handles web 
 services requests from an external non-web2py system (named CLIENT) and 
 collects the respective data from another external non-web2py system 
 (named 
 SERVER), therefore acting as a middle-server (or so).

 All 3 systems (my own cloud SaaS SYS, and CLIENT, and SERVER) are 
 completely independent (with no relation whatsoever).

 Thanks,

Carlos


 On Saturday, April 21, 2012 1:08:55 PM UTC-5, Bruce Wade wrote:
>
> From what you explained it sounds like you just want:
> 1) Independent database server
> 2) Web2py to handle requests via a service
> 3) Javascript to connect to a web2py service using ajax and or sockets
>
> If that is what you are asking it web2py can handle that simply if 
> that is not what you are suggesting then I am not sure, and need more 
> details.
>
> On Sat, Apr 21, 2012 at 11:02 AM, Carlos wrote:
>
>> Hi,
>>
>> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
>>
>> Following are some requirements for my new potential project (where 
>> SYS is my web2py system, and CLIENT and SERVER are two completely 
>> different 
>> / independent non-web2py remote servers):
>>
>> (for each web services call ...)
>>
>> + CLIENT initiates the communication to SYS via web services to 
>> request some data.
>>
>> + during this same connection (in real time), SYS connects to the 
>> remote SERVER to execute some SQL commands (in a MySQL database) and get 
>> the requested data.
>>
>> + finally SYS responds to CLIENT with the data.
>>
>> In summary, SYS will act as the middle-man between CLIENT a

[web2py] Programmatically log in

2012-04-21 Thread cyan

I am trying to define a function which programmatically logs user in, e.g.

def program_login:
# log-in code

this may be useful for some callback situations, e.g.

auth.settings.verify_email_onaccept.append(program_login)

in which case, user gets automatically logged in only after he/she has 
verified his/her email.

so far, I've only found so-called manual authentication in the manual:

user = auth.login_bare(username, password)

but I am not so sure if this is what I need for the case above. In 
particular, how could I obtain the corresponding password for the user 
here? And I suppose it is encrypted? 




Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Bruce Wade
If you are going to have access to the database server, then why not just
write the api with web2py and use web2py DAL to connect and execute
commands. Otherwise you will need another RPC server or something on the
database server to do mysql queries.

Like this site I did: 96.126.99.73 has web2py running on 3 different
servers that visitors are dynamically connected to (using stickiness). Each
of them servers connect to 3 different databases on completely different
servers depending on what information they need.

On Sat, Apr 21, 2012 at 7:02 PM, Carlos  wrote:

> Thanks for your responses Bruce and Jonathan.
>
> With respect to Bruce's questions:
>
> >> Do you want to basically get a request from the client and pass that
> request to a server/mysql which will determine what to do with the request,
> return you data and that data is returned back to the client?
>
> Basically, yes.
>
> >> How is the non-web2py server listening for connections? Does it already
> have an api programmed or is that also your task?
>
> There's no api, it's also part of my question, do you recommend any
> specific api to connect a web2py server (SYS) to a remote non-web2py MySql
> server (SERVER)?, I will likely have remote access to the computer where
> MySQL runs, but I have no idea how to configure such server to accept
> remote connections to execute remote SQL commands from my web2py SYS server.
>
> Thanks again.
>
> On Saturday, April 21, 2012 1:57:27 PM UTC-5, Bruce Wade wrote:
>>
>> Hi Carlos,
>>
>> Thanks for clarifying.
>>
>> Do you know how can my web2py server connect remotely to a non-web2py
>> server to execute some SQL commands?
>>
>> I think you need to think about this at a python level more then a web2py
>> level. web2py uses python which means yes you can connect to whatever
>> non-web2py server that handles network protocols in one way or another.
>>
>> Do you want to basically get a request from the client and pass that
>> request to a server/mysql which will determine what to do with the request,
>> return you data and that data is returned back to the client?
>>
>> How is the non-web2py server listening for connections? Does it already
>> have an api programmed or is that also your task?
>>
>>
>> On Sat, Apr 21, 2012 at 11:20 AM, Carlos  wrote:
>>
>>> Hi Bruce,
>>>
>>> Thanks, but that's not the case.
>>>
>>> My web2py system is already a complete cloud SaaS server, with a single
>>> postgresql db, multi-tenancy, multi-apps, single-sign-on, etc.
>>>
>>> And one potential customer (tenant), who will use all the other apps in
>>> the cloud, requires this new scenario/app where my system handles web
>>> services requests from an external non-web2py system (named CLIENT) and
>>> collects the respective data from another external non-web2py system (named
>>> SERVER), therefore acting as a middle-server (or so).
>>>
>>> All 3 systems (my own cloud SaaS SYS, and CLIENT, and SERVER) are
>>> completely independent (with no relation whatsoever).
>>>
>>> Thanks,
>>>
>>>Carlos
>>>
>>>
>>> On Saturday, April 21, 2012 1:08:55 PM UTC-5, Bruce Wade wrote:

 From what you explained it sounds like you just want:
 1) Independent database server
 2) Web2py to handle requests via a service
 3) Javascript to connect to a web2py service using ajax and or sockets

 If that is what you are asking it web2py can handle that simply if that
 is not what you are suggesting then I am not sure, and need more details.

 On Sat, Apr 21, 2012 at 11:02 AM, Carlos wrote:

> Hi,
>
> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
>
> Following are some requirements for my new potential project (where
> SYS is my web2py system, and CLIENT and SERVER are two completely 
> different
> / independent non-web2py remote servers):
>
> (for each web services call ...)
>
> + CLIENT initiates the communication to SYS via web services to
> request some data.
>
> + during this same connection (in real time), SYS connects to the
> remote SERVER to execute some SQL commands (in a MySQL database) and get
> the requested data.
>
> + finally SYS responds to CLIENT with the data.
>
> In summary, SYS will act as the middle-man between CLIENT and SERVER.
>
> Questions:
>
> Is this doable?, should I be aware of any issues that might arise?,
> concurrency, others?.
>
> Do you recommend other ways to accomplish this?.
>
> Do you know how can my web2py server connect remotely to a non-web2py
> server to execute some SQL commands?.
>
> Will SYS have enough time for this process to complete on each web
> service call?.
>
> I would just like to know your general (or specific) recommendations
> about this scenario.
>
> Thanks!,
>
>Carlos
>
>


 --
 --
 Regards,
 Bruce Wade
 http://ca.linkedin.com/in/**

Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Carlos
Thanks for your responses Bruce and Jonathan.

With respect to Bruce's questions:

>> Do you want to basically get a request from the client and pass that 
request to a server/mysql which will determine what to do with the request, 
return you data and that data is returned back to the client?

Basically, yes.

>> How is the non-web2py server listening for connections? Does it already 
have an api programmed or is that also your task?

There's no api, it's also part of my question, do you recommend any 
specific api to connect a web2py server (SYS) to a remote non-web2py MySql 
server (SERVER)?, I will likely have remote access to the computer where 
MySQL runs, but I have no idea how to configure such server to accept 
remote connections to execute remote SQL commands from my web2py SYS server.

Thanks again.

On Saturday, April 21, 2012 1:57:27 PM UTC-5, Bruce Wade wrote:
>
> Hi Carlos,
>
> Thanks for clarifying. 
>
> Do you know how can my web2py server connect remotely to a non-web2py 
> server to execute some SQL commands?
>
> I think you need to think about this at a python level more then a web2py 
> level. web2py uses python which means yes you can connect to whatever 
> non-web2py server that handles network protocols in one way or another. 
>
> Do you want to basically get a request from the client and pass that 
> request to a server/mysql which will determine what to do with the request, 
> return you data and that data is returned back to the client?
>
> How is the non-web2py server listening for connections? Does it already 
> have an api programmed or is that also your task?
>
>
> On Sat, Apr 21, 2012 at 11:20 AM, Carlos  wrote:
>
>> Hi Bruce,
>>
>> Thanks, but that's not the case.
>>
>> My web2py system is already a complete cloud SaaS server, with a single 
>> postgresql db, multi-tenancy, multi-apps, single-sign-on, etc.
>>
>> And one potential customer (tenant), who will use all the other apps in 
>> the cloud, requires this new scenario/app where my system handles web 
>> services requests from an external non-web2py system (named CLIENT) and 
>> collects the respective data from another external non-web2py system (named 
>> SERVER), therefore acting as a middle-server (or so).
>>
>> All 3 systems (my own cloud SaaS SYS, and CLIENT, and SERVER) are 
>> completely independent (with no relation whatsoever).
>>
>> Thanks,
>>
>>Carlos
>>
>>
>> On Saturday, April 21, 2012 1:08:55 PM UTC-5, Bruce Wade wrote:
>>>
>>> From what you explained it sounds like you just want:
>>> 1) Independent database server
>>> 2) Web2py to handle requests via a service
>>> 3) Javascript to connect to a web2py service using ajax and or sockets
>>>
>>> If that is what you are asking it web2py can handle that simply if that 
>>> is not what you are suggesting then I am not sure, and need more details.
>>>
>>> On Sat, Apr 21, 2012 at 11:02 AM, Carlos wrote:
>>>
 Hi,

 My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.

 Following are some requirements for my new potential project (where SYS 
 is my web2py system, and CLIENT and SERVER are two completely different / 
 independent non-web2py remote servers):

 (for each web services call ...)

 + CLIENT initiates the communication to SYS via web services to request 
 some data.

 + during this same connection (in real time), SYS connects to the 
 remote SERVER to execute some SQL commands (in a MySQL database) and get 
 the requested data.

 + finally SYS responds to CLIENT with the data.

 In summary, SYS will act as the middle-man between CLIENT and SERVER.

 Questions:

 Is this doable?, should I be aware of any issues that might arise?, 
 concurrency, others?.

 Do you recommend other ways to accomplish this?.

 Do you know how can my web2py server connect remotely to a non-web2py 
 server to execute some SQL commands?.

 Will SYS have enough time for this process to complete on each web 
 service call?.

 I would just like to know your general (or specific) recommendations 
 about this scenario.

 Thanks!,

Carlos


>>>
>>>
>>> -- 
>>> -- 
>>> Regards,
>>> Bruce Wade
>>> http://ca.linkedin.com/in/**brucelwade
>>> http://www.wadecybertech.com
>>> http://www.fittraineronline.**com  - 
>>> Fitness Personal Trainers Online
>>> http://www.warplydesigned.com
>>>
>>>  
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

Re: [web2py] [BUG in w2p book] Re: a web2py powered shop (solution)

2012-04-21 Thread Bruce Wade
Yes I did ALL the back end development on this site. Had a frontend guy
help with the graphics and front-end code.

As for the modal window:
http://archive.plugins.jquery.com/project/jquery-lightbox-clone-prettyPhoto
http://designresourcebox.com/prettyphoto-jquery-lightbox/

On Sat, Apr 21, 2012 at 6:34 PM, Kenny Chung  wrote:

> Nice. Is this website urs? How can I open modal window like tos on this
> website?
> On Apr 21, 2012 6:20 PM, "Bruce Wade"  wrote:
>
>> http://96.126.99.73/ register use sponsor id 12. Under products is a
>> kind of shopping card that allows you to buy projects using paypal, alipay
>> or ucash. You can also cancel orders
>>
>> On Sat, Apr 21, 2012 at 12:27 PM, Tim Michelsen <
>> timmichel...@gmx-topmail.de> wrote:
>>
>>>  Is there such a snippet/plugin already existing?

>>> BTW: the recipies on
>>> http://web2py.com/books/**default/chapter/29/14?search=**
>>> payment#Accepting-credit-card-**payments
>>>
>>> are not working.
>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.com - Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: db date not required

2012-04-21 Thread Marco Mansilla
another approach might be

default=request.now, writable=False, readable=False

> requires=IS_EMPTY_OR(IS_DATE()))
> 
> On Saturday, 21 April 2012 23:03:40 UTC+1, BlueShadow wrote:
> >
> > When I make a database table with a tate field for some reason it
> > is always required. but I need a date field which you don't have to
> > fill. Someone knows how this works. It would be perfect if it could
> > have the value not known or something similar.
> >


Re: [web2py] [BUG in w2p book] Re: a web2py powered shop (solution)

2012-04-21 Thread Kenny Chung
Nice. Is this website urs? How can I open modal window like tos on this
website?
On Apr 21, 2012 6:20 PM, "Bruce Wade"  wrote:

> http://96.126.99.73/ register use sponsor id 12. Under products is a kind
> of shopping card that allows you to buy projects using paypal, alipay or
> ucash. You can also cancel orders
>
> On Sat, Apr 21, 2012 at 12:27 PM, Tim Michelsen <
> timmichel...@gmx-topmail.de> wrote:
>
>>  Is there such a snippet/plugin already existing?
>>>
>> BTW: the recipies on
>> http://web2py.com/books/**default/chapter/29/14?search=**
>> payment#Accepting-credit-card-**payments
>>
>> are not working.
>>
>>
>
>
> --
> --
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>


Re: [web2py] [BUG in w2p book] Re: a web2py powered shop (solution)

2012-04-21 Thread Bruce Wade
http://96.126.99.73/ register use sponsor id 12. Under products is a kind
of shopping card that allows you to buy projects using paypal, alipay or
ucash. You can also cancel orders

On Sat, Apr 21, 2012 at 12:27 PM, Tim Michelsen  wrote:

> Is there such a snippet/plugin already existing?
>>
> BTW: the recipies on
> http://web2py.com/books/**default/chapter/29/14?search=**
> payment#Accepting-credit-card-**payments
>
> are not working.
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Re: Record-level access authorization question

2012-04-21 Thread Anthony

>
> I'm a little puzzled by the common_filter syntax.  It looks a 
>> common_filter must be a function that takes a single argument, query, and 
>> returns a query that, in the book examples at least, doesn't reference the 
>> argument.  I'm guessing that the argument is the query that would be 
>> executed if the common_filter was None, right?  So does is the query that 
>> gets finally executed equivalent to db(query & common_filter) ?
>>
>
Yes, that's basically it, though it will add the common_filter query for 
all tables involved in the select. See 
http://code.google.com/p/web2py/source/browse/gluon/dal.py#1255 and 
http://code.google.com/p/web2py/source/browse/gluon/dal.py#1720 to see 
what's happening. In the for loop, the current query is always passed to 
the common_filter function -- I'm not sure what use case that is supposed 
to support, but obviously you can just ignore it in your function.

Anthony  


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Stefaan Himpe



This new look that Google Groups has implemented is seriously
debilitating


+200




Re: [web2py] Re: Record-level access authorization question

2012-04-21 Thread Michael Ellis
On Sat, Apr 21, 2012 at 7:31 PM, Anthony  wrote:

> def circuit_filter(query):
>>  """
>>  Allow only records where auth_user matches the organization, site or
>> building that owns
>>  the system that owns this circuit.
>>  """
>>  eml =  auth.user.email
>>  sys =  db.t_circuit.f_system
>>  bldg = sys.f_building
>>  site =  bldg.f_site
>>  org =  site.f_organization
>>  filter = ((bldg.f_contact_email == eml) |
>>(site.f_contact_email == eml)  |
>>(org.f_contact_email == eml))
>>  return filter
>>
>> Does that look right?
>>
>
> Not quite -- in the above you are appending fields to other fields (e.g.,
> sys.f_building is equivalent to db.t_circuit.f_system.f_building, which
> doesn't work). I think you may need to join all the tables in the hierarchy
> above the table being queried (i.e., db.t_circuit.f_system==db.t_system.id,
> etc.) and then test whether auth.email matches the email field in any of
> the joined tables.
>
> Anthony
>

Thanks. I'm never quite sure what the DAL will let me get away with :-)

I'm a little puzzled by the common_filter syntax.  It looks a common_filter
must be a function that takes a single argument, query, and returns a query
that, in the book examples at least, doesn't reference the argument.  I'm
guessing that the argument is the query that would be executed if the
common_filter was None, right?  So does is the query that gets finally
executed equivalent to db(query & common_filter) ?


Re: [web2py] Re: Record-level access authorization question

2012-04-21 Thread Anthony

>
> def circuit_filter(query):
>  """
>  Allow only records where auth_user matches the organization, site or 
> building that owns 
>  the system that owns this circuit.
>  """
>  eml =  auth.user.email
>  sys =  db.t_circuit.f_system
>  bldg = sys.f_building
>  site =  bldg.f_site
>  org =  site.f_organization
>  filter = ((bldg.f_contact_email == eml) | 
>(site.f_contact_email == eml)  | 
>(org.f_contact_email == eml))
>  return filter
>
> Does that look right?
>

Not quite -- in the above you are appending fields to other fields (e.g., 
sys.f_building is equivalent to db.t_circuit.f_system.f_building, which 
doesn't work). I think you may need to join all the tables in the hierarchy 
above the table being queried (i.e., db.t_circuit.f_system==db.t_system.id, 
etc.) and then test whether auth.email matches the email field in any of 
the joined tables.

Anthony


[web2py] Re: db date not required

2012-04-21 Thread simon
requires=IS_EMPTY_OR(IS_DATE()))

On Saturday, 21 April 2012 23:03:40 UTC+1, BlueShadow wrote:
>
> When I make a database table with a tate field for some reason it is 
> always required. but I need a date field which you don't have to fill.
> Someone knows how this works. It would be perfect if it could have the 
> value not known or something similar.
>


[web2py] Re: Image tutorial error multiple databases

2012-04-21 Thread Cody Goodman
it seems that the answer is to not use db(), but use:

name_of_dal_object(name_of_dal_object.table).select()



[web2py] Re: Image tutorial error multiple databases

2012-04-21 Thread Massimo Di Pierro
The problem is that this:

print db(images_db.image).select()

should be

print images_db(images_db.image).select()

because you cannot have a query involving a table sent to database that 
does not have the table.

You can also check with

>>> 'images_db' in db.tables()
False

>>> 'images_db' in images_db.tables()
True



On Saturday, 21 April 2012 16:59:41 UTC-5, Cody Goodman wrote:
>
> For my project, I need to connect to multiple databases and get 
> information from them. I didn't think this would be a problem with web2py, 
> but it was. I thought maybe I need to rebuild the db from scratch, but 
> still had problems. Finally, I went through the introductory 'images' 
> tutorial and changed it to use an alternate mysql database. I still got the 
> same errors, below is the code:
>
> *db.py*
> db = DAL("mysql://root:@localhost/web2py")
> images_db = DAL("mysql://root:@localhost/images_test")
>
>
> images_db.define_table('image',
>Field('title', unique=True),
>Field('file', 'upload'),
>format = '%(title)s')
>
>
> images_db.define_table('comment',
>Field('image_id', images_db.image),
>Field('author'),
>Field('email'),
>Field('body', 'text'))
>
>
>
>
> Then I went to the admin page for 'images' and clicked the 'shell' link 
> under 'controllers' and did the following: (after I went to the index page 
> to generate the 'images':
>
> In [1] : print db(images_db.image).select()
> Traceback (most recent call last):
>   File "/home/cody/Downloads/web2py/gluon/contrib/shell.py", line 233, inrun
> exec compiled in statement_module.__dict__
>   File "", line 1, in 
>   File "/home/cody/Downloads/web2py/gluon/dal.py", line 7577, in select
> fields = adapter.expand_all(fields, adapter.tables(self.query))
>   File "/home/cody/Downloads/web2py/gluon/dal.py", line 1172, inexpand_all
> for field in self.db[table]:
>   File "/home/cody/Downloads/web2py/gluon/dal.py", line 6337, in__getitem__
> return dict.__getitem__(self, str(key))
> KeyError: 'image'
>
>
> In [2] : print images_db.has_key('image')
> True
>
>
> In [3] : print images_db
>  sql_mode='NO_BACKSLASH_ESCAPES';", '_db_codec': 'UTF-8', '_timings': [('SET 
> FOREIGN_KEY_CHECKS=1;', 0.00017380714416503906), ("SET 
> sql_mode='NO_BACKSLASH_ESCAPES';", 0.00016808509826660156)], 
> '_fake_migrate': False, '_dbname': 'mysql', '_request_tenant': 
> 'request_tenant', '_adapter':  >, '_tables': ['image', 'comment'], '_pending_references': {}, 
> '_fake_migrate_all': False, 'check_reserved': None, '_uri': 
> 'mysql://root:@localhost/images_test', 'comment':  dal.Field object at 0x2b844d0>, 'ALL':  0x2b84090>, '_fields': ['id', 'image_id', 'author', 'email', 'body'], 
> '_sequence_name': 'comment_sequence', '_plural': 'Comments', 'author': <
> gluon.dal.Field object at 0x2b84e10>, '_referenced_by': [], '_format': 
> None, '_db': , '_dbt': 
> 'applications/images/databases/e1e448013737cddc822e303fe20f8bec_comment.table'
> , 'email': , '_trigger_name': 
> 'comment_sequence', 'image_id': , 
> '_actual': True, '_singular': 'Comment', '_tablename': 'comment', 
> '_common_filter': None, 'virtualfields': [], '_id':  object at 0x2b84110>, 'id': , 
> '_loggername': 'applications/images/databases/sql.log'}>, 'image':  {'ALL': , '_fields': ['id', 'title', 
> 'file'], '_sequence_name': 'image_sequence', 'file':  object at 0x2b847d0>, '_plural': 'Images', 'title':  object at 0x2b84610>, '_referenced_by': [('comment', 'image_id')], 
> '_format': '%(title)s', '_db': , '_dbt': 
> 'applications/images/databases/e1e448013737cddc822e303fe20f8bec_image.table'
> , '_trigger_name': 'image_sequence', '_loggername': 
> 'applications/images/databases/sql.log', '_actual': True, '_tablename': 
> 'image', '_common_filter': None, 'virtualfields': [], '_id':  Field object at 0x2b848d0>, 'id': , 
> '_singular': 'Image'}>, '_referee_name': '%(table)s', '_migrate': True, 
> '_pool_size': 0, '_common_fields': [], '_uri_hash': 
> 'e1e448013737cddc822e303fe20f8bec'}>
>
>
> Now I don't quite understand why I am getting errors here, everything 
> appears to be in order. I thought web2py supported multiple databases? Am I 
> doing it wrong? The appadmin works fine, perhaps I'll edit it and get it to 
> raise an error with the code it's generating... any help would be 
> appreciated.
>
> - Cody
>
>
> UPDATE:
>
> I just tried this:
>
> *MODELS/DB.PY*
> db = DAL("mysql://root:@localhost/web2py")
>
> images_db = DAL("mysql://root:@localhost/images_test")
>
>
> images_db.define_table('image',
>Field('title', unique=True),
>Field('file', 'upload'),
>format = '%(title)s')
>
>
> images_db.define_table('comment',
>Field('image_id', images_db.image),
>Field('author'),
>Field('email'),
>Field('body', 'text'))
>
>
> *CONTROLLERS/DEFAULT.PY*
> def index():
> """
> example action using the internationalization operator T and flash
> rendered by views/default/index.html or views/generic.html
> """
> if images_db.has_key('image'):
>  

[web2py] Re: Uploaded csv to matrix

2012-04-21 Thread Massimo Di Pierro
record  =db.mytable(id)
originalfilename, stream  = db.mytable.myfield.retrieve(record.myfield) 
data = stream.read()

where myfield must be of upload type

On Saturday, 21 April 2012 12:48:14 UTC-5, Daniel Kaplan wrote:
>
>
> I'm a new user of Python/web2py working on a scientific application. I've 
> created a model of a table with a field of type 'upload' that will accept a 
> csv file. Inside this csv file are comma separated floats, and there are 
> several rows of numbers. 
>
> Example: 
>
> 100, 200, 300
> 1.2, 1.5, 1.6
>
> From the controller, I want to get access to this csv file, parse the data 
> such that the end result is a numeric matrix, and be able to manipulate the 
> numbers in numpy or use them in matploblib. How can I do this?



[web2py] Re: Image tutorial error multiple databases

2012-04-21 Thread Cody Goodman
also tried the alternate syntax for getting info from the db:

In [10] : print db(db.images_db.image).select()
Traceback (most recent call last):
  File "/home/cody/Downloads/web2py/gluon/contrib/shell.py", line 233, in 
run
exec compiled in statement_module.__dict__
  File "", line 1, in 
  File "/home/cody/Downloads/web2py/gluon/dal.py", line 6343, in __getattr__
return self[key]
  File "/home/cody/Downloads/web2py/gluon/dal.py", line 6337, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'images_db'
In [11] : print db.has_key('images_db')
False


So I know 'db' doesn't have the key 'images_db'... so I suspect that is not 
the correct way to query that database for objects.


[web2py] db date not required

2012-04-21 Thread BlueShadow
When I make a database table with a tate field for some reason it is always 
required. but I need a date field which you don't have to fill.
Someone knows how this works. It would be perfect if it could have the 
value not known or something similar.


Re: [web2py] Re: Record-level access authorization question

2012-04-21 Thread Michael Ellis
Awesome! Thanks Anthony, I think that's precisely the solution I was hoping
existed.  The login issue should not be a problem since I already have
@auth.requires('login') in front of every controller function.

So if I'm understanding common filters correctly, the common_filter on my
t_circuits table will need to be something like

def circuit_filter(query):
 """
 Allow only records where auth_user matches the organization, site or
building that owns
 the system that owns this circuit.
 """
 eml =  auth.user.email
 sys =  db.t_circuit.f_system
 bldg = sys.f_building
 site =  bldg.f_site
 org =  site.f_organization
 filter = ((bldg.f_contact_email == eml) |
   (site.f_contact_email == eml)  |
   (org.f_contact_email == eml))
 return filter

Does that look right?



On Sat, Apr 21, 2012 at 5:10 PM, Anthony  wrote:

> http://web2py.com/books/default/chapter/29/6#Common-filters


[web2py] Re: Record-level access authorization question

2012-04-21 Thread Anthony
How about using the common filter functionality: 
http://web2py.com/books/default/chapter/29/6#Common-filters

db.define_table('t_site',
Field('f_contact_email_string', type='string',
  label=T('Email')),
Field('f_organization', type='reference t_organization', notnull = True,
  label=T('Organization')),
common_filter = lambda query: db.t_site.f_contact_email_string == auth.
user.email,
migrate=settings.migrate)

So, when you select from the t_site table, it will only pull records where 
the f_contact_email_string matches the email of the current logged in user. 
You could add similar filters to the other table definitions.

Note, as is, the query will produce an error when the user is not logged in 
because auth.user.email will not exist in that case -- so if queries are 
ever run for non-logged in users, you'll need to accommodate that case.

Anthony


Re: [web2py] Record-level access authorization question

2012-04-21 Thread Michael Ellis
Thanks Khalil, but I'm not sure how that solves my problem.  I want, if 
possible, to automate a filtering operation that will apply to every query 
and exclude records the user is not allowed to see based on where his email 
address appears in the organization --> site --> building  hierarchy.  The 
important thing is that I'm not so much restricting access to pages 
(controllers), which is the usual effect of auth.requires() decorators. 
 It's more like trying to confine the user  to a sub-tree of records where 
the root of the sub-tree is a record in one of the three top-level tables 
-- if that makes any sense.   

I suppose one way to go about would be to post-filter the set of records 
just before they are passed to the view, but I suspect that finding a way 
to AND the conditions with the query would give better performance.

On Saturday, April 21, 2012 1:32:05 PM UTC-4, Khalil KHAMLICHI wrote:
>
> Create a custom field called "site" in auth_user table and when 
> registering a new user give him his affected site, for any page user will 
> view make sure you check for this value in you queries.
>  


Multilingual Web Addresses (Was: Re: [web2py] Re: process args)

2012-04-21 Thread Ricardo Pedroso
>> # my url is looking like that "25-еннщшо ор зьлыв"

> I don't think you can have those characters in a URL. And URL's should not
> have spaces.

I think it's already possible to have those chars in urls, even in the
domain part.

Does anyone here use chars in urls, outside of the ascii set?
Is it problematic?

Check: http://www.w3.org/International/articles/idn-and-iri/

The following one  is a user agent test page where you will
find this url http://点心和烤鸭.w3.mag.keio.ac.jp

http://www.w3.org/International/tests/sec-idn-1

Anyone knows how widely is this supported?

Ricardo


[web2py] [BUG in w2p book] Re: a web2py powered shop (solution)

2012-04-21 Thread Tim Michelsen

Is there such a snippet/plugin already existing?

BTW: the recipies on
http://web2py.com/books/default/chapter/29/14?search=payment#Accepting-credit-card-payments

are not working.



[web2py] a web2py powered shop (solution)

2012-04-21 Thread Tim Michelsen

Hello,
I am thinking of a project where I need the integration of a web shop or 
payment functionalities.


Is there such a snippet/plugin already existing?

Can you point me to a website build with W2P where I could look for some 
inspiration?


Thanks and regards,
Timmie




Re: [web2py] error shown by running application

2012-04-21 Thread Bruce Wade
http://docs.python.org/library/exceptions.html#exceptions.NameError

On Sat, Apr 21, 2012 at 12:09 PM, Sonu Srivastava <
sonu.srivast...@zero-group.com> wrote:

> when i am running my application this error is shown...how to remove this
> error
>
>  name 'middle_columns' is not defined




-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] error shown by running application

2012-04-21 Thread Sonu Srivastava
when i am running my application this error is shown...how to remove this 
error

 name 'middle_columns' is not defined

Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Bruce Wade
lol I wanted to ask that same questions very badly but held back. Also
point out that I have never seen any website state they have to provide the
ability to use a old design if you don't like the new design.

On Sat, Apr 21, 2012 at 11:52 AM, Anthony  wrote:

> That was another thing that got me going on this subject. I was thinking
>> that Google is using me as a Tester without paying me, by not letting me
>> revert.
>>
>
> Why should they pay you to use their free service?
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Bruce Wade
Hi Carlos,

Thanks for clarifying.

Do you know how can my web2py server connect remotely to a non-web2py
server to execute some SQL commands?

I think you need to think about this at a python level more then a web2py
level. web2py uses python which means yes you can connect to whatever
non-web2py server that handles network protocols in one way or another.

Do you want to basically get a request from the client and pass that
request to a server/mysql which will determine what to do with the request,
return you data and that data is returned back to the client?

How is the non-web2py server listening for connections? Does it already
have an api programmed or is that also your task?


On Sat, Apr 21, 2012 at 11:20 AM, Carlos  wrote:

> Hi Bruce,
>
> Thanks, but that's not the case.
>
> My web2py system is already a complete cloud SaaS server, with a single
> postgresql db, multi-tenancy, multi-apps, single-sign-on, etc.
>
> And one potential customer (tenant), who will use all the other apps in
> the cloud, requires this new scenario/app where my system handles web
> services requests from an external non-web2py system (named CLIENT) and
> collects the respective data from another external non-web2py system (named
> SERVER), therefore acting as a middle-server (or so).
>
> All 3 systems (my own cloud SaaS SYS, and CLIENT, and SERVER) are
> completely independent (with no relation whatsoever).
>
> Thanks,
>
>Carlos
>
>
> On Saturday, April 21, 2012 1:08:55 PM UTC-5, Bruce Wade wrote:
>>
>> From what you explained it sounds like you just want:
>> 1) Independent database server
>> 2) Web2py to handle requests via a service
>> 3) Javascript to connect to a web2py service using ajax and or sockets
>>
>> If that is what you are asking it web2py can handle that simply if that
>> is not what you are suggesting then I am not sure, and need more details.
>>
>> On Sat, Apr 21, 2012 at 11:02 AM, Carlos  wrote:
>>
>>> Hi,
>>>
>>> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
>>>
>>> Following are some requirements for my new potential project (where SYS
>>> is my web2py system, and CLIENT and SERVER are two completely different /
>>> independent non-web2py remote servers):
>>>
>>> (for each web services call ...)
>>>
>>> + CLIENT initiates the communication to SYS via web services to request
>>> some data.
>>>
>>> + during this same connection (in real time), SYS connects to the remote
>>> SERVER to execute some SQL commands (in a MySQL database) and get the
>>> requested data.
>>>
>>> + finally SYS responds to CLIENT with the data.
>>>
>>> In summary, SYS will act as the middle-man between CLIENT and SERVER.
>>>
>>> Questions:
>>>
>>> Is this doable?, should I be aware of any issues that might arise?,
>>> concurrency, others?.
>>>
>>> Do you recommend other ways to accomplish this?.
>>>
>>> Do you know how can my web2py server connect remotely to a non-web2py
>>> server to execute some SQL commands?.
>>>
>>> Will SYS have enough time for this process to complete on each web
>>> service call?.
>>>
>>> I would just like to know your general (or specific) recommendations
>>> about this scenario.
>>>
>>> Thanks!,
>>>
>>>Carlos
>>>
>>>
>>
>>
>> --
>> --
>> Regards,
>> Bruce Wade
>> http://ca.linkedin.com/in/**brucelwade
>> http://www.wadecybertech.com
>> http://www.fittraineronline.**com  -
>> Fitness Personal Trainers Online
>> http://www.warplydesigned.com
>>
>>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Anthony

>
> That was another thing that got me going on this subject. I was thinking 
> that Google is using me as a Tester without paying me, by not letting me 
> revert.
>

Why should they pay you to use their free service?


[web2py] Re: Adding permissions upon registration

2012-04-21 Thread Anthony

>
> the verification email is sent before the 
> register_onaccept
>  callback, so if anything goes wrong during the callback (which I would 
> still consider part of the registration process), the verification email 
> will be sent regardless. I wonder if this would cause problem in some 
> applications...   
>

I see your point. It's tricky, though, because in some cases the callback 
might involve a redirect, which would then circumvent the email send and 
the remainder of the auth.register() code. I guess it would be ideal if the 
email send could somehow be wrapped in a transaction, just like the db 
insert, so if there is any error during the request, the email doesn't go 
out, but that would start to get complicated.

Anthony


[web2py] Uploaded csv to matrix

2012-04-21 Thread Daniel Kaplan

I'm a new user of Python/web2py working on a scientific application. I've 
created a model of a table with a field of type 'upload' that will accept a 
csv file. Inside this csv file are comma separated floats, and there are 
several rows of numbers. 

Example: 

100, 200, 300
1.2, 1.5, 1.6

>From the controller, I want to get access to this csv file, parse the data 
such that the end result is a numeric matrix, and be able to manipulate the 
numbers in numpy or use them in matploblib. How can I do this?

Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Carlos
Hi Bruce,

Thanks, but that's not the case.

My web2py system is already a complete cloud SaaS server, with a single 
postgresql db, multi-tenancy, multi-apps, single-sign-on, etc.

And one potential customer (tenant), who will use all the other apps in the 
cloud, requires this new scenario/app where my system handles web services 
requests from an external non-web2py system (named CLIENT) and collects the 
respective data from another external non-web2py system (named SERVER), 
therefore acting as a middle-server (or so).

All 3 systems (my own cloud SaaS SYS, and CLIENT, and SERVER) are 
completely independent (with no relation whatsoever).

Thanks,

   Carlos


On Saturday, April 21, 2012 1:08:55 PM UTC-5, Bruce Wade wrote:
>
> From what you explained it sounds like you just want:
> 1) Independent database server
> 2) Web2py to handle requests via a service
> 3) Javascript to connect to a web2py service using ajax and or sockets
>
> If that is what you are asking it web2py can handle that simply if that is 
> not what you are suggesting then I am not sure, and need more details.
>
> On Sat, Apr 21, 2012 at 11:02 AM, Carlos  wrote:
>
>> Hi,
>>
>> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
>>
>> Following are some requirements for my new potential project (where SYS 
>> is my web2py system, and CLIENT and SERVER are two completely different / 
>> independent non-web2py remote servers):
>>
>> (for each web services call ...)
>>
>> + CLIENT initiates the communication to SYS via web services to request 
>> some data.
>>
>> + during this same connection (in real time), SYS connects to the remote 
>> SERVER to execute some SQL commands (in a MySQL database) and get the 
>> requested data.
>>
>> + finally SYS responds to CLIENT with the data.
>>
>> In summary, SYS will act as the middle-man between CLIENT and SERVER.
>>
>> Questions:
>>
>> Is this doable?, should I be aware of any issues that might arise?, 
>> concurrency, others?.
>>
>> Do you recommend other ways to accomplish this?.
>>
>> Do you know how can my web2py server connect remotely to a non-web2py 
>> server to execute some SQL commands?.
>>
>> Will SYS have enough time for this process to complete on each web 
>> service call?.
>>
>> I would just like to know your general (or specific) recommendations 
>> about this scenario.
>>
>> Thanks!,
>>
>>Carlos
>>
>>
>
>
> -- 
> -- 
> Regards,
> Bruce Wade
> http://ca.linkedin.com/in/brucelwade
> http://www.wadecybertech.com
> http://www.fittraineronline.com - Fitness Personal Trainers Online
> http://www.warplydesigned.com
>
>  

Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Jonathan Lundell
On Apr 21, 2012, at 11:02 AM, Carlos wrote:
> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
> 
> Following are some requirements for my new potential project (where SYS is my 
> web2py system, and CLIENT and SERVER are two completely different / 
> independent non-web2py remote servers):
> 
> (for each web services call ...)
> 
> + CLIENT initiates the communication to SYS via web services to request some 
> data.
> 
> + during this same connection (in real time), SYS connects to the remote 
> SERVER to execute some SQL commands (in a MySQL database) and get the 
> requested data.
> 
> + finally SYS responds to CLIENT with the data.
> 
> In summary, SYS will act as the middle-man between CLIENT and SERVER.
> 
> Questions:
> 
> Is this doable?, should I be aware of any issues that might arise?, 
> concurrency, others?.
> 
> Do you recommend other ways to accomplish this?.
> 
> Do you know how can my web2py server connect remotely to a non-web2py server 
> to execute some SQL commands?.
> 
> Will SYS have enough time for this process to complete on each web service 
> call?.
> 
> I would just like to know your general (or specific) recommendations about 
> this scenario.
> 

It can work well, but there are some performance issues to consider. Your SYS 
application will have to set up a new connection to SERVER for each request, 
and this might or might not be expensive. Web2py itself implements this kind of 
architecture (where SERVER is the database server), but it goes to considerable 
lengths with connection pooling to reduce the overhead of repeated 
reconnections.

I've used this kind of architecture for a couple of apps, where CLIENT is a 
mobile device and SERVER is some third-party service (geolocation, video 
meta-data) that the CLIENT needs mediated access to. In both cases, the calls 
to SERVER are lightweight JSON-RPC requests, and I use caching where possible 
to reduce the need for calls to SERVER.

Re: [web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Bruce Wade
>From what you explained it sounds like you just want:
1) Independent database server
2) Web2py to handle requests via a service
3) Javascript to connect to a web2py service using ajax and or sockets

If that is what you are asking it web2py can handle that simply if that is
not what you are suggesting then I am not sure, and need more details.

On Sat, Apr 21, 2012 at 11:02 AM, Carlos  wrote:

> Hi,
>
> My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.
>
> Following are some requirements for my new potential project (where SYS is
> my web2py system, and CLIENT and SERVER are two completely different /
> independent non-web2py remote servers):
>
> (for each web services call ...)
>
> + CLIENT initiates the communication to SYS via web services to request
> some data.
>
> + during this same connection (in real time), SYS connects to the remote
> SERVER to execute some SQL commands (in a MySQL database) and get the
> requested data.
>
> + finally SYS responds to CLIENT with the data.
>
> In summary, SYS will act as the middle-man between CLIENT and SERVER.
>
> Questions:
>
> Is this doable?, should I be aware of any issues that might arise?,
> concurrency, others?.
>
> Do you recommend other ways to accomplish this?.
>
> Do you know how can my web2py server connect remotely to a non-web2py
> server to execute some SQL commands?.
>
> Will SYS have enough time for this process to complete on each web service
> call?.
>
> I would just like to know your general (or specific) recommendations about
> this scenario.
>
> Thanks!,
>
>Carlos
>
>


-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread JoeCodeswell
Dear Jonathan,

Thanks for the reply. When i was perusing Google Help, i saw that some 
still had the ability to revert and others did NOT. 

That was another thing that got me going on this subject. I was thinking 
that Google is using me as a Tester without paying me, by not letting me 
revert. I'm sure there's something that covers them in the usage agreement, 
but it did bug me when i heard that the ability to revert is selective.

Thanks again, Jonathan.

Love and peace,

Joe

On Saturday, April 21, 2012 10:55:40 AM UTC-7, Jonathan Lundell wrote:
>
> On Apr 21, 2012, at 10:44 AM, JoeCodeswell wrote:
>
> Good point, lots of work - spam, etc.. I tried to find out how to revert, 
> but when i click on the Google Groups Gear icon, where there WAS a revert 
> option before, it has now disappeared. At least one page i went to in 
> Google help said it is NOT possible to revert anymore. I have sent a couple 
> of messages to Google on this subject - to no avail. Do you have any 
> suggestions about reversion?
>
>
> Yeah, it does seem to be going away for some people (I still see the 
> option). 
>
> See if you see an option to revert on this page: 
> https://groups.google.com/forum/?fromgroups#!overview
>
> I found the gray theme and compact listing an improvement, fwiw. Though I 
> mostly read the group through email.
>


[web2py] web2py as middle-server between 2 remote servers via web services

2012-04-21 Thread Carlos
Hi,

My environment: latest web2py trunk, ubuntu, postgresql, nginx, uwsgi.

Following are some requirements for my new potential project (where SYS is 
my web2py system, and CLIENT and SERVER are two completely different / 
independent non-web2py remote servers):

(for each web services call ...)

+ CLIENT initiates the communication to SYS via web services to request 
some data.

+ during this same connection (in real time), SYS connects to the remote 
SERVER to execute some SQL commands (in a MySQL database) and get the 
requested data.

+ finally SYS responds to CLIENT with the data.

In summary, SYS will act as the middle-man between CLIENT and SERVER.

Questions:

Is this doable?, should I be aware of any issues that might arise?, 
concurrency, others?.

Do you recommend other ways to accomplish this?.

Do you know how can my web2py server connect remotely to a non-web2py 
server to execute some SQL commands?.

Will SYS have enough time for this process to complete on each web service 
call?.

I would just like to know your general (or specific) recommendations about 
this scenario.

Thanks!,

   Carlos



Re: [web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Jonathan Lundell
On Apr 21, 2012, at 10:46 AM, Anthony wrote:
> PS When i tried to submit this post with a tag of "meta", Google Groups told 
> me "only suggested tags can be used".
> 
> We can change that -- currently only admins can add tags, but we could enable 
> community-generated tags as well.
> 

There are arguments on both sides. There are advantages to a small set of tags, 
consistently applied.

[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread JoeCodeswell
Hi Anthony,

Thanks for the reply. I am glad we can make the ability to add our own 
tags. Maybe if the administrators added a "meta" tag, i'd be happy with 
taking the suggestions. Maybe I'll get used to this font. All these things 
happening at once, really set me off. :) At least the AJAX is working now 
and the left panel is staying closed using Opera.

Good to know about posting questions to web2pyslices, but Massimo has 
"dinged" me a little bit for posting to Stack Overflow, if i remember, on 
the basis of keeping things centrally located.

I'm sure Google is getting an earful about the new look. I am also sure 
they'll put every effort into getting things right.

Thanks again, Anthony.

Love and peace,

Joe

On Saturday, April 21, 2012 10:46:41 AM UTC-7, Anthony wrote:
>
> PS When i tried to submit this post with a tag of "meta", Google Groups 
>> told me "only suggested tags can be used". 
>>
>
> We can change that -- currently only admins can add tags, but we could 
> enable community-generated tags as well.
>
> Also, for questions (but not discussions), we already have 
> web2pyslices.com, and some people also post questions on Stack Overflow.
>
> Anthony
>


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Jonathan Lundell
On Apr 21, 2012, at 10:44 AM, JoeCodeswell wrote:
> Good point, lots of work - spam, etc.. I tried to find out how to revert, but 
> when i click on the Google Groups Gear icon, where there WAS a revert option 
> before, it has now disappeared. At least one page i went to in Google help 
> said it is NOT possible to revert anymore. I have sent a couple of messages 
> to Google on this subject - to no avail. Do you have any suggestions about 
> reversion?
> 

Yeah, it does seem to be going away for some people (I still see the option). 

See if you see an option to revert on this page: 
https://groups.google.com/forum/?fromgroups#!overview

I found the gray theme and compact listing an improvement, fwiw. Though I 
mostly read the group through email.

Re: [web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Bruce Wade
The revert to old groups was only temporary the new design is what everyone
needs to use now I believe if not right now then soon it will be the only
option.

On Sat, Apr 21, 2012 at 10:46 AM, Anthony  wrote:

> PS When i tried to submit this post with a tag of "meta", Google Groups
>> told me "only suggested tags can be used".
>>
>
> We can change that -- currently only admins can add tags, but we could
> enable community-generated tags as well.
>
> Also, for questions (but not discussions), we already have
> web2pyslices.com, and some people also post questions on Stack Overflow.
>
> Anthony
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Anthony

>
> PS When i tried to submit this post with a tag of "meta", Google Groups 
> told me "only suggested tags can be used". 
>

We can change that -- currently only admins can add tags, but we could 
enable community-generated tags as well.

Also, for questions (but not discussions), we already have 
web2pyslices.com, and some people also post questions on Stack Overflow.

Anthony


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread JoeCodeswell
Dear Jonathan,

Good point, lots of work - spam, etc.. I tried to find out how to revert, 
but when i click on the Google Groups Gear icon, where there WAS a revert 
option before, it has now disappeared. At least one page i went to in 
Google help said it is NOT possible to revert anymore. I have sent a couple 
of messages to Google on this subject - to no avail. Do you have any 
suggestions about reversion?

Thanks again, Jonathan.

Love and peace,

Joe



On Saturday, April 21, 2012 10:30:22 AM UTC-7, Jonathan Lundell wrote:
>
> On Apr 21, 2012, at 9:24 AM, JoeCodeswell wrote:
>
> This new look that Google Groups has implemented is seriously debilitating 
> for a borderline dyslexic like me. 
>
> Also the AJAX panel sizing is not working on my Chrome/WinXP system. 
>
> Could this be a sign that web2py needs to eat the food it cooks and 
> implement its own web2py-users forum?
>
>
> It's a huge job to do it right; consider just the problem of handling spam.
>
> Notice also that you have the option of reverting to the old Groups 
> interface. 
>


[web2py] ATTENTION before upgrading to trunk....

2012-04-21 Thread Massimo Di Pierro
There is a change in trunk. I replaced 'id' and 'reference' types from INT 
to BIGINT (when supported).
If you have an existing table it should not cause a migration and there is 
an explicit check to avoid a migration that would break tables.
The bottom line is hat new tables are not affected but new tables will have 
the BIGINT.

SQLite does not support BIGINT AUTOINCREMENT therefore nothing happens 
there.

Yet, this needs to be tested with the other DB engines. Make sure you 
backup your data before testing this feature by upgrading to trunk your 
production environment.

massimo
 


Re: [web2py] Record-level access authorization question

2012-04-21 Thread Khalil KHAMLICHI
Create a custom field called "site" in auth_user table and when registering
a new user give him his affected site, for any page user will view make
sure you check for this value in you queries.


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Jonathan Lundell
On Apr 21, 2012, at 9:24 AM, JoeCodeswell wrote:
> This new look that Google Groups has implemented is seriously debilitating 
> for a borderline dyslexic like me. 
> 
> Also the AJAX panel sizing is not working on my Chrome/WinXP system. 
> 
> Could this be a sign that web2py needs to eat the food it cooks and implement 
> its own web2py-users forum?

It's a huge job to do it right; consider just the problem of handling spam.

Notice also that you have the option of reverting to the old Groups interface. 

[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread JoeCodeswell
Dear Annet,

Thanks for the reply. I am now logged in using Opera/WinXP. The left panel 
NOW stays closed so i think that's a Chrome problem. 

However, for me, there is still a readability issue and also there is the 
issue/benefit of eating the food you prepare. 

Of course Google has been a long time benefactor of web2py, so we need to 
respect that and the relationship we want to have with Google going 
forward, given the ease with which web2py can be used on appengine.

Thanks again. for the reply.

Love and peace [to the good folks at Google as well],

Joe

On Saturday, April 21, 2012 9:56:41 AM UTC-7, Annet wrote:
>
> Hi Joe,
>
> I am experiencing scroll problems both Mac OS X Snow Leopard and Lion 
> using Firefox or Safari. resizing the browser window makes the scroll bar 
> behave properly.
>
> Furthermore the text editor is an annoyance, when I copy and paste the 
> contents of an error ticket, resetting the font is just awkward.
>
> Also, when, after typing a message, you delete the rest of the message, 
> the upper part sometimes disappears and I haven't found a way to get it 
> back other then clicking the post reply button, which gives me back the 
> message I just typed.
>
> So, 1+ for a work group based on something more usable.
>
>
> Kind regards,
>
> Annet 
>


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Gour
On Sat, 21 Apr 2012 09:24:32 -0700 (PDT)
JoeCodeswell 
wrote:

> Could this be a sign that web2py needs to eat the food it cooks and 
> implement its own web2py-users forum?

I follow this group using Claws mailer which can read nntp groups - in
this case this newsgroup is available via Gmane (http://gmane.org/)
which I consider much better than web forums.


Sincerely,
Gour

-- 
As fire is covered by smoke, as a mirror is covered by dust, 
or as the embryo is covered by the womb, the living entity is 
similarly covered by different degrees of this lust.

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


signature.asc
Description: PGP signature


[web2py] Re: Continuous Integration

2012-04-21 Thread lpg
HI All I'm doing some research on Continuous Integration for web2py, and 
would really like someone to share their experience with this. Seems like 
it would be an important complement to web2py enterprise deployments. 


On Monday, January 18, 2010 12:39:48 PM UTC-2, Matthew wrote:
>
> Has anyone gotten web2py working with continuous integration tools
> like Hudson, Buildbot, or TeamCity?
>
> I found a post talking about BuildBot,
>
> http://groups.google.com/group/web2py/browse_thread/thread/5fefb19ed2ef8d2d/f9cf313ae3fc9164?lnk=gst&q=buildbot#f9cf313ae3fc9164
> ,
> but it is largely theoretical.
>


[web2py] Re: Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Annet
Hi Joe,

I am experiencing scroll problems both Mac OS X Snow Leopard and Lion using 
Firefox or Safari. resizing the browser window makes the scroll bar behave 
properly.

Furthermore the text editor is an annoyance, when I copy and paste the 
contents of an error ticket, resetting the font is just awkward.

Also, when, after typing a message, you delete the rest of the message, the 
upper part sometimes disappears and I haven't found a way to get it back 
other then clicking the post reply button, which gives me back the message 
I just typed.

So, 1+ for a work group based on something more usable.


Kind regards,

Annet 


[web2py] Re: Adding permissions upon registration

2012-04-21 Thread cyan

>
> Actually, looking at the code, auth.user.id should work as well, unless 
> you have auth.settings.registration_requires_verification = True, in which 
> case, session.auth.user.id won't work either (but form.vars.id will work 
> in either case).
>

I was going to update this post to reflect this, after some testing myself. 
I am indeed using email verification for registration, and I've noticed 
another potential gotcha:

the verification email is sent before the 
register_onaccept
 callback, so if anything goes wrong during the callback (which I would 
still consider part of the registration process), the verification email 
will be sent regardless. I wonder if this would cause problem in some 
applications...   


[web2py] Record-level access authorization question

2012-04-21 Thread Michael Ellis
Given a set of tables in strict hierarchy, e.g.

organization --> site --> building --> system --> circuit

where --> denotes a one-to-many relationship and each of the first 3 tables
contains an email address field, "f_contact_email",  that corresponds to a
registered user,  what's the best way to enforce an application-wide rule
that each user can only access records in his or her hierarchy?

The application is a customer support site for a manufacturer of systems
installed in buildings.  The customer needs to be sure that users can see
only their own data, ie

organization contacts should be able to see sites, buildings, systems, and
circuits that belong to their organization,

site contacts should see only buildings, systems and circuits at their site,

building contacts should see only the systems and circuits in their
building.


Ideally I'd like to enforce this with an auth.requires() decorator on
controller functions, but I can't tell from the book whether this is
possible.  I've appended a stripped down set of tables below for clarity.


db.define_table('t_organization',
Field('f_contact_email_string', type='string',
  label=T('Email')),
migrate=settings.migrate)

db.define_table('t_site',
Field('f_contact_email_string', type='string',
  label=T('Email')),
Field('f_organization', type='reference t_organization', notnull = True,
  label=T('Organization')),
migrate=settings.migrate)

db.define_table('t_building',
Field('f_site', type='reference t_site', notnull=True,
  label=T('Site')),
Field('f_contact_email_string', type='string',
  label=T('Email')),
migrate=settings.migrate)

db.define_table('t_system',
Field('f_serial_string', type='string', unique=True,
  label=T('Serial')),
Field('f_building', type='reference t_building',
  label=T('Building')),
migrate=settings.migrate)

db.define_table('t_circuit',
Field('f_number', type='string', notnull=True, unique=True,
  label=T('Number')),
Field('f_cbsystem', type='reference t_cbsystem',
  label=T('System')),
migrate=settings.migrate)

Thanks,
Mike


Re: [web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread Bruce Wade
"WinXP system" wow, might be time to upgrade ;)

On Sat, Apr 21, 2012 at 9:24 AM, JoeCodeswell wrote:

> This new look that Google Groups has implemented is seriously debilitating
> for a borderline dyslexic like me.
>
> Also the AJAX panel sizing is not working on my Chrome/WinXP system.
>
> Could this be a sign that web2py needs to eat the food it cooks and
> implement its own web2py-users forum?
>
> PS When i tried to submit this post with a tag of "meta", Google Groups
> told me "only suggested tags can be used". I chose "ajax" from "ajax,
> sessions, cache, internationalization". I think this restriction by Google
> Groups might be another reason to be web2py based.
>
> Thanks for any responses.
>
> Love and peace,
>
> Joe
>



-- 
-- 
Regards,
Bruce Wade
http://ca.linkedin.com/in/brucelwade
http://www.wadecybertech.com
http://www.fittraineronline.com - Fitness Personal Trainers Online
http://www.warplydesigned.com


[web2py] Time to move from Google Groups to a web2py or python??

2012-04-21 Thread JoeCodeswell
This new look that Google Groups has implemented is seriously debilitating 
for a borderline dyslexic like me. 

Also the AJAX panel sizing is not working on my Chrome/WinXP system. 

Could this be a sign that web2py needs to eat the food it cooks and 
implement its own web2py-users forum?

PS When i tried to submit this post with a tag of "meta", Google Groups 
told me "only suggested tags can be used". I chose "ajax" from "ajax, 
sessions, cache, internationalization". I think this restriction by Google 
Groups might be another reason to be web2py based.

Thanks for any responses.

Love and peace,

Joe


[web2py] Re: Unexpected exception

2012-04-21 Thread Massimo Di Pierro
I think I have a temporary fix in trunk but only works if single field 
primary keys.

On Saturday, 21 April 2012 09:14:17 UTC-5, haggis wrote:
>
> Same here with latest stable:
>
> Table:
> db.define_table('variable',
> Field('name', type='string', length=255),
> Field('value', type='string', length=255),
> format='%(name)s',
> primarykey=['name'])
>
>
> Traceback:
>
> Traceback (most recent call last):
>   File "/home/haggis/tmp/web2py/gluon/restricted.py", line 205, in restricted
> exec ccode in environment
>   File "/home/haggis/tmp/web2py/applications/test/controllers/appadmin.py" 
> , line 
> 412, in 
>   File "/home/haggis/tmp/web2py/gluon/globals.py", line 173, in 
> self._caller = lambda f: f()
>   File "/home/haggis/tmp/web2py/applications/test/controllers/appadmin.py" 
> , line 
> 126, in insert
> form = SQLFORM(db[table], ignore_rw=ignore_rw)
>   File "/home/haggis/tmp/web2py/gluon/sqlhtml.py", line 772, in __init__
> self.id_field_name = table._id.name
>   File "/home/haggis/tmp/web2py/gluon/dal.py", line 6774, in __getattr__
> return self[key]
>   File "/home/haggis/tmp/web2py/gluon/dal.py", line 6714, in __getitem__
> return dict.__getitem__(self, str(key))
> KeyError: '_id'
>
>
>
>

Re: [web2py] Re: bootstrap in trunk

2012-04-21 Thread Massimo Di Pierro
I cannot reproduce this error. It could be a commit error. I am 
re-committing.

massimo

On Saturday, 21 April 2012 02:54:46 UTC-5, Johann Spies wrote:
>
> On 20 April 2012 22:28, Massimo Di Pierro wrote:
>
>> Do you use a custom search_menu or do you call it explicitly? Yes the API 
>> for this thing have changed (for the better). This was clearly marked in 
>> the book as an experimental feature. If you show us your code, I can tell 
>> you now to adapt it. Yet, without seeing your code I can not 100% sure this 
>> is not a bug.
>>
>
> No own search menu. code except the table_definition and this controller:
>
>
> To test, as I have said, I made a new app with two tables (the second one 
> referring to the firste), populated it and called smartgrid (which worked)  
> and grid (which produced the same error).
>
> Regards
>
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

[web2py] Re: Bootstrap modal and AJAX

2012-04-21 Thread Anthony

>
>
> {{=LOAD('calendar','eventList.load',args=int(organization.nodeID),ajax=True,target='eventlist')}}
>
>
> The eventList view lists all the events and each event has a view details 
> button.
>
>  data-target="#myModal">View Details
>

Have you confirmed that the Ajax request is getting sent and a response 
returned? If so, what is the response (check using the browser developer 
tools)? Is the above "View Details" link inside the LOAD component? If so, 
I think the .load extension of the component may be getting propagated to 
the "View Details" URLs -- if you don't specify an extension in URL(), it 
will use the extension of the current request (which would be .load in this 
case). So, it may be looking for an event.load view and returning an error 
if it doesn't find one (unless you have enabled generic views, in which 
case it would try the generic.load view). Maybe try URL('event.html', 
args=row.id), or change event.html to event.load.

Anthony



[web2py] Re: Cannot insert specific key into table

2012-04-21 Thread haggis
*head -> desk*

I don't know why...but at any time by any case I wrote the following line 
into db.py:

db(db.variable.name=='active_event').delete()

hahaha, sorry for poluting this list! :(


[web2py] Re: HTML Tamplate conversion into web2py

2012-04-21 Thread Anthony
I think you'll have to be more specific -- what are you trying to do? It 
might help if you take a look at 
http://web2py.com/books/default/chapter/29/5#Page-layout, as well as how 
the /views/layout.html and /views/default/index.html view files in the 
"welcome" app work.

Anthony

On Saturday, April 21, 2012 2:18:39 AM UTC-4, Vibhor Purandare wrote:
>
> How to convert html tamplate in web2py??



[web2py] Re: Unexpected exception

2012-04-21 Thread haggis
Same here with latest stable:

Table:
db.define_table('variable',
Field('name', type='string', length=255),
Field('value', type='string', length=255),
format='%(name)s',
primarykey=['name'])


Traceback:

Traceback (most recent call last):
  File "/home/haggis/tmp/web2py/gluon/restricted.py", line 205, in restricted
exec ccode in environment
  File "/home/haggis/tmp/web2py/applications/test/controllers/appadmin.py" 
, line 
412, in 
  File "/home/haggis/tmp/web2py/gluon/globals.py", line 173, in 
self._caller = lambda f: f()
  File "/home/haggis/tmp/web2py/applications/test/controllers/appadmin.py" 
, line 
126, in insert
form = SQLFORM(db[table], ignore_rw=ignore_rw)
  File "/home/haggis/tmp/web2py/gluon/sqlhtml.py", line 772, in __init__
self.id_field_name = table._id.name
  File "/home/haggis/tmp/web2py/gluon/dal.py", line 6774, in __getattr__
return self[key]
  File "/home/haggis/tmp/web2py/gluon/dal.py", line 6714, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: '_id'





[web2py] HTML Tamplate conversion into web2py

2012-04-21 Thread Vibhor Purandare
How to convert html tamplate in web2py??

[web2py] Re: Cannot insert specific key into table

2012-04-21 Thread haggis
Moved my application to a brand new web2py (latest stable) folder but it 
still doesn't work. I'm wondering about that because I used "active_event" 
all the time. If I have to use another name for that key, then I have to 
rewrite some code. That would be ok - but as long as I don't know why this 
mysterious thing happens I'm afraid that this will happen later again (in 
production?).

So please, if you don't know the answer, give me some advice where I have 
to look into. Do you need any additional information?


Re: [web2py] Re: What would be the best way to generate a summary of the 'count(*) 'of all my database table columns?

2012-04-21 Thread Cody Goodman
Well I tried that, and it gave me:

In [2] : db(db.legacy_db.table).select()
Traceback (most recent call last):
  File "/opt/web-apps/web2py/gluon/contrib/shell.py", line 233, in run
exec compiled in statement_module.__dict__
  File "", line 1, in 
  File "/opt/web-apps/web2py/gluon/dal.py", line 6343, in __getattr__
return self[key]
  File "/opt/web-apps/web2py/gluon/dal.py", line 6337, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'legacy_db

I believe that the DAL doesn't like how my database is made, so I'm just 
going to rebuild it with the ORM in web2py.'

On Friday, April 20, 2012 3:26:07 PM UTC-5, Khalil KHAMLICHI wrote:
>
> db(db.legacy-db.table).select()
>
> I think you are forgetting "db." in front of table name.
>  


[web2py] how can one replace an element in html?

2012-04-21 Thread simon
I have some html in which I want to replace some tags. I can change the 
attributes of a tag using elements but I cannot see any way to actually 
replace the tag. I want something similar to this code (which does not work 
but shows what I am trying to do)

taghtml=TAG(html)
pagebreaks=taghtml.elements('br[style=page-break-before:always]')
for elem in pagebreaks:
  elem=DIV(_style='page-break-before:always')

I have also tried extracting the tag as a string and then doing string 
replace on the original html but that does not work either as the string is 
changed by the process e.g. putting double quotes around attribute values.


[web2py] Re: computed field

2012-04-21 Thread Annet
Thank you both for your replies. I'll give your solutions a try and see 
which one best suits my needs.

Kind regards,

Annet


[web2py] Bootstrap modal and AJAX

2012-04-21 Thread Annet
I have two functions:

def eventList():
response.view='calendar/eventList.html'
rows=db(...).select()
return dict(rows=rows)

def event():
response.view='calendar/event.html'

row=db(db.EventList.id==request.args(0)).select(db.EventList.ALL).first()
return dict(row=row)


I have a view index.html with the following JavaScript:



  $("a[data-toggle=modal]").click(function (e) {
  target = $(this).attr('data-target')
  url = $(this).attr('href')
  $(target).load(url)
  })




... and the eventList embedded in a tab and called in a tab-pane:

{{=LOAD('calendar','eventList.load',args=int(organization.nodeID),ajax=True,target='eventlist')}}


The eventList view lists all the events and each event has a view details 
button.

View Details

 When the user clicks this button I would like the event to open in a modal 
window. For this purpose the eventList view contains this target div:



Furthermore I have a view called event.html:


  ×
  {{=row.summary}}
  
{{=db.EventList.startDate.formatter(row.startDate)}}
{{if row.endDate:}} - {{=db.EventList.endDate.formatter(row.endDate)}} 
{{pass}}
  


  {{=row.description}}


  Close



When I click the View Details button, just an empty backdrop element 
appears. When I put static content in the target div:


Hello, world


... and click the button, Hello, world, is being displayed in a modal. 
However, I don't get it to work, loading an external element.

I hope one of you has an idea of how to get this to work.


Kind regards,

Annet






Re: [web2py] Re: bootstrap in trunk

2012-04-21 Thread Johann Spies
On 20 April 2012 22:28, Massimo Di Pierro wrote:

> Do you use a custom search_menu or do you call it explicitly? Yes the API
> for this thing have changed (for the better). This was clearly marked in
> the book as an experimental feature. If you show us your code, I can tell
> you now to adapt it. Yet, without seeing your code I can not 100% sure this
> is not a bug.
>

No own search menu. code except the table_definition and this controller:


To test, as I have said, I made a new app with two tables (the second one
referring to the firste), populated it and called smartgrid (which worked)
and grid (which produced the same error).

Regards

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