[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Paolo Caruccio
JS. After all, we are replacing superfish.

Il giorno domenica 27 maggio 2012 00:06:55 UTC+2, Massimo Di Pierro ha 
scritto:
>
> These no record boostrap and the new menu logic is staying in trunk. The 
> only issue is whether the weird menu structure should be generated by MENU 
> helper or by the JS in layout.html.
>
> On Saturday, 26 May 2012 12:33:52 UTC-5, Niphlod wrote:
>>
>> Until some time ago web2py mantained the "burden" of it's own template, 
>> it's own css, it's own javascript functions based on jquery.
>> I think I started using web2py when it contained only ez.css's classes.
>> Having to be a CSS/JS coder better than all peoples around the world can 
>> be hard ;-)
>>
>> Then superfish was added, css3 buttons were included, skeleton was 
>> adopted, grids can be serialized in a friendly jquery-ui style, etc. etc. 
>> etc. Let's be real: css frameworks and ui js are included in every 
>> application someone is starting coding out there. You're not forced to be 
>> an HTML guru to be a web programmer, and still have some nice user 
>> interface. 
>>
>> From where I am standing, both as a simple and a long time web2py user, 
>> I'm happy to "infiltrate" in all code that web2py generates and explore 
>> practically every flexibility it has to offer, but "sane defaults" are 
>> provided right now and maybe are ok for ultra-small apps. 
>>
>> Now, I'm not saying to follow every css and js library out there, but 
>> bootstrap is 160K of css (counting images and some nice js), largely 
>> adopted and very well supported, probably not going "under" within the 
>> year, mobile-friendly and in general easily understandable and to work with.
>>
>> web2py should leave defaults as always, but it's nice to see it "ready" 
>> to integrate with the major players out there.
>>
>> I think that a "style" argument can be added to every bit of code will 
>> need to change in the code regarding serialization without much problems. 
>> web2py 2.0 will be bootstrap-menu ready, if users want to start with 
>> welcome and edit that, it'll be ready. Maybe 2.1 will be bootstrap-forms 
>> ready, and so on...
>> Backward compatibility is not broken, old behaviour is maintained. If 
>> someone wants bootstrap's form he'll set a style parameter and voila.
>>
>> Il giorno sabato 26 maggio 2012 16:37:05 UTC+2, Massimo Di Pierro ha 
>> scritto:
>>>
>>> For now this is in trunk. Your implementation looks good.
>>>
>>> For me the problem whether we want to do this or not. Most of the 
>>> conventions implemented in web2py core are web2py own conventions or 
>>> standard protocol.  Bootstrap is a css library. very popular today but will 
>>> disappear tomorrow as a better one comes out. Now everybody will use it. Is 
>>> it a good idea to include code which is designed exclusively for bootstap 
>>> conventions and specifically refers to bootstrap css classes? Or is it 
>>> better to handle it from the layout only using js?
>>>
>>> So we need to think about this some more. I cannot promise this will 
>>> stay in web2py 2.0 in this form.
>>>
>>> Massimo
>>>
>>>
>
>>>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Massimo Di Pierro
That's exactly what we have in trunk since yesterday. superfish is gone.

