[web2py] Upgrading web2py 1.99.7 to 2.3.2 on ubuntu

2013-02-07 Thread at
Hi,

Currenty we are usnig web2py (1.99.7) + apache + ssl + mod_wsgi + 
postgresql on ubuntu on production and development servers.
Before we upgrade to latest stable version i.e. 2.3.2 on production, we 
want to run both old and latest versions side-by-side on development 
servers. What should be the best and clean way to accomplish it?

Thanks,
AT

-- 

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




[web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2013-02-07 Thread dederocks
Hello, 

I have setup nginx & uwsgi on lubuntu with the script and it works great 
(best server ever!), except for a part of my application that requires 
multi threads. I have changed the /etc/uwsgi/web2py.xml to enable threads, 
tried to set each worker with 2 threads, set the thread memory stack to 
512, it doesn't work: I quickly get a 'resource not available (error 11)' 
message.

Anyone has a tip on what I could work on to make this work? Because 
otherwise the application works fine with rocket / gevent for example.

Thanks, 

Andre

Le mercredi 12 décembre 2012 00:06:16 UTC+1, Niphlod a écrit :
>
> I run uwsgi using the emperor mode for some time now based on my 
> config I tried to upgrade the existing one. Result is available at 
> https://www.dropbox.com/s/n7chteos9sh6p2h/setup-web2py-nginx-uwsgi-ubuntu.sh
>
> I'm looking forward to improve things both on uwsgi niceties and general 
> bash customization (the moment I saw fabric  I almost 
> stopped writing bash :-P)
>
> Improvements:
> - no uwsgi from debian packages (overcomplicated configurations). uwsgi is 
> installed from pip (so you can upgrade with a simple pip install --upgrade 
> uwsgi)
> - optional response.static_version friendly static directories 
> configuration (added also cache headers as an option)
> - improved syntax for web2py.xml (no app, no plugin)
> - example of uwsgi cron facility (clean sessions script included)
> - uwsgi emperor mode, managed with Upstart
> - optional upstart pre-script command to fix permissions and compress 
> static files
>
> If interested, I can make a fabfile for that.
>
>  I use Redis as cache but for the "I love embedded" guys 
> uwsgi has a cache framework. I'm accepting votes to make a uwsgi's cache 
> compatible module for web2py, but you will have to test it (no time for 
> that, sorry)
> 
>

-- 

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




Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2013-02-07 Thread Roberto De Ioris

> Hello,
>
> I have setup nginx & uwsgi on lubuntu with the script and it works great
> (best server ever!), except for a part of my application that requires
> multi threads. I have changed the /etc/uwsgi/web2py.xml to enable threads,
> tried to set each worker with 2 threads, set the thread memory stack to
> 512, it doesn't work: I quickly get a 'resource not available (error 11)'
> message.
>
> Anyone has a tip on what I could work on to make this work? Because
> otherwise the application works fine with rocket / gevent for example.
>
> Thanks,
>
> Andre


If your app is multithreads based you cannot spawn additional processes
(they do not share memory).

Just set processes to 1 and threads to a decent value


-- 
Roberto De Ioris
http://unbit.it

-- 

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




[web2py] Re: Real Python for Web Development, featuring web2py

2013-02-07 Thread Michael Herman
Hi All -

So I posted an update to the KickStarter earlier. I 100% agree about the 
blog/wiki-type examples - it's done too much. I am going to open up a 
survey next week to see what people would like to see developed. In the 
meantime, email or message me with your ideas about what you'd like 
developed. 

Also, if I did do a blog or wiki, it would have many more components than 
just the basic example. 

Thanks for the feedback! :)

On Tuesday, February 5, 2013 9:28:50 AM UTC-8, rochacbruno wrote:
>
>
>
> Take a look:
>
> http://www.kickstarter.com/projects/1369857650/real-python-for-web-development-featuring-web2py
>
> Why Web2py? 
>
> web2py is an open-source web framework for rapid development. You can get 
> up in running in less than 10 minutes and build a full-featured application 
> in under an hour. Much like the Python language itself, web2py is designed 
> for beginners to quickly get up to speed as well as advanced users. 
>
>

-- 

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




[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread DenesL


On Thursday, February 7, 2013 2:53:50 AM UTC-5, Gerd wrote:
>
>
>
> Am Donnerstag, 7. Februar 2013 00:20:02 UTC+1 schrieb DenesL:
>>
>>
>>
>> On Wednesday, February 6, 2013 8:24:01 AM UTC-5, Gerd wrote:
>>>
>>> Hi Annet and DenesL!
>>>
>>> @DenesL: Yes, did restart it, nothings changed
>>>
>>
>> True. Note that the input will show HH:MM:SS until you click on it, then 
>> it becomes HH:MM.
>>
>
> Thats what i described in the starting thread 
>

Oh yeah, I was not able to open the images in the original post so I got 
distracted in the middle of it but I should have re-read the whole thing.
 

>  
>>
>>>
>>> @Annet: Thanks you very much, you got it
>>>
>>> regards
>>> Gerd
>>>
>>> Am Mittwoch, 6. Februar 2013 13:31:24 UTC+1 schrieb Annet:

 Hi Gerd,

 So if i understand this right there is no possibility to change the 
> representation in an update form?
>


 Yes, besides, I am not sure whether IS_TIME() has a format property 
 like IS_DATE() and IS_DATETIME() have.
 In 2009 it hadn't, and Chris helped me solve the problem as follows:

 In db.py:

 istime = dict(type='time',requires=IS_TIME(error_message=T('no match 
 HH:MM')),widget=timeplain,comment=T('Format HH:MM'))

 Field('startTime',**istime),
 Field('endTime',**istime),

 In a module:

 def timeplain(field,value): 
 if value == None: 
 value = ''
 elif 'strftime' in dir(value):
 value = value.strftime('%H:%M') 
 id = '%s_%s' % (field._tablename, field.name) 
 return INPUT(_type='text',_id=id,_class='time_plain',_name=
 field.name,value=str(value),requires=field.requires)

>>>
>> The only caveat here is that you will not be using jQuery.timeEntry, 
>> unless you change the class to just 'time'.
>> You can also do:
>>
>> widget=lambda field,value: SQLFORM.widgets.time.widget(field, 
>> value.strftime('%H:%M') if value else '')
>>
>> but you still need to add {showSeconds:false} to .timeEntry in web2py.js
>>
>>
> I see, thank you very much DenesL 
>

To avoid modifying web2py.js we could do:

script=SCRIPT('jQuery(document).ready(function(){jQuery("input.mytime").timeEntry({showSeconds:false});});')
widget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
value.strftime('%H:%M') if value else '', _class='mytime'),script)

and add that widget to the required fields in the model:
Field(..., widget=widget)

this way we can pass any parameters to jQuery.timeEntry as we need  ;)
 

>  
>>
>>>
 and in case you need it, in a view:

   {{=table.startTime.strftime("%H:%M")}}


 Kind regards,

 Annet

>>>

-- 

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




Re: [web2py] Re: new setup-web2py-nginx-uwsgi-ubuntu.sh

2013-02-07 Thread dederocks
AWSOME! Thank you so much for the fix and explanation!

Best regards, Andre

Le jeudi 7 février 2013 10:11:19 UTC+1, Roberto De Ioris a écrit :
>
>
> > Hello, 
> > 
> > I have setup nginx & uwsgi on lubuntu with the script and it works great 
> > (best server ever!), except for a part of my application that requires 
> > multi threads. I have changed the /etc/uwsgi/web2py.xml to enable 
> threads, 
> > tried to set each worker with 2 threads, set the thread memory stack to 
> > 512, it doesn't work: I quickly get a 'resource not available (error 
> 11)' 
> > message. 
> > 
> > Anyone has a tip on what I could work on to make this work? Because 
> > otherwise the application works fine with rocket / gevent for example. 
> > 
> > Thanks, 
> > 
> > Andre 
>
>
> If your app is multithreads based you cannot spawn additional processes 
> (they do not share memory). 
>
> Just set processes to 1 and threads to a decent value 
>
>
> -- 
> Roberto De Ioris 
> http://unbit.it 
>

-- 

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




[web2py] Re: Background M2M communication

2013-02-07 Thread Massimo Di Pierro
Good point. yes you should close it but how and why depends on your 
protocol and how you use the function.

On Wednesday, 6 February 2013 20:19:31 UTC-6, Bernard wrote:
>
> Thanks, it works.
> Do I have to worry about s.close()?
>
> On Wednesday, February 6, 2013 6:12:06 PM UTC-8, Massimo Di Pierro wrote:
>>
>> yes:
>>
>> def connect(address):
>> socket.settimeout(10)
>> s = socket.socket()
>> return s.connect(address)
>>
>> mysocket = cache.ram('socket',lambda address=(ip,port): 
>> connect(address),3600)
>> mysocket.send('hello world')
>>
>> But mind that s.connect may block.
>>
>> On Wednesday, 6 February 2013 19:32:49 UTC-6, Bernard wrote:
>>>
>>> Is it possible to use cache.ram for a TCP socket?
>>> In my setup, establishing a TCP connection to a remote machine is time 
>>> consuming and I need to find a workaround to have snappier response to the 
>>> Web UI.
>>>
>>> Any help appreciated.
>>>
>>> Thanks,
>>> Bernard
>>>
>>> On Monday, February 4, 2013 11:46:22 AM UTC-8, Bernard wrote:

 Hi web2py users,
I've been using web2py for a few months now, thank you to the 
 developers for the great work.

I'm working on an interactive web based monitoring and control 
 Application that communicates with ~30 mobile field units at a time to get 
 periodic 'semi-realtime' status reports (2-5 second poll period) and allow 
 the user to change settings of the field units on demand.  The 
 communications channel is using TCP sockets: the web2py workstation end is 
 the TCP client and each field unit is running as a TCP server on an 
 embedded low performance field unit.  The front end is currently doing 
 periodic Ajax polling every 2 seconds and updating the GUI.  I also 
 would like to support multiple web users connected to the Application 
 on the front end.

I've searched the mailing lists of web2py and other frameworks but 
 could not find a use case similar to mine.  There are many ways 
 implementing this, it's not easy to figure out which is best and what 
 pitfalls may lie ahead.
 Here are some of the approaches that I have considered:
 1- Use a background asynchronous "Data Acquisition" task always 
 running and fills a "RealTime" table in the database (by polling all field 
 units every 2 seconds). For each web request, the controller would then 
 pick up the latest values from the database and serve them up to Web 
 clients without having to worry about pulling the data. The background 
 task 
 keeps the sockets open to improve performance.
 2- The controller communicates with the ~30 field units directly, 
 bypassing any database overhead. The controller needs a persistent 
 reference to the 30 TCP sockets to make the comms faster. Is there a way 
 to 
 parallelize the TCP request/response in the request thread to 
 communicate with ~30 units quickly? To handle multiple Web users, I can 
 cache the controller function so that it doesn't run on every web client 
 request.
 3- Have web2py controller communicate with a separate data acquisition 
 process 
 via message queues. The web2py parts would never deal with the low level 
 comms and the external data acquisition component would abstract all 
 that. However, this is at the expense of having to create an external 
 component and define the interface to it and adding a messaging framework 
 between web2py and the data acquisition process.
 4- Controller kicks off a worker thread that collects the field unit 
 status. Controller function cached to avoid having a task for every web 
 request.
 5- Other ideas that might be better suited to this application?

 If anybody has gone through something similar, can you please help with 
 your experience?
 If you see any issues or potential weaknesses in any of these 
 approaches, your feedback would be greatly appreciated.

 Regards,
 Bernard



-- 

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




[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread Gerd


Am Donnerstag, 7. Februar 2013 10:56:31 UTC+1 schrieb DenesL:
>
>
>
> On Thursday, February 7, 2013 2:53:50 AM UTC-5, Gerd wrote:
>>
>>
>>
>> Am Donnerstag, 7. Februar 2013 00:20:02 UTC+1 schrieb DenesL:
>>>
>>>
>>>
>>> On Wednesday, February 6, 2013 8:24:01 AM UTC-5, Gerd wrote:

 Hi Annet and DenesL!

 @DenesL: Yes, did restart it, nothings changed

>>>
>>> True. Note that the input will show HH:MM:SS until you click on it, then 
>>> it becomes HH:MM.
>>>
>>
>> Thats what i described in the starting thread 
>>
>
> Oh yeah, I was not able to open the images in the original post so I got 
> distracted in the middle of it but I should have re-read the whole thing.
>  
>
>>  
>>>

 @Annet: Thanks you very much, you got it

 regards
 Gerd

 Am Mittwoch, 6. Februar 2013 13:31:24 UTC+1 schrieb Annet:
>
> Hi Gerd,
>
> So if i understand this right there is no possibility to change the 
>> representation in an update form?
>>
>
>
> Yes, besides, I am not sure whether IS_TIME() has a format property 
> like IS_DATE() and IS_DATETIME() have.
> In 2009 it hadn't, and Chris helped me solve the problem as follows:
>
> In db.py:
>
> istime = dict(type='time',requires=IS_TIME(error_message=T('no match 
> HH:MM')),widget=timeplain,comment=T('Format HH:MM'))
>
> Field('startTime',**istime),
> Field('endTime',**istime),
>
> In a module:
>
> def timeplain(field,value): 
> if value == None: 
> value = ''
> elif 'strftime' in dir(value):
> value = value.strftime('%H:%M') 
> id = '%s_%s' % (field._tablename, field.name) 
> return INPUT(_type='text',_id=id,_class='time_plain',_name=
> field.name,value=str(value),requires=field.requires)
>

>>> The only caveat here is that you will not be using jQuery.timeEntry, 
>>> unless you change the class to just 'time'.
>>> You can also do:
>>>
>>> widget=lambda field,value: SQLFORM.widgets.time.widget(field, 
>>> value.strftime('%H:%M') if value else '')
>>>
>>> but you still need to add {showSeconds:false} to .timeEntry in web2py.js
>>>
>>>
>> I see, thank you very much DenesL 
>>
>
> To avoid modifying web2py.js we could do:
>
>
> script=SCRIPT('jQuery(document).ready(function(){jQuery("input.mytime").timeEntry({showSeconds:false});});')
> widget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
> value.strftime('%H:%M') if value else '', _class='mytime'),script)
>
> and add that widget to the required fields in the model:
> Field(..., widget=widget)
>
> this way we can pass any parameters to jQuery.timeEntry as we need  ;)
>  
>
 
Wow, i'm impressed, nice job :)
Thanks again DenesL

regards
Gerd
 

>  
>>>

> and in case you need it, in a view:
>
>   {{=table.startTime.strftime("%H:%M")}}
>
>
> Kind regards,
>
> Annet
>


-- 

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




[web2py] Custom form won't submit.

2013-02-07 Thread Andrew Buchan
Hello,

I'm using a form.custom, but clicking on submit doesn't trigger validation 
or submission. The page just refreshes.
The code below always results in 'dont know' at the response.flash...

Controller:

...
fields = [..]
request_details_form = SQLFORM(db.capacity_request,
   fields=fields)

# testing to see if any of these happen on submit... always come up as 
'dont know'...
if request_details_form.process().accepted:
response.flash = 'processed'
elif request_details_form.errors:
response.flash = 'errors'
elif request_details_form.accepts(request.vars, session, dbio=False):
response.flash = 'accepted'
else:
response.flash = 'dont know'
return dict(request_details_form=request_details_form)



View:

.
{{=request_details_form.custom.begin}}


{{for field_name in ['team', 'raised_on', 'raised_by', 'contract', 
'client',
 'owner', 'required_by', 'requested_hours', 
 'output_formats', 'rechargeable_to_client', 
'comments',
 'lbg_property_code', 
'has_project_been_set_up_on_Doc_Ex', 
 'has_project_mailbox_been_set_up', 
'actual_return_date']:
}}
{{if request_details_form.custom.widget.has_key(field_name):}}

{{=request_details_form.custom.label[field_name]}}
{{=request_details_form.custom.widget[field_name]}}

{{pass}}
{{pass}}

{{if request_details_form.custom.submit:}}

go: 
{{=request_details_form.custom.submit}}

{{pass}}

{{request_details_form.custom.end}}


The form displays fine, it just won't submit.
Anyone have any ideas?
Also why should I use form.process.accepts() instead of form.accepts (I saw 
that advice somewhere relating to custom forms)
Using version 2.3.2.

Thanks,

Andy.

-- 

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




Re: [web2py] Re: Autoincrement field

2013-02-07 Thread Alec Taylor
"Optionally you can define a field of `type='id'` and web2py will use
this field as auto-increment id field. This is not recommended except
when accessing legacy database tables. With some limitation, you can
also use different primary keys and this is discussed in the section
on "Legacy databases and keyed tables"."
— http://web2py.com/books/default/chapter/29/06#DAL,-Table,-Field

-- 

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




[web2py] Re: 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2013-02-07 Thread Michael Beller
I noticed in the documentation that there should also be an 'everybody' 
group (which I did not have). I thought that maybe if that group did not 
exist users are added to 'wiki_editor' by default but adding 'everybody' 
group did not fix the problem.

Anybody else having this issue?

On Tuesday, February 5, 2013 5:38:51 PM UTC-5, Michael Beller wrote:
>
> I'm still having this error in 2.3.2
>
> Every new user is added to wiki_editor group.  Even if I remove the user 
> from the group, the user still has access to the wiki menu (I've specified 
> menugroups - see below) and when the user logs out and logs in again they 
> are automatically added back to the wiki_editor group.
>
> I have the following statement in my model after auth.define_tables:
>
> auth.wiki(resolve=False, manage_permissions=True, 
> menugroups=['wiki_editor','wiki_author'])
>
> On Thursday, November 8, 2012 5:25:43 PM UTC-5, Massimo Di Pierro wrote:
>>
>> Please open a ticket. Will fix this tonight.
>>
>> On Thursday, 8 November 2012 14:50:51 UTC-6, Dragan Matic wrote:
>>>
>>> I can confirm and replicate this bug, the same happens on windows 
>>> binaries and on ubuntu with source with latest stable version - 2.2.1. 
>>>
>>> Here are the steps to replicate the bug:
>>>
>>> 1. create new app
>>> 2. create new page (default/wikipage.html) and controller that returns 
>>> auth.wiki(manage_permissions=True)
>>> 3. go to wikipage, I am now redirected to user login
>>> 4. register first user, go to default/wikipage
>>> 5. create first wiki page, accept defaults and submit
>>> 6. logout, register second user
>>> 7. go to appadmin, check auth_membership table, second user is not a 
>>> member of wiki_editor
>>> 8. with second user visit default/wikipage
>>> 9. go to appadmin, check auth_membership table, second user has now 
>>> automatically become a member of wiki_editor
>>>
>>>
>>> On Thursday, November 8, 2012 5:23:24 PM UTC+1, Massimo Di Pierro wrote:

 The rule is the first user to register is also a wiki_editor. This 
 should not happen for other users. If it happens it is a bug. Can you 
 confirm this is working as intended?

 On Thursday, 8 November 2012 08:00:31 UTC-6, Dragan Matic wrote:
>
> I am doing an auth.wiki(manage_permissions=True). 
>
> Basically, I want to have a wiki writer and a wiki_reader who will not 
> be able to edit wiki posts. Two users (reader and writer) are registered 
> and two groups are automatically opened (user_1 and user_2). For every 
> wiki 
> post user_1 and user_2 are set to read it and only user_1 can edit it. 
> However, whenever wiki reader logs in, a row is automatically inserted 
> into 
> auth_membership table which maps wiki_reader user to wiki_editor group, 
> so 
> he can also edit posts. Is this a bug or is there a way to set a user to 
> be 
> a wiki reader only?
>
> Thanks
> Dragan
>


-- 

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




[web2py] Re: Auth with Wordpress

2013-02-07 Thread Michael Haas

Hello Kenneth,


> But how do I handle that WP takes care of authentication and somehow gives 
> the customer rights to view the manual. 
>
>
I had a similar problem. I added an XMLRPC method to my wordpress instance 
to check if a given username/password combination is valid and added an 
auth method to my web2py instance which calls that XMLRPC method.

Wordpress Code:

# custom remote auth
add_filter( 'xmlrpc_methods', 'my_add_xml_rpc_methods' );

function my_add_xml_rpc_methods( $methods ) {
  $methods['mh.testCredentials'] = 'test_credentials';
  return $methods;
}


function test_credentials( $params ) {
  
  global $wp_xmlrpc_server;
  
  $blog_id  = (int) $params[0]; // not used, but follow in the form of the 
wordpress built in XML-RPC actions
  $username = $params[1];
  $password = $params[2];
  $args = $params[3];
  
  // verify credentials
  if ( ! $wp_xmlrpc_server->login( $username, $password ) ) {
return False;
  }
  

  do_action( 'xmlrpc_call', 'mh.testCredentials' ); // patterned on the 
core XML-RPC actions
  
  // return success
  return True;
}

This is one of the tutorials I used when coming up with this: 
http://www.foxrunsoftware.net/articles/wordpress/extending-the-wordpress-xml-rpc-api/

Now the web2py part - copy to ./gluon/contrib/login_methods/my_auth.py

from wordpress_xmlrpc import Client
from wordpress_xmlrpc import AuthenticatedMethod
from wordpress_xmlrpc import InvalidCredentialsError


class GetUserInfo(AuthenticatedMethod):
method_name = "mh.testCredentials"



def my_auth(server):
"""
to use basic login with a different server
from gluon.contrib.login_methods.basic_auth import basic_auth
auth.settings.login_methods.append(basic_auth('http://server'))
"""

def basic_login_aux(username,
password,server=server):
wp = Client(server, username, password)
retVal = None
try:
retVal = wp.call(GetUserInfo())
except InvalidCredentialsError:
return False
return retVal
return basic_login_aux



 Now, where you configure your auth module, add this:
from gluon.contrib.login_methods.my_auth import my_auth
auth.settings.login_methods=[my_auth("http://mywordpress/xmlrpc.php";)] # 
smart people use https
auth.settings.actions_disabled.append('register') 


-- 

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




[web2py] One database field, two form fields? From seconds to min:sec

2013-02-07 Thread Michael Haas
Hello all,

I'm writing a web app where people can log their exercise sessions. 
Basically, sessions are timed, and the faster the better. To this end, I 
store seconds in my model:

Field('f_record_taken', type='date',notnull=True,default=datetime.date.
today(),
  label=T('Record Taken')),
Field('f_user', type='reference auth_user',notnull=True,
  label=T('User')),
Field('f_exercise', type='reference t_exercise_description',notnull=True
,
  label=T('Exercise')),
### either repetitions, time or weight
Field('f_measure', type='double',notnull=True,
  label=T('Measurement')),
Field('f_comment', type='string',label=T("Comment")),



I use SQLForm to let users insert new entries:

form = SQLFORM(db.t_exercise_log, fields =  ["f_record_taken", "f_measure", 
"f_comment"]

Obviously, this will render the f_measure field as a single form entry - 
but users do not want to enter seconds because it requires them to do the 
math from minutes to seconds. I could theoretically use a time field 
instead, but I use the f_measure field for other types of exercise as well 
(think "weight lifted in kilos").

How would you go about doing this? I assume I could use SQLForm.Factory, 
but then I might have to validate the form by hand (?). So I'm wondering 
what would be the best, most web2py-ish solution here, e.g. by modifying 
some kind of representation logic in the model.


Kind regards,

Michael

-- 

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




[web2py] adding elements to auth.register()

2013-02-07 Thread Fabiano Faver
I would like to implement the example 
of 
http://web2py.com/books/default/chapter/29/07#Adding-extra-form-elements-to-SQLFORM
 
inside auth.register form.
Then try to validate if its checked. 

auth.settings.register_onvalidation = checkaceito


And I set that users need approval to login:

auth.settings.registration_requires_approval = True


But I had a problem:

 - the extra element 'agree' is not passed to the onvalidation function


Here the code:

def user():
db.auth_user.id_perfil.requires = []
db.auth_user.id_perfil.default = 1

form=auth()

 

def checkaceito(form):
   form.vars.id_perfil = 1
   print 'CHECK:',form.vars
   if not form.vars.agree:
   form.errors.agree = 'Para o cadastro eh necessario aceitar 
os termos de contrato.'
   ##session.flash = 'Para o cadastro eh necessario aceitar os 
termos de contrato.'

 



 

if request.args(0)=='register':
if form.errors: print form.errors

 

db.auth_user.id_perfil.writable = False
db.auth_user.id_perfil.readable = True

auth.settings.register_onvalidation = checkaceito

form=auth.register()#SQLFORM(db.auth_user)

checkbox = TR(LABEL('Eu concordo com os termos de 
contrato'),INPUT(_id='agree', _name='agree', value=True, _type='checkbox'))
form[0].insert(-1,checkbox)


return dict(form=form)


Here the print I got in checkaceito function:

CHECK: , 'ativo': 'on', 'email': 't...@email.com'}> 



What am I missing o what I can do it to work?

-- 

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




Re: [web2py] Upgrading web2py 1.99.7 to 2.3.2 on ubuntu

2013-02-07 Thread Richard Vézina
Do you have a limitation, why would you put 2 version of web2py on the same
machine... I would create an other VM with the new stuff!

You could use the same database if you want pointing the postgres of the
old version of web2py...

Richard


On Thu, Feb 7, 2013 at 4:06 AM, at  wrote:

> Hi,
>
> Currenty we are usnig web2py (1.99.7) + apache + ssl + mod_wsgi +
> postgresql on ubuntu on production and development servers.
> Before we upgrade to latest stable version i.e. 2.3.2 on production, we
> want to run both old and latest versions side-by-side on development
> servers. What should be the best and clean way to accomplish it?
>
> Thanks,
> AT
>
>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "web2py-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to web2py+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 

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




[web2py] Re: Image store with open does not work on GAE

2013-02-07 Thread Sebastian Cambeo
unfortunately not:

TRACEBACK

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

Traceback (most recent call last):
  File "*\restricted.py", line 212, in restricted
exec ccode in environment
  File "*/applications/welcome/models/db.py" 
, line 90, in 
db.table1.insert(image =  open('test.jpg', 'rb'))
  File "*\gluon\dal.py", line 7916, in insert
self._attempt_upload(fields)
  File "*\gluon\dal.py", line 7907, in _attempt_upload
new_name = field.store(value,filename=value.name)
  File "*\gluon\dal.py", line 8616, in store
self_uploadfield.table.insert(**keys)
TypeError: insert() keywords must be strings

-- 

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




[web2py] Bug in database administration

2013-02-07 Thread Calycé
Hi all,

I have an error in the database administration when using the following 
code in db.py:

db.define_table('cgc_service_categories',  
Field('category', 'string', required=True),
Field('description', 'text', required=True),
Field('image', 'upload', required=True),
Field('display_order', 'integer'),
Field('link', 'string'),
format='%(category)s')

db.define_table('cgc_trainings',
Field('category', db.cgc_service_categories),
Field('disporder', 'integer'),
Field('title', 'string', required=True),
Field('short_title', 'string', required=True),
Field('duration', 'string', required=True),
Field('planning', 'text', required=True),
Field('typical', 'text'),
Field('price', 'integer'),
Field('training_checks', 'boolean'),
Field('image', 'upload'),
format='%(short_title)s')

db.define_table('cgc_schedule',
Field('training', db.cgc_trainings),
Field('location', 'string'),
Field('training_date', 'date'),
Field('vacancies', 'integer'),
format='%(training.short_title)s (%(training_date)s)')

db.define_table('cgc_booking',
Field('training_date', db.cgc_schedule),
Field('company', 'string'),
Field('first_name', 'string'),
Field('last_name', 'string'),
Field('phone', 'string'),
Field('email', 'string'),
Field('seats', 'integer'))

It works when I browse the existing records, but if I try to edit a record 
or insert a new one with the database administration in the cgc_booking 
table, I receive the following error:
 'Table' object has no attribute 
'training.short_title'
If I change the "format" for the cgc_schedule table to "%(training)s 
(%(training_date)s)" it works but having only the id is useless in this 
case.

Is it a bug in the database administration or am I doing something wrong ?

BTW, I'm using 2.3.2.

Thanks for your help.


Calycé

-- 

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




[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread Annet
Hi Denes,

I'd like to use your solution to replace the 2009 one I am using right now. 
However, put these lines of code in db.py


script=SCRIPT('jQuery(document).ready(function(){jQuery("input.mytime").timeEntry({showSeconds:false});});')
timewidget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
value.strftime('%H:%M') if value else '', _class='mytime'),script)

istime = dict(type='time',requires=IS_TIME(error_message=T('no match 
HH:MM')),widget=timewidget,comment=T('Format HH:MM'))

Field('startTime',**istime),
Field('endTime',**istime),


I no longer get the error message when a user enters for example 09: so 
only the hours not the minutes. How would I have to adjust your code to 
validate the time?

Best regards,

Annet

-- 

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




[web2py] web2pyhl7 demo not available at web2py.com

2013-02-07 Thread Alan Etkin
There are some links with introduction to web2py with the following demo 
link:

http://web2py.com/HLv3

but the server returns "invalid request"

Maybe the server could redirect to the project page if the demo is no 
longer available.

-- 

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




[web2py] Re: Custom form won't submit.

2013-02-07 Thread Massimo Di Pierro
{{request_details_form.custom.end}}

should be

{{=request_details_form.custom.end}}

On Thursday, 7 February 2013 05:58:45 UTC-6, Andrew Buchan wrote:
>
> Hello,
>
> I'm using a form.custom, but clicking on submit doesn't trigger validation 
> or submission. The page just refreshes.
> The code below always results in 'dont know' at the response.flash...
>
> Controller:
>
> ...
> fields = [..]
> request_details_form = SQLFORM(db.capacity_request,
>fields=fields)
>
> # testing to see if any of these happen on submit... always come up as 
> 'dont know'...
> if request_details_form.process().accepted:
> response.flash = 'processed'
> elif request_details_form.errors:
> response.flash = 'errors'
> elif request_details_form.accepts(request.vars, session, dbio=False):
> response.flash = 'accepted'
> else:
> response.flash = 'dont know'
> return dict(request_details_form=request_details_form)
>
> 
>
> View:
>
> .
> {{=request_details_form.custom.begin}}
> 
> 
> {{for field_name in ['team', 'raised_on', 'raised_by', 'contract', 
> 'client',
>  'owner', 'required_by', 'requested_hours', 
>  'output_formats', 'rechargeable_to_client', 
> 'comments',
>  'lbg_property_code', 
> 'has_project_been_set_up_on_Doc_Ex', 
>  'has_project_mailbox_been_set_up', 
> 'actual_return_date']:
> }}
> {{if request_details_form.custom.widget.has_key(field_name):}}
> 
> {{=request_details_form.custom.label[field_name]}}
> 
> {{=request_details_form.custom.widget[field_name]}}
> 
> {{pass}}
> {{pass}}
> 
> {{if request_details_form.custom.submit:}}
> 
> go: 
> {{=request_details_form.custom.submit}}
> 
> {{pass}}
> 
> {{request_details_form.custom.end}}
> 
>
> The form displays fine, it just won't submit.
> Anyone have any ideas?
> Also why should I use form.process.accepts() instead of form.accepts (I 
> saw that advice somewhere relating to custom forms)
> Using version 2.3.2.
>
> Thanks,
>
> Andy.
>

-- 

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




[web2py] Re: 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2013-02-07 Thread Massimo Di Pierro
The documentation needs to be fixed. There are two different "everybody".

In Wiki if you set manage_permissions=True you can use a group "everybody" 
to set permissions on wiki pages. This group is not really created but just 
a dummy. It tells the wiki the page can be accessed by everybody.

In Auth there is the concept of an "everybody" group but auth does not 
create it for you. You can do:

g = db.auth_group(role='all people'):
if g:
gid = db.auth_group.insert(role='all people')
else:
gid = g.id  
auth.settings.everybody_group_id = gid

Notice that in this case the role/name is irrelevant and, in fact, I used 
"all people" instead of everybody.

On Thursday, 7 February 2013 06:33:16 UTC-6, Michael Beller wrote:
>
> I noticed in the documentation that there should also be an 'everybody' 
> group (which I did not have). I thought that maybe if that group did not 
> exist users are added to 'wiki_editor' by default but adding 'everybody' 
> group did not fix the problem.
>
> Anybody else having this issue?
>
> On Tuesday, February 5, 2013 5:38:51 PM UTC-5, Michael Beller wrote:
>>
>> I'm still having this error in 2.3.2
>>
>> Every new user is added to wiki_editor group.  Even if I remove the user 
>> from the group, the user still has access to the wiki menu (I've specified 
>> menugroups - see below) and when the user logs out and logs in again they 
>> are automatically added back to the wiki_editor group.
>>
>> I have the following statement in my model after auth.define_tables:
>>
>> auth.wiki(resolve=False, manage_permissions=True, 
>> menugroups=['wiki_editor','wiki_author'])
>>
>> On Thursday, November 8, 2012 5:25:43 PM UTC-5, Massimo Di Pierro wrote:
>>>
>>> Please open a ticket. Will fix this tonight.
>>>
>>> On Thursday, 8 November 2012 14:50:51 UTC-6, Dragan Matic wrote:

 I can confirm and replicate this bug, the same happens on windows 
 binaries and on ubuntu with source with latest stable version - 2.2.1. 

 Here are the steps to replicate the bug:

 1. create new app
 2. create new page (default/wikipage.html) and controller that returns 
 auth.wiki(manage_permissions=True)
 3. go to wikipage, I am now redirected to user login
 4. register first user, go to default/wikipage
 5. create first wiki page, accept defaults and submit
 6. logout, register second user
 7. go to appadmin, check auth_membership table, second user is not a 
 member of wiki_editor
 8. with second user visit default/wikipage
 9. go to appadmin, check auth_membership table, second user has now 
 automatically become a member of wiki_editor


 On Thursday, November 8, 2012 5:23:24 PM UTC+1, Massimo Di Pierro wrote:
>
> The rule is the first user to register is also a wiki_editor. This 
> should not happen for other users. If it happens it is a bug. Can you 
> confirm this is working as intended?
>
> On Thursday, 8 November 2012 08:00:31 UTC-6, Dragan Matic wrote:
>>
>> I am doing an auth.wiki(manage_permissions=True). 
>>
>> Basically, I want to have a wiki writer and a wiki_reader who will 
>> not be able to edit wiki posts. Two users (reader and writer) are 
>> registered and two groups are automatically opened (user_1 and user_2). 
>> For 
>> every wiki post user_1 and user_2 are set to read it and only user_1 can 
>> edit it. However, whenever wiki reader logs in, a row is automatically 
>> inserted into auth_membership table which maps wiki_reader user to 
>> wiki_editor group, so he can also edit posts. Is this a bug or is there 
>> a 
>> way to set a user to be a wiki reader only?
>>
>> Thanks
>> Dragan
>>
>

-- 

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




[web2py] Re: Bug in database administration

2013-02-07 Thread Massimo Di Pierro
This is not a bug but a limitation in syntax:

You cannot do:

db.define_table('cgc_schedule',
...
format='%(training.short_title)s (%(training_date)s)')

because only fields of the table itself can be used in the representation 
of a record. In order to retrieve training.short_title for a record of 
table cgc_schedule, web2py would have to go a recursive select and we do 
not want to do that silently because can be expensive. There is another 
notation:

db.define_table('cgc_schedule',
...
format=lambda row: '%s %s' % (row.training.short_title, 
row.training_date))

and this will do what you ask since it is more explicit.




On Thursday, 7 February 2013 09:31:56 UTC-6, Calycé wrote:
>
> Hi all,
>
> I have an error in the database administration when using the following 
> code in db.py:
>
> db.define_table('cgc_service_categories',  
> Field('category', 'string', required=True),
> Field('description', 'text', required=True),
> Field('image', 'upload', required=True),
> Field('display_order', 'integer'),
> Field('link', 'string'),
> format='%(category)s')
>
> db.define_table('cgc_trainings',
> Field('category', db.cgc_service_categories),
> Field('disporder', 'integer'),
> Field('title', 'string', required=True),
> Field('short_title', 'string', required=True),
> Field('duration', 'string', required=True),
> Field('planning', 'text', required=True),
> Field('typical', 'text'),
> Field('price', 'integer'),
> Field('training_checks', 'boolean'),
> Field('image', 'upload'),
> format='%(short_title)s')
>
> db.define_table('cgc_schedule',
> Field('training', db.cgc_trainings),
> Field('location', 'string'),
> Field('training_date', 'date'),
> Field('vacancies', 'integer'),
> format='%(training.short_title)s (%(training_date)s)')
>
> db.define_table('cgc_booking',
> Field('training_date', db.cgc_schedule),
> Field('company', 'string'),
> Field('first_name', 'string'),
> Field('last_name', 'string'),
> Field('phone', 'string'),
> Field('email', 'string'),
> Field('seats', 'integer'))
>
> It works when I browse the existing records, but if I try to edit a record 
> or insert a new one with the database administration in the cgc_booking 
> table, I receive the following error:
>  'Table' object has no attribute 
> 'training.short_title'
> If I change the "format" for the cgc_schedule table to "%(training)s 
> (%(training_date)s)" it works but having only the id is useless in this 
> case.
>
> Is it a bug in the database administration or am I doing something wrong ?
>
> BTW, I'm using 2.3.2.
>
> Thanks for your help.
>
>
> Calycé
>
>

-- 

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




[web2py] Re: web2pyhl7 demo not available at web2py.com

2013-02-07 Thread Massimo Di Pierro
I have taken down some legacy apps since we are moving the server to python 
anywhere. On that server I do not have too much flexibility to configure 
the web server. May be easier to fix the source of links.

On Thursday, 7 February 2013 09:44:49 UTC-6, Alan Etkin wrote:
>
> There are some links with introduction to web2py with the following demo 
> link:
>
> http://web2py.com/HLv3
>
> but the server returns "invalid request"
>
> Maybe the server could redirect to the project page if the demo is no 
> longer available.
>

-- 

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




[web2py] Re: Bug in database administration

2013-02-07 Thread Calycé
I found a solution/workaround.

For the records, I changed the format for the table cgc_schedule.
Old one:
format='%(training.short_title)s (%(training_date)s)'

New one:
format=lambda row: row.training.short_title + ' (' + row.training_date.
strftime('%d-%m-%Y') + ')'

With that new format, it works.

I'm still wondering why I need to use a lambda to have it working. If 
someone has a clue I'm all ears ;-)


On Thursday, February 7, 2013 4:31:56 PM UTC+1, Calycé wrote:
>
> Hi all,
>
> I have an error in the database administration when using the following 
> code in db.py:
>
> db.define_table('cgc_service_categories',  
> Field('category', 'string', required=True),
> Field('description', 'text', required=True),
> Field('image', 'upload', required=True),
> Field('display_order', 'integer'),
> Field('link', 'string'),
> format='%(category)s')
>
> db.define_table('cgc_trainings',
> Field('category', db.cgc_service_categories),
> Field('disporder', 'integer'),
> Field('title', 'string', required=True),
> Field('short_title', 'string', required=True),
> Field('duration', 'string', required=True),
> Field('planning', 'text', required=True),
> Field('typical', 'text'),
> Field('price', 'integer'),
> Field('training_checks', 'boolean'),
> Field('image', 'upload'),
> format='%(short_title)s')
>
> db.define_table('cgc_schedule',
> Field('training', db.cgc_trainings),
> Field('location', 'string'),
> Field('training_date', 'date'),
> Field('vacancies', 'integer'),
> format='%(training.short_title)s (%(training_date)s)')
>
> db.define_table('cgc_booking',
> Field('training_date', db.cgc_schedule),
> Field('company', 'string'),
> Field('first_name', 'string'),
> Field('last_name', 'string'),
> Field('phone', 'string'),
> Field('email', 'string'),
> Field('seats', 'integer'))
>
> It works when I browse the existing records, but if I try to edit a record 
> or insert a new one with the database administration in the cgc_booking 
> table, I receive the following error:
>  'Table' object has no attribute 
> 'training.short_title'
> If I change the "format" for the cgc_schedule table to "%(training)s 
> (%(training_date)s)" it works but having only the id is useless in this 
> case.
>
> Is it a bug in the database administration or am I doing something wrong ?
>
> BTW, I'm using 2.3.2.
>
> Thanks for your help.
>
>
> Calycé
>
>

-- 

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




[web2py] Re: Bug in database administration

2013-02-07 Thread Calycé
oops, looks like you were faster than me ;-)
Anyway thanks for your help.

On Thursday, February 7, 2013 5:39:24 PM UTC+1, Massimo Di Pierro wrote:
>
> This is not a bug but a limitation in syntax:
>
> You cannot do:
>
> db.define_table('cgc_schedule',
> ...
> format='%(training.short_title)s (%(training_date)s)')
>
> because only fields of the table itself can be used in the representation 
> of a record. In order to retrieve training.short_title for a record of 
> table cgc_schedule, web2py would have to go a recursive select and we do 
> not want to do that silently because can be expensive. There is another 
> notation:
>
> db.define_table('cgc_schedule',
> ...
> format=lambda row: '%s %s' % (row.training.short_title, 
> row.training_date))
>
> and this will do what you ask since it is more explicit.
>
>
>
>
> On Thursday, 7 February 2013 09:31:56 UTC-6, Calycé wrote:
>>
>> Hi all,
>>
>> I have an error in the database administration when using the following 
>> code in db.py:
>>
>> db.define_table('cgc_service_categories',  
>> Field('category', 'string', required=True),
>> Field('description', 'text', required=True),
>> Field('image', 'upload', required=True),
>> Field('display_order', 'integer'),
>> Field('link', 'string'),
>> format='%(category)s')
>>
>> db.define_table('cgc_trainings',
>> Field('category', db.cgc_service_categories),
>> Field('disporder', 'integer'),
>> Field('title', 'string', required=True),
>> Field('short_title', 'string', required=True),
>> Field('duration', 'string', required=True),
>> Field('planning', 'text', required=True),
>> Field('typical', 'text'),
>> Field('price', 'integer'),
>> Field('training_checks', 'boolean'),
>> Field('image', 'upload'),
>> format='%(short_title)s')
>>
>> db.define_table('cgc_schedule',
>> Field('training', db.cgc_trainings),
>> Field('location', 'string'),
>> Field('training_date', 'date'),
>> Field('vacancies', 'integer'),
>> format='%(training.short_title)s (%(training_date)s)')
>>
>> db.define_table('cgc_booking',
>> Field('training_date', db.cgc_schedule),
>> Field('company', 'string'),
>> Field('first_name', 'string'),
>> Field('last_name', 'string'),
>> Field('phone', 'string'),
>> Field('email', 'string'),
>> Field('seats', 'integer'))
>>
>> It works when I browse the existing records, but if I try to edit a 
>> record or insert a new one with the database administration in the 
>> cgc_booking table, I receive the following error:
>>  'Table' object has no attribute 
>> 'training.short_title'
>> If I change the "format" for the cgc_schedule table to "%(training)s 
>> (%(training_date)s)" it works but having only the id is useless in this 
>> case.
>>
>> Is it a bug in the database administration or am I doing something wrong ?
>>
>> BTW, I'm using 2.3.2.
>>
>> Thanks for your help.
>>
>>
>> Calycé
>>
>>

-- 

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




[web2py] Re: Image store with open does not work on GAE

2013-02-07 Thread Alan Etkin
>> Field('image', 'upload'),

Why two upload fields? Shouldn't the first table have a blob type field?

-- 

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




[web2py] Inconsistent smartgrid behavior for reference field links

2013-02-07 Thread Michael Beller
smartgrid creates links for reference fields if linked_tables is not 
specified but does not if linked_tables is specified.

I have a test model with Owner and Dog and a test function for 
manage_owners with a smartgrid:
form = SQLFORM.smartgrid(db.t_owner), linked_tables=['t_dog'])

If you display the view for manage_owners and then select the Dogs button 
(with a link to /default/manage_owners/t_owner/t_dog.f_owner/1), the 
reference field to owner in the subsequent Dogs smartgrid does not display 
a link if linked_tables is specified but not if linked_tables is not 
specified.

Is this by design?

-- 

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




[web2py] Re: web2pyhl7 demo not available at web2py.com

2013-02-07 Thread Alan Etkin

>
> I have taken down some legacy apps since we are moving the server to 
> python anywhere. ...


(visited) places where to change the reference:

Project page:
http://code.google.com/p/web2pyhl7/

Python users (Argentina)
http://python.org.ar/pyar/PreguntasFrecuentes

Wikipedia (es)
http://es.wikipedia.org/wiki/Web2py

-- 

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




[web2py] Re: 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2013-02-07 Thread Michael Beller
Thank you for the clarification but I don't think that addresses the 
problem that every new user is added to wiki_editor group.  I saw earlier 
in this thread there was a fix but I'm still experiencing that problem.  Is 
there something else I should check?

On Thursday, February 7, 2013 11:32:30 AM UTC-5, Massimo Di Pierro wrote:
>
> The documentation needs to be fixed. There are two different "everybody".
>
> In Wiki if you set manage_permissions=True you can use a group "everybody" 
> to set permissions on wiki pages. This group is not really created but just 
> a dummy. It tells the wiki the page can be accessed by everybody.
>
> In Auth there is the concept of an "everybody" group but auth does not 
> create it for you. You can do:
>
> g = db.auth_group(role='all people'):
> if g:
> gid = db.auth_group.insert(role='all people')
> else:
> gid = g.id  
> auth.settings.everybody_group_id = gid
>
> Notice that in this case the role/name is irrelevant and, in fact, I used 
> "all people" instead of everybody.
>
> On Thursday, 7 February 2013 06:33:16 UTC-6, Michael Beller wrote:
>>
>> I noticed in the documentation that there should also be an 'everybody' 
>> group (which I did not have). I thought that maybe if that group did not 
>> exist users are added to 'wiki_editor' by default but adding 'everybody' 
>> group did not fix the problem.
>>
>> Anybody else having this issue?
>>
>> On Tuesday, February 5, 2013 5:38:51 PM UTC-5, Michael Beller wrote:
>>>
>>> I'm still having this error in 2.3.2
>>>
>>> Every new user is added to wiki_editor group.  Even if I remove the user 
>>> from the group, the user still has access to the wiki menu (I've specified 
>>> menugroups - see below) and when the user logs out and logs in again they 
>>> are automatically added back to the wiki_editor group.
>>>
>>> I have the following statement in my model after auth.define_tables:
>>>
>>> auth.wiki(resolve=False, manage_permissions=True, 
>>> menugroups=['wiki_editor','wiki_author'])
>>>
>>> On Thursday, November 8, 2012 5:25:43 PM UTC-5, Massimo Di Pierro wrote:

 Please open a ticket. Will fix this tonight.

 On Thursday, 8 November 2012 14:50:51 UTC-6, Dragan Matic wrote:
>
> I can confirm and replicate this bug, the same happens on windows 
> binaries and on ubuntu with source with latest stable version - 2.2.1. 
>
> Here are the steps to replicate the bug:
>
> 1. create new app
> 2. create new page (default/wikipage.html) and controller that returns 
> auth.wiki(manage_permissions=True)
> 3. go to wikipage, I am now redirected to user login
> 4. register first user, go to default/wikipage
> 5. create first wiki page, accept defaults and submit
> 6. logout, register second user
> 7. go to appadmin, check auth_membership table, second user is not a 
> member of wiki_editor
> 8. with second user visit default/wikipage
> 9. go to appadmin, check auth_membership table, second user has now 
> automatically become a member of wiki_editor
>
>
> On Thursday, November 8, 2012 5:23:24 PM UTC+1, Massimo Di Pierro 
> wrote:
>>
>> The rule is the first user to register is also a wiki_editor. This 
>> should not happen for other users. If it happens it is a bug. Can you 
>> confirm this is working as intended?
>>
>> On Thursday, 8 November 2012 08:00:31 UTC-6, Dragan Matic wrote:
>>>
>>> I am doing an auth.wiki(manage_permissions=True). 
>>>
>>> Basically, I want to have a wiki writer and a wiki_reader who will 
>>> not be able to edit wiki posts. Two users (reader and writer) are 
>>> registered and two groups are automatically opened (user_1 and user_2). 
>>> For 
>>> every wiki post user_1 and user_2 are set to read it and only user_1 
>>> can 
>>> edit it. However, whenever wiki reader logs in, a row is automatically 
>>> inserted into auth_membership table which maps wiki_reader user to 
>>> wiki_editor group, so he can also edit posts. Is this a bug or is there 
>>> a 
>>> way to set a user to be a wiki reader only?
>>>
>>> Thanks
>>> Dragan
>>>
>>

-- 

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




[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread DenesL


On Thursday, February 7, 2013 10:36:01 AM UTC-5, Annet wrote:
>
> Hi Denes,
>
> I'd like to use your solution to replace the 2009 one I am using right 
> now. However, put these lines of code in db.py
>
>
>
> script=SCRIPT('jQuery(document).ready(function(){jQuery("input.mytime").timeEntry({showSeconds:false});});')
> timewidget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
> value.strftime('%H:%M') if value else '', _class='mytime'),script)
>
> istime = dict(type='time',requires=IS_TIME(error_message=T('no match 
> HH:MM')),widget=timewidget,comment=T('Format HH:MM'))
>
> Field('startTime',**istime),
> Field('endTime',**istime),
>
>
> I no longer get the error message when a user enters for example 09: so 
> only the hours not the minutes. How would I have to adjust your code to 
> validate the time?
>
> Best regards,
>
> Annet
>

-- 

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




Re: [web2py] Re: Auth with Wordpress

2013-02-07 Thread Kenneth Lundström

Hi Michael,

Am I understanding you solution completly wrong but isn't it so that 
web2py asks WP if a username and password compination is OK. In my case 
customer first logs into a WP site, he gets a list of manuals he has 
paid for. When selecting a manual he wants to read he is sent to a 
web2py site. Somehow WP has to tell web2py that it is OK to show the 
site for the user.



Kenneth



Hello Kenneth,


But how do I handle that WP takes care of authentication and
somehow gives the customer rights to view the manual.


I had a similar problem. I added an XMLRPC method to my wordpress 
instance to check if a given username/password combination is valid 
and added an auth method to my web2py instance which calls that XMLRPC 
method.


Wordpress Code:

|
# custom remote auth
add_filter('xmlrpc_methods','my_add_xml_rpc_methods');

functionmy_add_xml_rpc_methods($methods ){
  $methods['mh.testCredentials']='test_credentials';
return$methods;
}


functiontest_credentials($params ){

global$wp_xmlrpc_server;

  $blog_id =(int)$params[0];// not used, but follow in the form of the 
wordpress built in XML-RPC actions

  $username =$params[1];
  $password =$params[2];
  $args =$params[3];

// verify credentials
if(!$wp_xmlrpc_server->login($username,$password )){
returnFalse;
}


  do_action('xmlrpc_call','mh.testCredentials');// patterned on the 
core XML-RPC actions


// return success
returnTrue;
}

|
This is one of the tutorials I used when coming up with this: 
http://www.foxrunsoftware.net/articles/wordpress/extending-the-wordpress-xml-rpc-api/


Now the web2py part - copy to ./gluon/contrib/login_methods/my_auth.py

|
fromwordpress_xmlrpc importClient
fromwordpress_xmlrpc importAuthenticatedMethod
fromwordpress_xmlrpc importInvalidCredentialsError


classGetUserInfo(AuthenticatedMethod):
method_name ="mh.testCredentials"



defmy_auth(server):
"""
to use basic login with a different server
from gluon.contrib.login_methods.basic_auth import basic_auth
auth.settings.login_methods.append(basic_auth('http://server'))
"""

defbasic_login_aux(username,
password,server=server):
wp =Client(server,username,password)
retVal =None
try:
retVal =wp.call(GetUserInfo())
exceptInvalidCredentialsError:
returnFalse
returnretVal
returnbasic_login_aux

|


 Now, where you configure your auth module, add this:
|
fromgluon.contrib.login_methods.my_auth importmy_auth
auth.settings.login_methods=[my_auth("http://mywordpress/xmlrpc.php";)]# smart 
people use https

auth.settings.actions_disabled.append('register')
|


--

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

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




--

--- 
You received this message because you are subscribed to the Google Groups "web2py-users" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




[web2py] Re: web2pyhl7 demo not available at web2py.com

2013-02-07 Thread Alan Etkin

>
> Python users (Argentina)
> http://python.org.ar/pyar/PreguntasFrecuentes
>

Done. For now, changed to ar.pycon.org/2012 (is a link to "an example of 
application made with web2py")

Wikipedia (es)
> http://es.wikipedia.org/wiki/Web2py
>

Changed to project page

-- 

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




[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread Annet
Hi Denes,



>> I no longer get the error message when a user enters for example 09: so 
>> only the hours not the minutes. How would I have to adjust your code to 
>> validate the time?
>>
>
> It should not be possible to enter just 09: , jQuery.timeEntry will not 
> allow that to happen.
> It only allows numeric input and pads it with zeros.
> Your code works fine on my trunk test system. 
>

On my system submitting the form with startTime 09: I get the following 
error:

Traceback (most recent call last):
  File "/Users/annet/web2py/gluon/restricted.py", line 212, in restricted
exec ccode in environment
  File "/Users/annet/web2py/applications/init/controllers/cmscalendar.py" 
, line 291, 
in 
  File "/Users/annet/web2py/gluon/globals.py", line 188, in 
self._caller = lambda f: f()
  File "/Users/annet/web2py/gluon/tools.py", line 2912, in f
return action(*a, **b)
  File "/Users/annet/web2py/applications/init/controllers/cmscalendar.py" 
, line 71, in 
openingHours

form.process(onvalidation=onvalidation_openinghours,onsuccess=onsuccess_message,next=URL('openingHours'))
  File "/Users/annet/web2py/gluon/html.py", line 2170, in process
self.validate(**kwargs)
  File "/Users/annet/web2py/gluon/html.py", line 2109, in validate
if self.accepts(**kwargs):
  File "/Users/annet/web2py/gluon/sqlhtml.py", line 1321, in accepts
widget = field.widget(field, value)
  File "/Users/annet/web2py/applications/init/models/10_table_db.py" 
, line 24, in 

timewidget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
value.strftime('%H:%M') if value else '', _class='mytime'),script)
AttributeError: 'str' object has no attribute 'strftime'


In case I enter startTime 09:00, I don't get the error.

Best Regards,

Annet


-- 

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




[web2py] .delete()

2013-02-07 Thread Annet
If db(db.eventList.nodeID==id) is empty will 
db(db.eventList.nodeID==id).delete()
result in an error?

Best regards,

Annet

-- 

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




Re: [web2py] Upgrading web2py 1.99.7 to 2.3.2 on ubuntu

2013-02-07 Thread at

Thanks for your reply.

Actually we want to keep apache+ssl+mod_wsgi+postgres installations as they 
are. Keeping them unchanged what should be the right approach to run same 
applications side-by-side on both old and new versions of web2py?
Our servers are in amazon cloud.

Thanks & Regards


On Thursday, 7 February 2013 19:37:16 UTC+5, Richard wrote:
>
> Do you have a limitation, why would you put 2 version of web2py on the 
> same machine... I would create an other VM with the new stuff!
>
> You could use the same database if you want pointing the postgres of the 
> old version of web2py...
>
> Richard
>
>
> On Thu, Feb 7, 2013 at 4:06 AM, at >wrote:
>
>> Hi,
>>
>> Currenty we are usnig web2py (1.99.7) + apache + ssl + mod_wsgi + 
>> postgresql on ubuntu on production and development servers.
>> Before we upgrade to latest stable version i.e. 2.3.2 on production, we 
>> want to run both old and latest versions side-by-side on development 
>> servers. What should be the best and clean way to accomplish it?
>>
>> Thanks,
>> AT
>>
>>  -- 
>>  
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com .
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 

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




[web2py] Re: .delete()

2013-02-07 Thread Anthony
It should just return 0 (indicating that 0 records were deleted).

Anthony

On Thursday, February 7, 2013 1:38:34 PM UTC-5, Annet wrote:
>
> If db(db.eventList.nodeID==id) is empty will 
> db(db.eventList.nodeID==id).delete()
> result in an error?
>
> Best regards,
>
> Annet
>

-- 

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




[web2py] Re: Image store with open does not work on GAE

2013-02-07 Thread Massimo Di Pierro
Clearly something is not working as intended. There are two cases here:

1) the blob is saved in the same table as the unload field:

db.define_table('table1',
   Field('image', 'upload'),
)

In this case the blob field is created automatically.

2) the blob is created in a separate table:

db.define_table('blobs',
   Field('image', 'upload'),
)
db.define_table('table1',
   Field('image', 'upload',uploadfield=db.blobs.image),
)

In this case the blobs table has an automatic blob field and table1.image 
point there.

Anyway, looks like none of these options is working on GAE. I think 2) got 
broken long ago and nobody noticed because nobody uses it.



On Thursday, 7 February 2013 10:48:33 UTC-6, Alan Etkin wrote:
>
> >> Field('image', 'upload'),
>
> Why two upload fields? Shouldn't the first table have a blob type field?
>

-- 

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




[web2py] Re: 2.2.1 auth.wiki() automatically adds users to wiki_editor group. Bug or feature?

2013-02-07 Thread Massimo Di Pierro
Not every user is added to wiki_editor. Only if the user is logged into 
"admin".

You are probably testing this by logging out from the app and creating 
multiple accounts. You need to do this while not logged into admin. I agree 
that this behavior is annoying when testing but if a user a a system 
administrator and can edit the app, he should be able to edit the content 
as well. 

On Thursday, 7 February 2013 11:15:39 UTC-6, Michael Beller wrote:
>
> Thank you for the clarification but I don't think that addresses the 
> problem that every new user is added to wiki_editor group.  I saw earlier 
> in this thread there was a fix but I'm still experiencing that problem.  Is 
> there something else I should check?
>
> On Thursday, February 7, 2013 11:32:30 AM UTC-5, Massimo Di Pierro wrote:
>>
>> The documentation needs to be fixed. There are two different "everybody".
>>
>> In Wiki if you set manage_permissions=True you can use a group 
>> "everybody" to set permissions on wiki pages. This group is not really 
>> created but just a dummy. It tells the wiki the page can be accessed by 
>> everybody.
>>
>> In Auth there is the concept of an "everybody" group but auth does not 
>> create it for you. You can do:
>>
>> g = db.auth_group(role='all people'):
>> if g:
>> gid = db.auth_group.insert(role='all people')
>> else:
>> gid = g.id  
>> auth.settings.everybody_group_id = gid
>>
>> Notice that in this case the role/name is irrelevant and, in fact, I used 
>> "all people" instead of everybody.
>>
>> On Thursday, 7 February 2013 06:33:16 UTC-6, Michael Beller wrote:
>>>
>>> I noticed in the documentation that there should also be an 'everybody' 
>>> group (which I did not have). I thought that maybe if that group did not 
>>> exist users are added to 'wiki_editor' by default but adding 'everybody' 
>>> group did not fix the problem.
>>>
>>> Anybody else having this issue?
>>>
>>> On Tuesday, February 5, 2013 5:38:51 PM UTC-5, Michael Beller wrote:

 I'm still having this error in 2.3.2

 Every new user is added to wiki_editor group.  Even if I remove the 
 user from the group, the user still has access to the wiki menu (I've 
 specified menugroups - see below) and when the user logs out and logs in 
 again they are automatically added back to the wiki_editor group.

 I have the following statement in my model after auth.define_tables:

 auth.wiki(resolve=False, manage_permissions=True, 
 menugroups=['wiki_editor','wiki_author'])

 On Thursday, November 8, 2012 5:25:43 PM UTC-5, Massimo Di Pierro wrote:
>
> Please open a ticket. Will fix this tonight.
>
> On Thursday, 8 November 2012 14:50:51 UTC-6, Dragan Matic wrote:
>>
>> I can confirm and replicate this bug, the same happens on windows 
>> binaries and on ubuntu with source with latest stable version - 2.2.1. 
>>
>> Here are the steps to replicate the bug:
>>
>> 1. create new app
>> 2. create new page (default/wikipage.html) and controller that 
>> returns auth.wiki(manage_permissions=True)
>> 3. go to wikipage, I am now redirected to user login
>> 4. register first user, go to default/wikipage
>> 5. create first wiki page, accept defaults and submit
>> 6. logout, register second user
>> 7. go to appadmin, check auth_membership table, second user is not a 
>> member of wiki_editor
>> 8. with second user visit default/wikipage
>> 9. go to appadmin, check auth_membership table, second user has now 
>> automatically become a member of wiki_editor
>>
>>
>> On Thursday, November 8, 2012 5:23:24 PM UTC+1, Massimo Di Pierro 
>> wrote:
>>>
>>> The rule is the first user to register is also a wiki_editor. This 
>>> should not happen for other users. If it happens it is a bug. Can you 
>>> confirm this is working as intended?
>>>
>>> On Thursday, 8 November 2012 08:00:31 UTC-6, Dragan Matic wrote:

 I am doing an auth.wiki(manage_permissions=True). 

 Basically, I want to have a wiki writer and a wiki_reader who will 
 not be able to edit wiki posts. Two users (reader and writer) are 
 registered and two groups are automatically opened (user_1 and 
 user_2). For 
 every wiki post user_1 and user_2 are set to read it and only user_1 
 can 
 edit it. However, whenever wiki reader logs in, a row is automatically 
 inserted into auth_membership table which maps wiki_reader user to 
 wiki_editor group, so he can also edit posts. Is this a bug or is 
 there a 
 way to set a user to be a wiki reader only?

 Thanks
 Dragan

>>>

-- 

--- 
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...@googl

[web2py] Re: How to dont show seconds in a time field

2013-02-07 Thread DenesL
Hi Annet,

to make the widget safer we could do:

timewidget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
value.strftime('%H:%M') if hasattr(value,'strftime') else '', 
_class='mytime'),script)

but I still don't understand how you can submit a value of 09:
that input is just not possible.
Are you sure that jQuery.timeEntry is working?.

Regards,
Denes

On Thursday, February 7, 2013 1:33:05 PM UTC-5, Annet wrote:
>
> Hi Denes,
>
>
>
>>> I no longer get the error message when a user enters for example 09: so 
>>> only the hours not the minutes. How would I have to adjust your code to 
>>> validate the time?
>>>
>>
>> It should not be possible to enter just 09: , jQuery.timeEntry will not 
>> allow that to happen.
>> It only allows numeric input and pads it with zeros.
>> Your code works fine on my trunk test system. 
>>
>
> On my system submitting the form with startTime 09: I get the following 
> error:
>
> Traceback (most recent call last):
>   File "/Users/annet/web2py/gluon/restricted.py", line 212, in restricted
> exec ccode in environment
>   File "/Users/annet/web2py/applications/init/controllers/cmscalendar.py" 
> , line 291, 
> in 
>   File "/Users/annet/web2py/gluon/globals.py", line 188, in 
> self._caller = lambda f: f()
>   File "/Users/annet/web2py/gluon/tools.py", line 2912, in f
> return action(*a, **b)
>   File "/Users/annet/web2py/applications/init/controllers/cmscalendar.py" 
> , line 71, 
> in openingHours
> 
> form.process(onvalidation=onvalidation_openinghours,onsuccess=onsuccess_message,next=URL('openingHours'))
>   File "/Users/annet/web2py/gluon/html.py", line 2170, in process
> self.validate(**kwargs)
>   File "/Users/annet/web2py/gluon/html.py", line 2109, in validate
> if self.accepts(**kwargs):
>   File "/Users/annet/web2py/gluon/sqlhtml.py", line 1321, in accepts
> widget = field.widget(field, value)
>   File "/Users/annet/web2py/applications/init/models/10_table_db.py" 
> , line 24, in 
> 
> timewidget=lambda field,value: TAG[''](SQLFORM.widgets.time.widget(field, 
> value.strftime('%H:%M') if value else '', _class='mytime'),script)
> AttributeError: 'str' object has no attribute 'strftime'
>
>
> In case I enter startTime 09:00, I don't get the error.
>
> Best Regards,
>
> Annet
>
>
>

-- 

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




Re: [web2py] Re: how to support video in an app

2013-02-07 Thread Tito Garrido
How to set the width and height of the embed video using expand_one?


On Sat, Feb 2, 2013 at 12:00 AM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Sorry my bad:
>
> {{=XML(expand_one('http://www.**youtube.com/watch?v=**
> 7yvt2Pt6LRA',cache.ram('**mycache',lambda:dict(),3600))
> )}**}
>
> expand one converts to HTML but then is must be wrapped into XML else it
> gets escaped.
>
>
> On Friday, 1 February 2013 19:10:12 UTC-6, sasogeek wrote:
>>
>> when the page loads and i click on view page source, here's what's
>> there...
>>
>>