On Sunday, 27 May 2012 00:14:50 UTC-5, Annet wrote:
>
> I've been working on an application using Bootstrap for a couple of weeks 
> now, and eventually dropped all the extra js plugins I was using, except 
> the jQuery UI datepicker (which I style using JQuery UI Bootstrap: 
> http://addyosmani.github.com/jquery-ui-bootstrap/). My menus are entirely 
> Bootstrap based, I don't see what Superfish offers that 
> bootstrap-dropdown.js doesn't offer.
>
> Why not just use Bootstrap and Bootswatch?
>
>
> Annet
>


[web2py] Re: Bootstrap modal and ajax

2012-05-26 Thread Annet
Hi,

Thanks for your reply. 

One thing: does it behave differently if you change ajax=False in the 
> LOAD()?
>

I don't think that's the cause of the problem, I replaced the ajax menu:


  Home
  Openingtijden
  Event list
 

... with a none ajax menu:


  Home
  Openingtijden
  Event 
list
 

And that caused the modal window to no longer work. To me there's no 
obvious link between the menu and the details displayed in the modal window.


Kind regards,

Annet.



[web2py] Re: form.custom('table')

2012-05-26 Thread Annet


> What do you mean by does not work?
>

When I click the submit button, the form isn't being submitted.


Kind regards,

Annet. 


[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Annet
I've been working on an application using Bootstrap for a couple of weeks 
now, and eventually dropped all the extra js plugins I was using, except 
the jQuery UI datepicker (which I style using JQuery UI Bootstrap: 
http://addyosmani.github.com/jquery-ui-bootstrap/). My menus are entirely 
Bootstrap based, I don't see what Superfish offers that 
bootstrap-dropdown.js doesn't offer.

Why not just use Bootstrap and Bootswatch?


Annet


[web2py] Re: 4th Edition manual RSS example problems

2012-05-26 Thread Jarrod Wilcox
Massimo: Thank you for explanation.  If one goal is to attract newbies, 
suggest warning re Chrome in manual. Jarrod

On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote:

> The overview chapter adds an RSS facility to the mywiki example.  The 
> example code seems to contain typo errors:  "form" instead of "from" and 
> "reponse" instead of "response", but that may not be a serious issue.
>
> When these are "corrected", the result of serving mywiki/default/news.rss 
> is a page of text rather than the picture shown in the manual.
>
> This appears:
>
> 
> mywiki rss 
> feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki
>  newsFri, 25 May 2012 13:41:48 
> GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig
>  
> Latin/mywiki/default/show.rss/1

Ancay > ouyay eakspay igpay atinlay?

Fri, 25 May > 2012 12:02:44 GMT > > > My question is what do do to get the correct result. All code was cut and > paste from the examples in the online version of the manual. > > Jarrod > On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote: > > The overview chapter adds an RSS facility to the mywiki example. The > example code seems to contain typo errors: "form" instead of "from" and > "reponse" instead of "response", but that may not be a serious issue. > > When these are "corrected", the result of serving mywiki/default/news.rss > is a page of text rather than the picture shown in the manual. > > This appears: > > > mywiki rss > feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki > newsFri, 25 May 2012 13:41:48 > GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig > > Latin/mywiki/default/show.rss/1

Ancay > ouyay eakspay igpay atinlay?

Fri, 25 May > 2012 12:02:44 GMT > > > My question is what do do to get the correct result. All code was cut and > paste from the examples in the online version of the manual. > > Jarrod >

[web2py] Re: recaptcha in LOAD

2012-05-26 Thread Carlos
Hi,

I'm using Recaptcha with ajax, and in case it helps I have the following 
(programmed some time ago but still working):


> Include this in your layout.html ...

 http://www.google.com/recaptcha/api/js/recaptcha_ajax.js";>



> Include this somewhere in your model (where NUBE.captcha_hid is just a 
global id) ...

# must use Recaptcha's AJAX api, otherwise document.write 
is being generated by google and breaks the dynamic/ajax calls.
# 
http://code.google.com/apis/recaptcha/docs/display.html#AJAX
def _nube_recaptcha_xml(self):
captcha = DIV(
DIV(_id=NUBE.captcha_hid),
)
if self.errors.captcha:
captcha.append(DIV(self.errors['captcha'], _class=
'error'))
return XML(captcha).xml()
gluon.tools.Recaptcha.xml = _nube_recaptcha_xml



> Include this also in models ...

auth.settings.captcha = gluon.tools.Recaptcha(
request,
keys[0], # PUBLIC key
keys[1], # PRIVATE key
use_ssl = False,
error_message = T('captcha_invalid'),
options = 'theme:"white"',
)



> Include this in models too ...

def captcha(self):
return self.auth.settings.captcha

def captcha_x(self, attr):
obj = self.captcha()
return getattr(obj, attr) if obj else ''

def captcha_key(self): return self.captcha_x('public_key')
def captcha_options(self): return self.captcha_x('options')



> Include this in web2py_ajax.html (where nube.wbox_centerifvisible is just 
a js function to center the modal window) ...

var captcha_hid = '{{=NUBE.captcha_hid}}'
var captcha_key = '{{=nube.captcha_key()}}'
var captcha_options = { {{=XML(nube.captcha_options())}} }
if (captcha_options) {
  captcha_options.callback = function(){ nube.wbox_centerifvisible(null) 
}
}



> Include this somewhere in your javascript ...

 w_wcaptcha: function(w) { return w.find('#'+captcha_hid) },

 w_wcaptcha_open: function(w) {
 var wcaptcha = this.w_wcaptcha(w)
 if (wcaptcha.length) {
 // http://code.google.com/apis/recaptcha/docs/display.html#AJAX
 // http://code.google.com/apis/recaptcha/docs/customization.html
 Recaptcha.create(captcha_key, captcha_hid, captcha_options)
 }
 },

 // execute this when opening captcha via ajax (where "w" can be the modal 
window).
 this.w_wcaptcha_open(w)



The above does not have any specific order, and some code is included in 
classes (python and js) and such.

You might be able to simplify the above depending on your specific case.

Hope this helps ...

   Carlos


On Friday, May 25, 2012 6:50:52 PM UTC-5, weheh wrote:
>
> For completeness, please refer to:
>
>
> https://groups.google.com/forum/?fromgroups#!searchin/web2py/recaptcha$20load$20ajax/web2py/9retDkkyGxU/p6j_F3U8X3YJ
>
>
> https://groups.google.com/forum/?fromgroups#!searchin/web2py/recaptcha$20load$20ajax/web2py/eeMT2Bb-KYA/7G6WZ-XeIygJ
>
> This is an old issue and I'm late to the game, but with my modular 
> approach I'm seeing that pbreit has already explored this 
> javascripted-initial-authentication territory and declared it inhospitable.
>
> Basically, if I'm to understand, you can't use Recaptcha with LOAD(..., 
> ajax=True). Am I right?
>


Re: [web2py] Configuring web2py with nginx - domain error ("gaierror: [Errno -2] Name or service not known")

2012-05-26 Thread Carlos
HI,

I just saw this error in my server log, just once, with the following entry:

   ERROR:web2py:Traceback (most recent call last):
 File "/home/www-data/web2py/gluon/main.py", line 401, in wsgibase
   socket.gethostbyname(http_host)]
   gaierror: [Errno -2] Name or service not known

So far it is just that one occurrence (and not from a web request generated 
by me).

And so far all web requests from my end work ok.

Should I act on it somehow?.

I'm using latest web2py trunk, with ubuntu 10.04, postgresql, nginx, 
uwsgi-python.

Thanks,

   Carlos


On Wednesday, May 16, 2012 3:58:22 PM UTC-5, Chris wrote:
>
>
> I wrote a patch to fix the problem on my server, which is basically just 
> commenting out that line (main.py:390ish):
>
> local_hosts = 
> [http_host,'::1','127.0.0.1',':::127.0.0.1']
> if not global_settings.web2py_runtime_gae:
> local_hosts += [socket.gethostname()]
> #socket.gethostbyname(http_host)]
>
> It looks like that line is just to check for the request is coming from 
> the externally facing IP. Could that perhaps be wrapped in a try-catch 
> block and the results cached?
>
> Thanks,
> Chris
>
>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can 
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>>socket.gethostbynamesocket.gethostbyname(http_host)  File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>>socket.gethostbyname(http_host)]
>>>gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>>local_hosts = [http_host,'::1','127.0.0.1',':::
>>> 127.0.0.1']
>>>if not global_settings.web2py_runtime_gae:
>>>local_hosts += [socket.gethostname(),
>>>socket.gethostbyname(http_host)]
>>>
>>> As it turns out, http_host (the value above) is mapped to the
>>> nginx.conf value for http_host:
>>>
>>>upstream custom_server_name {
>>>server 127.0.0.1:8000;
>>>}
>>>
>>>
>>> It seems like what's happening is that web2py is receiving the http;//
>>> custom_server_name instead of http://localhost, and
>>> socket.gethostbyname() chokes on that. Is there something I should be
>>> changing in the configuration to prevent this from happening?
>>>
>>
>>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can 
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>>socket.gethostbynamesocket.gethostbyname(http_host)  File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>>socket.gethostbyname(http_host)]
>>>gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>>local_hosts = [http_host,'::1','127.0.0.1',':::
>>> 127.0.0.1']
>>>if not global_settings.web2py_runtime_gae:
>>>local_hosts += [socket.gethostname(),
>>>socket.gethostbyname(http_host)]
>>>
>>> As it turns out, http_host (the value above) is mapped to the
>>> nginx.conf value for http_host:
>>>
>>>upstream custom_server_name {
>>>server 127.0.0.1:8000;
>>>}
>>>
>>>
>>> It seems like what's happening is that web2py is receiving the http;//
>>> custom_server_name instead of http://localhost, and
>>> socket.gethostbyname() chokes on that. Is there something I should be
>>> changing in the configuration to prevent this from happening?
>>>
>>
>>
> On Tuesday, December 6, 2011 10:01:33 AM UTC-5, Richard wrote:
>>
>> I don't know if you have any constrain, but for testing purpose you can 
>> use nginx setup script in web2py/scripts folder... There is one for ubuntu 
>> at least...
>>
>> RicharD
>>
>> On Mon, Dec 5, 2011 at 5:48 PM, Chris <> wrote:
>>
>>> I'm using web2py with nginx, and I've experienced the following error
>>> on redeploying my app:
>>>
>>>socket.gethostbynamesocket.gethostbyname(http_host)  File "/var/
>>> web2py/cow/gluon/main.py", line 396, in wsgibase
>>>socket.gethostbyname(http_host)]
>>>gaierror: [Errno -2] Name or service not known
>>>
>>>
>>> I traced this down to a particular section in gluon/main.py:
>>>
>>>local_hosts = [http_host,'::1','127.0.0.1',':::
>>> 127.0.0.1']
>>>

[web2py] Re: Where do we submit book errata?

2012-05-26 Thread Yarin
In 
http://web2py.com/books/default/chapter/29/4#Accessing-the-API-from-Python-modules:

Global variables instead are defined only once when the model is imported 
for the first time.
Should read when the *module* is imported for the first time


On Friday, May 18, 2012 4:34:40 PM UTC-4, Anthony wrote:
>
> Yes, that would be nice. For now, you can report here.
>
> Anthony
>
> On Friday, May 18, 2012 4:31:45 PM UTC-4, Yarin wrote:
>>
>> I see no obvious place to report book errors/corrections. There should be 
>> a link in the book itself.
>
>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread LightDot
I actually like having the code in html.py, but I'd vote for keeping this 
as JS in layout.html. It's simple, it's practical, easily changed, leaves 
less things to be kept backwards compatible in the web2py itself.

The day Bootstrap stops looking so good will come, sooner or later. Another 
popular solution will arise, as good or better as Bootstrap and web2py 
users will want it as default. I'd say adding "serialize_someother_menu" in 
the future is a sure thing, if you go this way. Don't get me wrong, it's 
not a bad thing... It's great actually, just more work when it comes to 
maintaining backwards compatibility.

Regards


On Sunday, May 27, 2012 12:06:55 AM UTC+2, Massimo Di Pierro wrote:
>
> These no record boostrap and the new menu logic is staying in trunk. The 
> only issue is whether the weird menu structure should be generated by MENU 
> helper or by the JS in layout.html.
>
> On Saturday, 26 May 2012 12:33:52 UTC-5, Niphlod wrote:
>>
>> Until some time ago web2py mantained the "burden" of it's own template, 
>> it's own css, it's own javascript functions based on jquery.
>> I think I started using web2py when it contained only ez.css's classes.
>> Having to be a CSS/JS coder better than all peoples around the world can 
>> be hard ;-)
>>
>> Then superfish was added, css3 buttons were included, skeleton was 
>> adopted, grids can be serialized in a friendly jquery-ui style, etc. etc. 
>> etc. Let's be real: css frameworks and ui js are included in every 
>> application someone is starting coding out there. You're not forced to be 
>> an HTML guru to be a web programmer, and still have some nice user 
>> interface. 
>>
>> From where I am standing, both as a simple and a long time web2py user, 
>> I'm happy to "infiltrate" in all code that web2py generates and explore 
>> practically every flexibility it has to offer, but "sane defaults" are 
>> provided right now and maybe are ok for ultra-small apps. 
>>
>> Now, I'm not saying to follow every css and js library out there, but 
>> bootstrap is 160K of css (counting images and some nice js), largely 
>> adopted and very well supported, probably not going "under" within the 
>> year, mobile-friendly and in general easily understandable and to work with.
>>
>> web2py should leave defaults as always, but it's nice to see it "ready" 
>> to integrate with the major players out there.
>>
>> I think that a "style" argument can be added to every bit of code will 
>> need to change in the code regarding serialization without much problems. 
>> web2py 2.0 will be bootstrap-menu ready, if users want to start with 
>> welcome and edit that, it'll be ready. Maybe 2.1 will be bootstrap-forms 
>> ready, and so on...
>> Backward compatibility is not broken, old behaviour is maintained. If 
>> someone wants bootstrap's form he'll set a style parameter and voila.
>>
>> Il giorno sabato 26 maggio 2012 16:37:05 UTC+2, Massimo Di Pierro ha 
>> scritto:
>>>
>>> For now this is in trunk. Your implementation looks good.
>>>
>>> For me the problem whether we want to do this or not. Most of the 
>>> conventions implemented in web2py core are web2py own conventions or 
>>> standard protocol.  Bootstrap is a css library. very popular today but will 
>>> disappear tomorrow as a better one comes out. Now everybody will use it. Is 
>>> it a good idea to include code which is designed exclusively for bootstap 
>>> conventions and specifically refers to bootstrap css classes? Or is it 
>>> better to handle it from the layout only using js?
>>>
>>> So we need to think about this some more. I cannot promise this will 
>>> stay in web2py 2.0 in this form.
>>>
>>> Massimo
>>>
>>>
>
>>>
On Sunday, May 27, 2012 12:06:55 AM UTC+2, Massimo Di Pierro wrote:
>
> These no record boostrap and the new menu logic is staying in trunk. The 
> only issue is whether the weird menu structure should be generated by MENU 
> helper or by the JS in layout.html.
>
> On Saturday, 26 May 2012 12:33:52 UTC-5, Niphlod wrote:
>>
>> Until some time ago web2py mantained the "burden" of it's own template, 
>> it's own css, it's own javascript functions based on jquery.
>> I think I started using web2py when it contained only ez.css's classes.
>> Having to be a CSS/JS coder better than all peoples around the world can 
>> be hard ;-)
>>
>> Then superfish was added, css3 buttons were included, skeleton was 
>> adopted, grids can be serialized in a friendly jquery-ui style, etc. etc. 
>> etc. Let's be real: css frameworks and ui js are included in every 
>> application someone is starting coding out there. You're not forced to be 
>> an HTML guru to be a web programmer, and still have some nice user 
>> interface. 
>>
>> From where I am standing, both as a simple and a long time web2py user, 
>> I'm happy to "infiltrate" in all code that web2py generates and explore 
>> practically every flexibility it has to offer, but "sane defaults" are 
>> provided right now and maybe are ok for ultra-small apps. 
>

[web2py] Re: 4th Edition manual RSS example problems

2012-05-26 Thread Massimo Di Pierro
I am sorry to hear this. I apologize for the typos in the book (that is 
indeed my fault) but there is nothing wrong with the RSS feed as generated 
by web2py. And using Django would not make any difference. In fact I think 
the problem is discussed here in the chrome mailing list

http://productforums.google.com/forum/#!topic/chrome/LfDx3j4uYXw

Looks like the problem is that Chrome does not come out of the box with an 
RSS reader.

Try it for example with yahoo rss news: http://news.yahoo.com/rss/ 
IE and FF works, Chromes does not.

This is intentional. Google wants you to use Google Reader for RSS feeds, 
not the browser.

massimo

On Saturday, 26 May 2012 17:11:39 UTC-5, Jarrod Wilcox wrote:
>
> Massimo
>  
> Chrome does not serve an RSS page given the manual's example controller 
> logic in the overview chapter, even after the manual's  "repond" is 
> corrected to "respond".  This is an old error first reported last fall by 
> someone else.
>  
> This is not a big deal.  I still am working through the manual.  However, 
> in the face of advice from others to use Django, my confidence as a new 
> web2py user was a bit shaken.
>  
> Jarrod
>
> On Saturday, May 26, 2012 1:11:31 AM UTC-4, Massimo Di Pierro wrote:
>
>> what's the error?
>>
>> On Friday, 25 May 2012 21:05:06 UTC-5, Jarrod Wilcox wrote:
>>>
>>> I verified that the problem does not occur for IE, Safari and Firefox, 
>>> but does occur with Chrome.
>>> Jarrod
>>>
>>> On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote:
>>>
 The overview chapter adds an RSS facility to the mywiki example.  The 
 example code seems to contain typo errors:  "form" instead of "from" and 
 "reponse" instead of "response", but that may not be a serious issue.

 When these are "corrected", the result of serving 
 mywiki/default/news.rss is a page of text rather than the picture shown in 
 the manual.

 This appears:

 
 mywiki rss 
 feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki
  newsFri, 25 May 2012 13:41:48 
 GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig
  
 Latin/mywiki/default/show.rss/1

Ancay ouyay eakspay igpay atinlay?

Fri, 25 May 2012 12:02:44 GMT My question is what do do to get the correct result. All code was cut and paste from the examples in the online version of the manual. Jarrod >>> >>> On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote: The overview chapter adds an RSS facility to the mywiki example. The example code seems to contain typo errors: "form" instead of "from" and "reponse" instead of "response", but that may not be a serious issue. When these are "corrected", the result of serving mywiki/default/news.rss is a page of text rather than the picture shown in the manual. This appears: mywiki rss feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki newsFri, 25 May 2012 13:41:48 GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig Latin/mywiki/default/show.rss/1

Ancay ouyay eakspay igpay atinlay?

Fri, 25 May 2012 12:02:44 GMT My question is what do do to get the correct result. All code was cut and paste from the examples in the online version of the manual. Jarrod >>>

[web2py] Re: 4th Edition manual RSS example problems

2012-05-26 Thread Jarrod Wilcox
Massimo
 
Chrome does not serve an RSS page given the manual's example controller 
logic in the overview chapter, even after the manual's  "repond" is 
corrected to "respond".  This is an old error first reported last fall by 
someone else.
 
This is not a big deal.  I still am working through the manual.  However, 
in the face of advice from others to use Django, my confidence as a new 
web2py user was a bit shaken.
 
Jarrod

On Saturday, May 26, 2012 1:11:31 AM UTC-4, Massimo Di Pierro wrote:

> what's the error?
>
> On Friday, 25 May 2012 21:05:06 UTC-5, Jarrod Wilcox wrote:
>>
>> I verified that the problem does not occur for IE, Safari and Firefox, 
>> but does occur with Chrome.
>> Jarrod
>>
>> On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote:
>>
>>> The overview chapter adds an RSS facility to the mywiki example.  The 
>>> example code seems to contain typo errors:  "form" instead of "from" and 
>>> "reponse" instead of "response", but that may not be a serious issue.
>>>
>>> When these are "corrected", the result of serving 
>>> mywiki/default/news.rss is a page of text rather than the picture shown in 
>>> the manual.
>>>
>>> This appears:
>>>
>>> 
>>> mywiki rss 
>>> feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki
>>>  newsFri, 25 May 2012 13:41:48 
>>> GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig
>>>  
>>> Latin/mywiki/default/show.rss/1

Ancay >>> ouyay eakspay igpay atinlay?

Fri, 25 May >>> 2012 12:02:44 GMT >>> >>> >>> My question is what do do to get the correct result. All code was cut >>> and paste from the examples in the online version of the manual. >>> >>> Jarrod >>> >> >> On Friday, May 25, 2012 1:58:20 PM UTC-4, Jarrod Wilcox wrote: >>> >>> The overview chapter adds an RSS facility to the mywiki example. The >>> example code seems to contain typo errors: "form" instead of "from" and >>> "reponse" instead of "response", but that may not be a serious issue. >>> >>> When these are "corrected", the result of serving >>> mywiki/default/news.rss is a page of text rather than the picture shown in >>> the manual. >>> >>> This appears: >>> >>> >>> mywiki rss >>> feedhttp://127.0.0.1:8000/mywiki/default/indexmywiki >>> newsFri, 25 May 2012 13:41:48 >>> GMTPyRSS2Gen-1.0.0http://blogs.law.harvard.edu/tech/rssPig >>> >>> Latin/mywiki/default/show.rss/1

Ancay >>> ouyay eakspay igpay atinlay?

Fri, 25 May >>> 2012 12:02:44 GMT >>> >>> >>> My question is what do do to get the correct result. All code was cut >>> and paste from the examples in the online version of the manual. >>> >>> Jarrod >>> >>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Massimo Di Pierro
These no record boostrap and the new menu logic is staying in trunk. The 
only issue is whether the weird menu structure should be generated by MENU 
helper or by the JS in layout.html.

On Saturday, 26 May 2012 12:33:52 UTC-5, Niphlod wrote:
>
> Until some time ago web2py mantained the "burden" of it's own template, 
> it's own css, it's own javascript functions based on jquery.
> I think I started using web2py when it contained only ez.css's classes.
> Having to be a CSS/JS coder better than all peoples around the world can 
> be hard ;-)
>
> Then superfish was added, css3 buttons were included, skeleton was 
> adopted, grids can be serialized in a friendly jquery-ui style, etc. etc. 
> etc. Let's be real: css frameworks and ui js are included in every 
> application someone is starting coding out there. You're not forced to be 
> an HTML guru to be a web programmer, and still have some nice user 
> interface. 
>
> From where I am standing, both as a simple and a long time web2py user, 
> I'm happy to "infiltrate" in all code that web2py generates and explore 
> practically every flexibility it has to offer, but "sane defaults" are 
> provided right now and maybe are ok for ultra-small apps. 
>
> Now, I'm not saying to follow every css and js library out there, but 
> bootstrap is 160K of css (counting images and some nice js), largely 
> adopted and very well supported, probably not going "under" within the 
> year, mobile-friendly and in general easily understandable and to work with.
>
> web2py should leave defaults as always, but it's nice to see it "ready" to 
> integrate with the major players out there.
>
> I think that a "style" argument can be added to every bit of code will 
> need to change in the code regarding serialization without much problems. 
> web2py 2.0 will be bootstrap-menu ready, if users want to start with 
> welcome and edit that, it'll be ready. Maybe 2.1 will be bootstrap-forms 
> ready, and so on...
> Backward compatibility is not broken, old behaviour is maintained. If 
> someone wants bootstrap's form he'll set a style parameter and voila.
>
> Il giorno sabato 26 maggio 2012 16:37:05 UTC+2, Massimo Di Pierro ha 
> scritto:
>>
>> For now this is in trunk. Your implementation looks good.
>>
>> For me the problem whether we want to do this or not. Most of the 
>> conventions implemented in web2py core are web2py own conventions or 
>> standard protocol.  Bootstrap is a css library. very popular today but will 
>> disappear tomorrow as a better one comes out. Now everybody will use it. Is 
>> it a good idea to include code which is designed exclusively for bootstap 
>> conventions and specifically refers to bootstrap css classes? Or is it 
>> better to handle it from the layout only using js?
>>
>> So we need to think about this some more. I cannot promise this will stay 
>> in web2py 2.0 in this form.
>>
>> Massimo
>>
>>

>>

[web2py] Re: Questions for an application with a large number of features and a large database.

2012-05-26 Thread Massimo Di Pierro
You cannot quite do this. Each http request is wrapped in a transaction. 
Even if the db object stays cached, the connection inside may be closed 
when the first request ends, unless the transaction logic is overwritten.

On Saturday, 26 May 2012 11:45:31 UTC-5, David McKeone wrote:
>
> *Massimo and Nico:*
> Thanks for looking into those things, can't wait!  
>
> *RAM Cache and DAL?*
> I've been looking into conditional models and attempting to combine them 
> with the module based system just to see how far I can take it and I've run 
> into a question:  
>
> Is there any reason I shouldn't use cache.ram for a DAL instance?  I can't 
> use the automatic migration tools since our data-structure wouldn't allow 
> for that kind of thing (running a single column update against some of the 
> bigger tables can take 30 minutes+ and we want that in a controlled 
> environment, probably outside of web2py).  So, with migration out of the 
> picture could I do this in the models to avoid recurring re-definition of 
> tables?  
>
> def load_models():
> db = DAL('postgres://localhost:5432/Demo')
> db.define_table('table', Field('field')
> db.define_table('table2', Field('field')
> #etc...
> return db
>
> db = cache.ram('datamodels', lambda: load_models(), time_expire=None)
>
> My real goal is to just get the datamodel remembered between requests 
> (since it'd be redundant to load it every time).  I suppose it's really 
> just a process specific singleton, but it does make some difference.  Here 
> are some non-scientific benchmarks I performed on my data model:
>
> All tables defined in request: ~420ms  
> All tables defined in request w/ cache hit: ~90ms
>
> All tables defined in request (compiled app): ~350ms
> All tables defined in request w/ cache hit (compiled app): ~25ms
>
> Obviously the first request off of a cold start would be fairly slow, but 
> all subsequent requests would benefit greatly.  By using caching with the 
> DAL class am I potentially hurting myself in some way?
>
>
> On Saturday, May 26, 2012 11:13:17 AM UTC+1, Nico de Groot wrote:
>>
>> Hi David,
>> Got Jenkins running on mac and windows with unittests, will send you 
>> details later. 
>> Nico de Groot
>
>

[web2py] sqlform.grid html text

2012-05-26 Thread CtrlSoft
hi, how to display in sqlform.grid -> viewhtml formated text?

i mean:  *someText lazy** fox*   instead ofsomeText lazy 
fox

[web2py] Re: Wep2Py Database Tables

2012-05-26 Thread Niphlod
it's for Central Authentication Services

http://web2py.com/books/default/chapter/29/9#Central-Authentication-Service

Il giorno sabato 26 maggio 2012 18:46:26 UTC+2, Horus ha scritto:
>
> In the administrative section of your app there are the usual ACL tables. 
> I realise there is a *acl_cas* table along with these tables. I am 
> curious as to what this tables does?



[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Niphlod
Until some time ago web2py mantained the "burden" of it's own template, 
it's own css, it's own javascript functions based on jquery.
I think I started using web2py when it contained only ez.css's classes.
Having to be a CSS/JS coder better than all peoples around the world can be 
hard ;-)

Then superfish was added, css3 buttons were included, skeleton was adopted, 
grids can be serialized in a friendly jquery-ui style, etc. etc. etc. Let's 
be real: css frameworks and ui js are included in every application someone 
is starting coding out there. You're not forced to be an HTML guru to be a 
web programmer, and still have some nice user interface. 

>From where I am standing, both as a simple and a long time web2py user, I'm 
happy to "infiltrate" in all code that web2py generates and explore 
practically every flexibility it has to offer, but "sane defaults" are 
provided right now and maybe are ok for ultra-small apps. 

Now, I'm not saying to follow every css and js library out there, but 
bootstrap is 160K of css (counting images and some nice js), largely 
adopted and very well supported, probably not going "under" within the 
year, mobile-friendly and in general easily understandable and to work with.

web2py should leave defaults as always, but it's nice to see it "ready" to 
integrate with the major players out there.

I think that a "style" argument can be added to every bit of code will need 
to change in the code regarding serialization without much problems. web2py 
2.0 will be bootstrap-menu ready, if users want to start with welcome and 
edit that, it'll be ready. Maybe 2.1 will be bootstrap-forms ready, and so 
on...
Backward compatibility is not broken, old behaviour is maintained. If 
someone wants bootstrap's form he'll set a style parameter and voila.

Il giorno sabato 26 maggio 2012 16:37:05 UTC+2, Massimo Di Pierro ha 
scritto:
>
> For now this is in trunk. Your implementation looks good.
>
> For me the problem whether we want to do this or not. Most of the 
> conventions implemented in web2py core are web2py own conventions or 
> standard protocol.  Bootstrap is a css library. very popular today but will 
> disappear tomorrow as a better one comes out. Now everybody will use it. Is 
> it a good idea to include code which is designed exclusively for bootstap 
> conventions and specifically refers to bootstrap css classes? Or is it 
> better to handle it from the layout only using js?
>
> So we need to think about this some more. I cannot promise this will stay 
> in web2py 2.0 in this form.
>
> Massimo
>
>
>>>
>

[web2py] Wep2Py Database Tables

2012-05-26 Thread Horus
In the administrative section of your app there are the usual ACL tables. I 
realise there is a *acl_cas* table along with these tables. I am curious as 
to what this tables does?

[web2py] Re: Questions for an application with a large number of features and a large database.

2012-05-26 Thread David McKeone
*Massimo and Nico:*
Thanks for looking into those things, can't wait!  

*RAM Cache and DAL?*
I've been looking into conditional models and attempting to combine them 
with the module based system just to see how far I can take it and I've run 
into a question:  

Is there any reason I shouldn't use cache.ram for a DAL instance?  I can't 
use the automatic migration tools since our data-structure wouldn't allow 
for that kind of thing (running a single column update against some of the 
bigger tables can take 30 minutes+ and we want that in a controlled 
environment, probably outside of web2py).  So, with migration out of the 
picture could I do this in the models to avoid recurring re-definition of 
tables?  

def load_models():
db = DAL('postgres://localhost:5432/Demo')
db.define_table('table', Field('field')
db.define_table('table2', Field('field')
#etc...
return db

db = cache.ram('datamodels', lambda: load_models(), time_expire=None)

My real goal is to just get the datamodel remembered between requests 
(since it'd be redundant to load it every time).  I suppose it's really 
just a process specific singleton, but it does make some difference.  Here 
are some non-scientific benchmarks I performed on my data model:

All tables defined in request: ~420ms  
All tables defined in request w/ cache hit: ~90ms

All tables defined in request (compiled app): ~350ms
All tables defined in request w/ cache hit (compiled app): ~25ms

Obviously the first request off of a cold start would be fairly slow, but 
all subsequent requests would benefit greatly.  By using caching with the 
DAL class am I potentially hurting myself in some way?


On Saturday, May 26, 2012 11:13:17 AM UTC+1, Nico de Groot wrote:
>
> Hi David,
> Got Jenkins running on mac and windows with unittests, will send you 
> details later. 
> Nico de Groot



Re: [web2py] Re: Sending email with localhost / Postfix

2012-05-26 Thread Jonathan Lundell
On May 26, 2012, at 8:41 AM, Yarin wrote:
> Got this working on the CentOS server as follows:
> 
> mail.settings.server = 'localhost:25'
> mail.settings.sender = 'y...@mail.com'
> mail.settings.login = None
> 
> 
> Massimo, please note the book says "Set mail.settings.login=False if the SMTP 
> server does not require authentication." 
> This was failing for me- It only worked when 
> mail.settings.login = None
> 

This appears to be fixed in the trunk (but it wouldn't hurt to say None in the 
book).


> On Saturday, May 26, 2012 10:24:27 AM UTC-4, Yarin wrote:
> I'm trying to send email out of web2py via localhost and Postfix, but 
> everything I try just fails silently. Having the same issue on my Mac OSX and 
> CentOS6 server, each with Postfix installed and able to send emails from the 
> command line.
> 
> I've played with variations of the following settings:
> 
> mail.settings.server='127.0.0.1:25' / 'smtp.localhost:25' / 'localhost' / 
> 'localhost:25'
> mail.settings.sender='y...@example.com'
> mail.settings.login='' / False / None
> 
> 
> Sending mail via gmail SMTP works fine, but I need local postfix capability




[web2py] Re: Sending email with localhost / Postfix

2012-05-26 Thread Yarin
Got this working on the CentOS server as follows:

mail.settings.server = 'localhost:25'
mail.settings.sender = 'y...@mail.com'
mail.settings.login = None


Massimo, please note the book says "Set mail.settings.login=False if the 
SMTP server does not require authentication." 
This was failing for me- It only worked when 
mail.settings.login = None



On Saturday, May 26, 2012 10:24:27 AM UTC-4, Yarin wrote:
>
> I'm trying to send email out of web2py via localhost and Postfix, but 
> everything I try just fails silently. Having the same issue on my Mac OSX 
> and CentOS6 server, each with Postfix installed and able to send emails 
> from the command line.
>
> I've played with variations of the following settings:
>
> mail.settings.server='127.0.0.1:25' / 'smtp.localhost:25' / 'localhost' / 
> 'localhost:25'
> mail.settings.sender='y...@example.com'
> mail.settings.login='' / False / None
>
>
> Sending mail via gmail SMTP works fine, but I need local postfix capability
>


[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Paolo Caruccio
Massimo,
from my point of view - a simple user - the web2py core must remain tied to 
its conventions and use standard protocols.
As you say, "bootstrap twitter" is one of the possible choices and then we 
will do? we will have so many switches as are the web frameworks?
For my little experience in web framework - above all those having 
javascript plugin - the html layout and css style are indispensable to each 
other.
We are discussing about the menu, but there are also the grids, forms and 
so on:should, therefore, change the code for sqlform.grid, 
sqlform.smartgrid, sqlform, or also apply a javascript function to fit this 
elements to the conventions of the preferred framework?
For me, the best choice is to have a "welcome app" as a basis for 
introducing own web2py features with its own css and layout 
and, if deemed appropriate, make an entry in the welcome app menu that link 
to different layouts inspired from several web framework (bootstrap, 
skeleton and so on) wich the user can choose to apply and adapt for his/her 
application.


Il giorno sabato 26 maggio 2012 16:37:05 UTC+2, Massimo Di Pierro ha 
scritto:
>
> For now this is in trunk. Your implementation looks good.
>
> For me the problem whether we want to do this or not. Most of the 
> conventions implemented in web2py core are web2py own conventions or 
> standard protocol.  Bootstrap is a css library. very popular today but will 
> disappear tomorrow as a better one comes out. Now everybody will use it. Is 
> it a good idea to include code which is designed exclusively for bootstap 
> conventions and specifically refers to bootstrap css classes? Or is it 
> better to handle it from the layout only using js?
>
> So we need to think about this some more. I cannot promise this will stay 
> in web2py 2.0 in this form.
>
> Massimo
>
>
>
> On Saturday, 26 May 2012 08:53:53 UTC-5, Paolo Caruccio wrote:
>>
>> Here attached the html.py with modified class MENU.
>> This is only a draft not deeply tested. 
>>
>> Il giorno sabato 26 maggio 2012 03:40:26 UTC+2, Massimo Di Pierro ha 
>> scritto:
>>>
>>> We can include this in MENU and eliminate the JS. What do you think?
>>>
>>> On Friday, 25 May 2012 15:52:50 UTC-5, Niphlod wrote:

 I may be a little lateI implemented it for my app but never used 
 because my menu has only 4 items :-P
 include bootstrap.css and add to css this (took from 
 https://github.com/twitter/bootstrap/issues/424)

 .nav li.dropdown ul.dropdown-menu li:HOVER ul {
 display:block;
 position:absolute;
 left:100%;
 -webkit-border-radius: 3px;
 -moz-border-radius: 3px;
 border-radius: 3px;
 }
 .nav li.dropdown ul.dropdown-menu ul {
 display: none;
 float:right;
 position: relative;
 top: auto;
 margin-top: -30px;
 }

 .nav li.dropdown ul.dropdown-menu .dropdown-menu::before {
 content: '';
 display: inline-block;
 border-top: 7px solid transparent;
 border-bottom: 7px solid transparent;
 border-right:7px solid #CCC;
 border-right-color: rgba(0, 0, 0, 0.2);
 position: absolute;
 top: 9px;
 left: -14px;
 }

 .nav li.dropdown ul.dropdown-menu .dropdown-menu::after {
 content: '';
 display: inline-block;
 border-top: 6px solid transparent;
 border-bottom: 6px solid transparent;
 border-right:6px solid white;
 position: absolute;
 top: 10px;
 left: -12px;
 }


 def twitter_menu(menu, level=0):
 """
 Generates twitter bootstrap's compliant menu
 """
 lis = []
 for li in menu:
 (text, active, href) = li[:3]
 sub =  len(li) > 3 and li[3] or []
 if len(sub) == 0:
 li_class = None
 el = LI(A(text, _href=href), _class=li_class)
 else:
 li_class = 'dropdown'
 caret = level == 0 and B(_class='caret') or 
 I(_class='icon-chevron-right')
 sub_ul = twitter_menu(sub, level=level+1)
 el = LI(A(text, caret, _href=href, 
 _class="dropdown-toggle", **{'_data-toggle' : 'dropdown'}), sub_ul, 
 _class=li_class)
 lis.append(el)

 if level == 0:
 return UL(*lis, _class='nav')
 else:
 return UL(*lis, _class="dropdown-menu")



[web2py] Re: Sending email with localhost / Postfix

2012-05-26 Thread Massimo Di Pierro
Something is wrong with postfilx configuration. Use a python shell and try 
the smtplib library directly. I use postfix all the time and nothing has 
change in those parts of web2py.

On Saturday, 26 May 2012 09:24:27 UTC-5, Yarin wrote:
>
> I'm trying to send email out of web2py via localhost and Postfix, but 
> everything I try just fails silently. Having the same issue on my Mac OSX 
> and CentOS6 server, each with Postfix installed and able to send emails 
> from the command line.
>
> I've played with variations of the following settings:
>
> mail.settings.server='127.0.0.1:25' / 'smtp.localhost:25' / 'localhost' / 
> 'localhost:25'
> mail.settings.sender='y...@example.com'
> mail.settings.login='' / False / None
>
>
> Sending mail via gmail SMTP works fine, but I need local postfix capability
>


[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Massimo Di Pierro
For now this is in trunk. Your implementation looks good.

For me the problem whether we want to do this or not. Most of the 
conventions implemented in web2py core are web2py own conventions or 
standard protocol.  Bootstrap is a css library. very popular today but will 
disappear tomorrow as a better one comes out. Now everybody will use it. Is 
it a good idea to include code which is designed exclusively for bootstap 
conventions and specifically refers to bootstrap css classes? Or is it 
better to handle it from the layout only using js?

So we need to think about this some more. I cannot promise this will stay 
in web2py 2.0 in this form.

Massimo



On Saturday, 26 May 2012 08:53:53 UTC-5, Paolo Caruccio wrote:
>
> Here attached the html.py with modified class MENU.
> This is only a draft not deeply tested. 
>
> Il giorno sabato 26 maggio 2012 03:40:26 UTC+2, Massimo Di Pierro ha 
> scritto:
>>
>> We can include this in MENU and eliminate the JS. What do you think?
>>
>> On Friday, 25 May 2012 15:52:50 UTC-5, Niphlod wrote:
>>>
>>> I may be a little lateI implemented it for my app but never used 
>>> because my menu has only 4 items :-P
>>> include bootstrap.css and add to css this (took from 
>>> https://github.com/twitter/bootstrap/issues/424)
>>>
>>> .nav li.dropdown ul.dropdown-menu li:HOVER ul {
>>> display:block;
>>> position:absolute;
>>> left:100%;
>>> -webkit-border-radius: 3px;
>>> -moz-border-radius: 3px;
>>> border-radius: 3px;
>>> }
>>> .nav li.dropdown ul.dropdown-menu ul {
>>> display: none;
>>> float:right;
>>> position: relative;
>>> top: auto;
>>> margin-top: -30px;
>>> }
>>>
>>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::before {
>>> content: '';
>>> display: inline-block;
>>> border-top: 7px solid transparent;
>>> border-bottom: 7px solid transparent;
>>> border-right:7px solid #CCC;
>>> border-right-color: rgba(0, 0, 0, 0.2);
>>> position: absolute;
>>> top: 9px;
>>> left: -14px;
>>> }
>>>
>>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::after {
>>> content: '';
>>> display: inline-block;
>>> border-top: 6px solid transparent;
>>> border-bottom: 6px solid transparent;
>>> border-right:6px solid white;
>>> position: absolute;
>>> top: 10px;
>>> left: -12px;
>>> }
>>>
>>>
>>> def twitter_menu(menu, level=0):
>>> """
>>> Generates twitter bootstrap's compliant menu
>>> """
>>> lis = []
>>> for li in menu:
>>> (text, active, href) = li[:3]
>>> sub =  len(li) > 3 and li[3] or []
>>> if len(sub) == 0:
>>> li_class = None
>>> el = LI(A(text, _href=href), _class=li_class)
>>> else:
>>> li_class = 'dropdown'
>>> caret = level == 0 and B(_class='caret') or 
>>> I(_class='icon-chevron-right')
>>> sub_ul = twitter_menu(sub, level=level+1)
>>> el = LI(A(text, caret, _href=href, _class="dropdown-toggle", 
>>> **{'_data-toggle' : 'dropdown'}), sub_ul, _class=li_class)
>>> lis.append(el)
>>>
>>> if level == 0:
>>> return UL(*lis, _class='nav')
>>> else:
>>> return UL(*lis, _class="dropdown-menu")
>>>
>>>

[web2py] Re: compute not working on update

2012-05-26 Thread Massimo Di Pierro
Can you please open an issue about the compute on update problem? I will 
try reproduce and fix it.

On Saturday, 26 May 2012 07:11:28 UTC-5, peter wrote:
>
> So
>
> def update_images():
> rows=db(db.image).select()
> for row in rows:
> row.update(file=row.file)
> db.commit()
>
> does work. I wrote (title=row.title) as I was a little loath to write 
> (file=row.file) as I was not sure if this was okay with 'upload' fields. 
> Clearly it is.
>
> Thinking about it more, a cleaner way of doing it is:
>
> def update_images():
> rows=db(db.image).select()
> for row in rows:
> row.update(thumb=THUMB(row['file'])
> db.commit()
>
> and bypass the compute altogether.
>
> HOWEVER I still have the strange situation that the compute gets executed 
> when one creates a new record, but does not get executed when one edits a 
> record, even when one changes the image which is stored in 'file'. the 
> editing is done by clicking the 'edit' link in SQLFORM.grid.
>
> Peter
>
>
>
>
>
> On Friday, May 25, 2012 6:50:33 PM UTC+1, peter wrote:
>>
>> I am using web2py 1.99.7 
>>
>> I have a compute as
>>
>> db.image.thumb.compute=lambda r:THUMB(r['file'])
>>
>>
>> I update the whole database 
>>
>> def update_images():
>> rows=db(db.image).select()
>> for row in rows:
>> row.update(title=row.title)
>> db.commit()
>>
>>
>> Yet, the computes have not occurred.
>>
>> Similarly if I edit a record and submit, no compute. Yet if I add a 
>> record, the compute does take place.
>>
>> Anyone any ideas why?
>>
>> Thanks
>> Peter
>>
>

[web2py] Sending email with localhost / Postfix

2012-05-26 Thread Yarin
I'm trying to send email out of web2py via localhost and Postfix, but 
everything I try just fails silently. Having the same issue on my Mac OSX 
and CentOS6 server, each with Postfix installed and able to send emails 
from the command line.

I've played with variations of the following settings:

mail.settings.server='127.0.0.1:25' / 'smtp.localhost:25' / 'localhost' / 
'localhost:25'
mail.settings.sender='y...@example.com'
mail.settings.login='' / False / None


Sending mail via gmail SMTP works fine, but I need local postfix capability


[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Niphlod
me too.
@Massimo: please feel free to use it, edit, ask, etc.

here's a small variation with mobile parameter:

def twitter_menu(menu, level=0, mobile=False):
"""
Generates twitter bootstrap's compliant menu
"""
lis = []
for li in menu:
(text, active, href) = li[:3]
sub =  len(li) > 3 and li[3] or []
if len(sub) == 0:
li_class = None
el = LI(A(text, _href=href), _class=li_class)
lis.append(el)
else:
li_class = 'dropdown'
caret = level == 0 and B(_class='caret') or 
I(_class='icon-chevron-right')
if mobile:
li_class = None
caret = B(_class='caret')
sub_ul = twitter_menu(sub, level=level)
el = LI(A(text, caret, _href=href, 
_class="dropdown-toggle", **{'_data-toggle' : 'dropdown'}), _class=li_class)
lis.append(el)
lis.extend(sub_ul)
else:
sub_ul = twitter_menu(sub, level=level+1)
el = LI(A(text, caret, _href=href, 
_class="dropdown-toggle", **{'_data-toggle' : 'dropdown'}), sub_ul, 
_class=li_class)
lis.append(el)
if level == 0:
return UL(*lis, _class='nav')
else:
if mobile:
return lis
return UL(*lis, _class="dropdown-menu")



Il giorno sabato 26 maggio 2012 10:56:10 UTC+2, Paolo Caruccio ha scritto:
>
> Do you mean to add a new MENU attribute (i.e. 'bootstrap_menu') like 
> 'mobile' and to switch by menu types?
> I think that's a good option.
>
> Il giorno sabato 26 maggio 2012 03:40:26 UTC+2, Massimo Di Pierro ha 
> scritto:
>>
>> We can include this in MENU and eliminate the JS. What do you think?
>>
>> On Friday, 25 May 2012 15:52:50 UTC-5, Niphlod wrote:
>>>
>>> I may be a little lateI implemented it for my app but never used 
>>> because my menu has only 4 items :-P
>>> include bootstrap.css and add to css this (took from 
>>> https://github.com/twitter/bootstrap/issues/424)
>>>
>>> .nav li.dropdown ul.dropdown-menu li:HOVER ul {
>>> display:block;
>>> position:absolute;
>>> left:100%;
>>> -webkit-border-radius: 3px;
>>> -moz-border-radius: 3px;
>>> border-radius: 3px;
>>> }
>>> .nav li.dropdown ul.dropdown-menu ul {
>>> display: none;
>>> float:right;
>>> position: relative;
>>> top: auto;
>>> margin-top: -30px;
>>> }
>>>
>>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::before {
>>> content: '';
>>> display: inline-block;
>>> border-top: 7px solid transparent;
>>> border-bottom: 7px solid transparent;
>>> border-right:7px solid #CCC;
>>> border-right-color: rgba(0, 0, 0, 0.2);
>>> position: absolute;
>>> top: 9px;
>>> left: -14px;
>>> }
>>>
>>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::after {
>>> content: '';
>>> display: inline-block;
>>> border-top: 6px solid transparent;
>>> border-bottom: 6px solid transparent;
>>> border-right:6px solid white;
>>> position: absolute;
>>> top: 10px;
>>> left: -12px;
>>> }
>>>
>>>
>>> def twitter_menu(menu, level=0):
>>> """
>>> Generates twitter bootstrap's compliant menu
>>> """
>>> lis = []
>>> for li in menu:
>>> (text, active, href) = li[:3]
>>> sub =  len(li) > 3 and li[3] or []
>>> if len(sub) == 0:
>>> li_class = None
>>> el = LI(A(text, _href=href), _class=li_class)
>>> else:
>>> li_class = 'dropdown'
>>> caret = level == 0 and B(_class='caret') or 
>>> I(_class='icon-chevron-right')
>>> sub_ul = twitter_menu(sub, level=level+1)
>>> el = LI(A(text, caret, _href=href, _class="dropdown-toggle", 
>>> **{'_data-toggle' : 'dropdown'}), sub_ul, _class=li_class)
>>> lis.append(el)
>>>
>>> if level == 0:
>>> return UL(*lis, _class='nav')
>>> else:
>>> return UL(*lis, _class="dropdown-menu")
>>>
>>>

[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Niphlod
me too.
@Massimo, feel free to use it
here's a small variation with mobile parameter:

def twitter_menu(menu, level=0, mobile=False):
"""
Generates twitter bootstrap's compliant menu
"""
lis = []
for li in menu:
(text, active, href) = li[:3]
sub =  len(li) > 3 and li[3] or []
if len(sub) == 0:
li_class = None
el = LI(A(text, _href=href), _class=li_class)
lis.append(el)
else:
li_class = 'dropdown'
caret = level == 0 and B(_class='caret') or 
I(_class='icon-chevron-right')
if mobile:
li_class = None
caret = B(_class='caret')
sub_ul = twitter_menu(sub, level=level)
el = LI(A(text, caret, _href=href, 
_class="dropdown-toggle", **{'_data-toggle' : 'dropdown'}), _class=li_class)
lis.append(el)
lis.append(sub_ul)
else:
sub_ul = twitter_menu(sub, level=level+1)
el = LI(A(text, caret, _href=href, 
_class="dropdown-toggle", **{'_data-toggle' : 'dropdown'}), sub_ul, 
_class=li_class)
lis.append(el)
if level == 0:
return UL(*lis, _class='nav')
else:
if mobile:
return lis
return UL(*lis, _class="dropdown-menu")

Il giorno sabato 26 maggio 2012 10:56:10 UTC+2, Paolo Caruccio ha scritto:
>
> Do you mean to add a new MENU attribute (i.e. 'bootstrap_menu') like 
> 'mobile' and to switch by menu types?
> I think that's a good option.
>
>
>>

[web2py] Re: cpdb errors

2012-05-26 Thread mart
the first message is expected because of this import:

try:

from gluon import DAL

except ImportError as err:

print('gluon path not found')  
It wants to assume that that gluon is already loaded as part of the web2py 
environment (or as part of some other environment, like Aptana for example) 
and that you already have /gluon in your path (maybe even hard coded). If 
the gluon path is not set, well, you will get that "gluon path not found" 
message and the -d option will be expected. Because the -d option is 
expecting a *relative* path, your cmd line args will look different 
depending on the environment in which you are running the script. 

Hum... I guess being relative is relative ;) 

So, as an example, if you were to run this cmd from a simple bash shell 
(outside of any dev environment, or outside of a web2py context), you would 
simply cd and drill down into .../blabla/.../web2py/scripts/. In which 
case, your -d option would look like this:
-d ../gluon.  

I just did this, and it all worked fine:


macMart:Documents mart$ cd Aptana\ Studio\ Workspace/_p4/src/web2py/scripts/

macMart:scripts mart$ python cpdb.py -f ../../db_storage -d ../gluon -y 
sqlite://storage.sqlite -Y sqlite://storage2.sqlite -F ../../db_storage2

gluon path not found<== THIS IS AN EXPECTED MESSAGE

creating tables...

exporting data...

importing data...

done!


Hope it helps and that it makes sense!

Mart :)

On Thursday, May 17, 2012 2:00:08 AM UTC-7, backseat wrote:
>
> I'm trying to copy a database from Sqlite to MySQL using the cpdb.py 
> script. In the manual, it states: 
>
> cd web2py 
> python scripts/cpdb.py \ 
>-f applications/app/databases \ 
>-y 'sqlite://storage.sqlite' \ 
>-Y 'postgresql://username:password@hocalhost/mydb' 
>
> However, if I do that I get "gluon path not found". The help file suggests 
> that I can specify the path to dal.py with -d, but: 
>
> python scripts/cpdb.py -d gluon/dal.py -f applications/pytrack2/databases 
> -y 'sqlite://storage.sqlite' -Y 
> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
> gluon path not found 
> EXCEPTION: could not set DAL 
> No module named dal 
>
> If I use '-d gluon', it's better but now fails with a MySQL error (which I 
> think relates to foreign keys), although it still gives the 'gluon path 
> not found' error: 
>
> $ python scripts/cpdb.py -d gluon -f applications/pytrack2/databases -y 
> 'sqlite://storage.sqlite' -Y 
> 'mysql://pytrack2:pytrack2@localhost/pytrack2' 
> gluon path not found 
> creating tables... 
> EXCEPTION: could not make a copy of the database 
> (1005, u"Can't create table 'pytrack2.t_companies_archive' (errno: 150)") 
>
> I'm going to continue by migrating by hand; if I should report this 
> elsewhere or if you need more details, let me know. 
> -- 
> "You can have everything in life you want if you help enough other people 
> get what they want" - Zig Ziglar. 
>
> Who did you help today? 
>


[web2py] java class path

2012-05-26 Thread Marian Siwiak
Hello,

I am trying to add java applet to my application. I have problem with 
pointing the page to proper path. In and old thread I found Massimo's code 
like:

   

my question is: where does this path actually start? I have myJavaApp.call 
file and some config files, but I have no idea where to place them. 
JavaConsole says Java tries to search for them in:

network: Cache entry not found [url: 
http://127.0.0.1:8000/MyApp/default/some/furhter/path/myJavaApp.class

but I didn't find a way to place it there.

Help would be much appreciated.

best regards,
Marian




[web2py] Re: compute not working on update

2012-05-26 Thread peter
So

def update_images():
rows=db(db.image).select()
for row in rows:
row.update(file=row.file)
db.commit()

does work. I wrote (title=row.title) as I was a little loath to write 
(file=row.file) as I was not sure if this was okay with 'upload' fields. 
Clearly it is.

Thinking about it more, a cleaner way of doing it is:

def update_images():
rows=db(db.image).select()
for row in rows:
row.update(thumb=THUMB(row['file'])
db.commit()

and bypass the compute altogether.

HOWEVER I still have the strange situation that the compute gets executed 
when one creates a new record, but does not get executed when one edits a 
record, even when one changes the image which is stored in 'file'. the 
editing is done by clicking the 'edit' link in SQLFORM.grid.

Peter





On Friday, May 25, 2012 6:50:33 PM UTC+1, peter wrote:
>
> I am using web2py 1.99.7 
>
> I have a compute as
>
> db.image.thumb.compute=lambda r:THUMB(r['file'])
>
>
> I update the whole database 
>
> def update_images():
> rows=db(db.image).select()
> for row in rows:
> row.update(title=row.title)
> db.commit()
>
>
> Yet, the computes have not occurred.
>
> Similarly if I edit a record and submit, no compute. Yet if I add a 
> record, the compute does take place.
>
> Anyone any ideas why?
>
> Thanks
> Peter
>


[web2py] Re: Stripe javascript and form

2012-05-26 Thread james c.
Hi Massimo,
 
Thanks for the answere. The documention available was clear to me 
that the stripe APIs are to be used in the controller. I'm just trying to 
understand if anyone is using the stripe supplied javascript, with Web2py. 
Stripe's javascript is for sending the credit card data to stripe for 
*validation 
*and then receiving back a validated token. Yes, the stripe javascript is 
not doing payment processing. The stripe javascript then posts the 
validated token to the controller which uses the Stripe.API to make the 
charge. Using the javascript for validation is stripe's recommend. At the 
very least the stripe suplied javascript, it looks like, is causing some 
problems with superfish.
 
It sounds like the present approach is for the controller to do 
everything and I believe I can implement that solution. However, I'd rather 
follow stripes's recommendations, and use their javascript to do the 
pre-processing. I'll put some more time into the javascript problem and, if 
I can, post back a solution.
 
best regards, James
 
That would be sent by the controller.
On Friday, May 25, 2012 6:42:30 PM UTC-7, Massimo Di Pierro wrote:

> We use in web2py.com/pdfbuy
>
> the API in gluon/contrib/stripe.py are designed to be called from the 
> controller, not from the javascript.
>
> On Friday, 25 May 2012 18:07:33 UTC-5, james c. wrote:
>>
>> Thanks for including Stripe APIs in Web2Py.
>>  
>> Stripe provides from its' Web site a form and javascript template that 
>> collects, clients browser, the credit card information, ships it off to 
>> stripe for validation, and then returns the validated
>> credit card information as a token via a post to the Web2Py controller.
>>  
>> This script looks like it is generating superfish related errors, and it 
>> looks like there are errors related to where the script wants return the 
>> token.
>>  
>> Has anyone used the Stripe script with Web2Py? Or, was Stripe API for 
>> Web2PY tested assuming a client form is just going to collect the credit 
>> card information and return that to the controller?
>>  
>> thanks in advance for any recommendations, James
>>
>

[web2py] Questions for an application with a large number of features and a large database.

2012-05-26 Thread Nico de Groot
Hi David,
Got Jenkins running on mac and windows with unittests, will send you details 
later. 
Nico de Groot


[web2py] Re: Anyone using BootSwatch with new web2py layout

2012-05-26 Thread Paolo Caruccio
Do you mean to add a new MENU attribute (i.e. 'bootstrap_menu') like 
'mobile' and to switch by menu types?
I think that's a good option.

Il giorno sabato 26 maggio 2012 03:40:26 UTC+2, Massimo Di Pierro ha 
scritto:
>
> We can include this in MENU and eliminate the JS. What do you think?
>
> On Friday, 25 May 2012 15:52:50 UTC-5, Niphlod wrote:
>>
>> I may be a little lateI implemented it for my app but never used 
>> because my menu has only 4 items :-P
>> include bootstrap.css and add to css this (took from 
>> https://github.com/twitter/bootstrap/issues/424)
>>
>> .nav li.dropdown ul.dropdown-menu li:HOVER ul {
>> display:block;
>> position:absolute;
>> left:100%;
>> -webkit-border-radius: 3px;
>> -moz-border-radius: 3px;
>> border-radius: 3px;
>> }
>> .nav li.dropdown ul.dropdown-menu ul {
>> display: none;
>> float:right;
>> position: relative;
>> top: auto;
>> margin-top: -30px;
>> }
>>
>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::before {
>> content: '';
>> display: inline-block;
>> border-top: 7px solid transparent;
>> border-bottom: 7px solid transparent;
>> border-right:7px solid #CCC;
>> border-right-color: rgba(0, 0, 0, 0.2);
>> position: absolute;
>> top: 9px;
>> left: -14px;
>> }
>>
>> .nav li.dropdown ul.dropdown-menu .dropdown-menu::after {
>> content: '';
>> display: inline-block;
>> border-top: 6px solid transparent;
>> border-bottom: 6px solid transparent;
>> border-right:6px solid white;
>> position: absolute;
>> top: 10px;
>> left: -12px;
>> }
>>
>>
>> def twitter_menu(menu, level=0):
>> """
>> Generates twitter bootstrap's compliant menu
>> """
>> lis = []
>> for li in menu:
>> (text, active, href) = li[:3]
>> sub =  len(li) > 3 and li[3] or []
>> if len(sub) == 0:
>> li_class = None
>> el = LI(A(text, _href=href), _class=li_class)
>> else:
>> li_class = 'dropdown'
>> caret = level == 0 and B(_class='caret') or 
>> I(_class='icon-chevron-right')
>> sub_ul = twitter_menu(sub, level=level+1)
>> el = LI(A(text, caret, _href=href, _class="dropdown-toggle", 
>> **{'_data-toggle' : 'dropdown'}), sub_ul, _class=li_class)
>> lis.append(el)
>>
>> if level == 0:
>> return UL(*lis, _class='nav')
>> else:
>> return UL(*lis, _class="dropdown-menu")
>>
>>