[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread cjrh
On Monday, January 10, 2011 6:36:18 AM UTC+2, Anthony wrote:

 On Sunday, January 9, 2011 1:24:02 AM UTC-5, Graham Dumpleton wrote: 

  You guys really just got to learn to do your own thing and not treating 
 it like a crusade where you have to convert the world.

  
 But that's exactly the problem -- web2py is trying to do its own thing, 


...so far so good...
 

 and there is a vocal clique of Pythonistas who don't like that thing and 
 want to stop it. 


...and here we get it wrong.  Why should we *care* about this vocal clique? 
 Arguing on reddit and other forums about the minutae of tit-for-tat 
features is almost entirely pointless.  It convinces nobody, *least* of all 
the newbies who are still trying to decide on which framework to use.  And 
this is something else that bothers me.  *Why* should we care how many users 
we have?  It seems to me an entirely pointless objective.   I care only 
about trying to make web2py *my* favourite platform for web apps.   In an 
online discussion between proponents of different frameworks, or different 
*anything* for that matter, there is precious little to be gained from 
arguing the case.  That is just how it is.

If we say we just want to do our own thing, then let's do just that. 
Seriously, going after spurious comments in every reddit or reddit-alike is 
*harmful*.  Getting the truth out there has a lot of side effects, and 
they're not all good.   The best, and IMO only real way to promote web2py is 
to facilitate the building of awesome websites.  That is the whole ball 
game, so let's focus on that.   

This is, I suppose, obligatory: http://xkcd.com/386/ 

Graham is in a unique position in that wsgi is used by all the frameworks 
and so he wears a badge that allows him to move freely between them without 
carrying any baggage, and he clearly gets to see how each of the communities 
function.  It is important for us to listen to what he has to say, because 
we will not get such feedback from anywhere else I can think of.


[web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Valter Foresto
Many thanks Anthony,

Firstly I changed the default in 'gluon/sqlhtml.py' with 'truncate=32' on 
line 1312.
Using '{{=records}}' in the view and, after restart web2py from source, all 
the string fields are truncated only after 32 characters.
This solve effectively the problem without change in the view. 

Secondly I tried the powerfull programmatically version you suggest, using 
'{{=SQLTABLE(records, 
truncate=19)}}' with the following ticket :

   File gluon/sqlhtml.py, line 1329, in __init__
   AttributeError: 'SQLTABLE' object has no attribute 'colnames'
At line 1329:
   columns = sqlrows.colnames
I think 'colnames' is not an attribute of sqlrows ... and I'm looking to find 
that, I very appreciate if you have some idea also about this issue.

-- Valter 




Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Martín Mulone
Also you can pass truncate=None and use field.represent and make your own
field representation. What version of web2py?. You are not mixing this
sqlhtml.py file (trunk) with older web2py version?.

2011/7/8 Valter Foresto valter.fore...@gmail.com

 Many thanks Anthony,

 Firstly I changed the default in 'gluon/sqlhtml.py' with 'truncate=32' on
 line 1312.
 Using '{{=records}}' in the view and, after restart web2py from source, all
 the string fields are truncated only after 32 characters.
 This solve effectively the problem without change in the view.

 Secondly I tried the powerfull programmatically version you suggest, using
 '{{=SQLTABLE(records, truncate=19)}}' with the following ticket :

File gluon/sqlhtml.py, line 1329, in __init__
AttributeError: 'SQLTABLE' object has no attribute 'colnames'
 At line 1329:
columns = sqlrows.colnames
 I think 'colnames' is not an attribute of sqlrows ... and I'm looking to find 
 that, I very appreciate if you have some idea also about this issue.

 -- Valter





-- 
 http://martin.tecnodoc.com.ar


Re: [web2py] Re: Metaprogramming in controller

2011-07-08 Thread Miguel Lopes
:-)

On Fri, Jul 8, 2011 at 2:25 AM, Massimo Di Pierro 
massimo.dipie...@gmail.com wrote:

 yes. even better use router (vs routes)

 On Jul 6, 10:03 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
  Humm,
 
  Nice. Yes, closures are enough, and cleaner too.
  Is routes OK for production mode?
  Txs,
  Miguel
 
  On Wed, Jul 6, 2011 at 3:54 PM, Massimo Di Pierro 
 
 
 
 
 
 
 
  massimo.dipie...@gmail.com wrote:
   Jonathan is right. Here is a simple way around.
 
   Create a single controller called dynamical. use request.args(0) to
   parse the name of one of the dynamical actions and remap
 
   def dynamical():
   actionname, request.args[:] = request.args(0), request.args[1:]
   # call actionname and pass request.args and request.vars
 
   use routes to remove the 'dynamical/' part form the URL.
 
   This allows you to do what you want without necessarily meta-
   programming.
 
   On Jul 6, 9:35 am, Miguel Lopes mig.e.lo...@gmail.com wrote:
Thanks. In conjunction with routes could supply a solution
 (shortening
   the
urls).
I think I should rethink the payoff (see my reply to Massimo
 regarding my
goals).
Thanks,
Miguel
 
On Wed, Jul 6, 2011 at 3:12 PM, Jonathan Lundell jlund...@pobox.com
 
   wrote:
 On Jul 6, 2011, at 1:23 AM, Miguel Lopes wrote:
 
 I'm experimenting with dynamically generating functions, aka
 'actions'
   in
 controllers. However, I've been unsuccessful. I can use exec and
   closures
 successfully in regular Python code, but I can't make it work with
   web2py.
 Any thoughts on how to achieve this?
 
 web2py finds functions by reading the (static) controller file
 itself.
   See
 gluon.compileapp.run_controller_in, in particular this line:
 
 exposed = regex_expose.findall(code)
 
 So, no dynamically generated controller actions, at least not
 directly.
 
 I haven't given this much thought, but one way you might accomplish
 the
 same effect would be to push the dynamic function name down one
 level
   in the
 URL, something like:http://domain.com/app/dynamic/index/function/.
 ..
 
 ...where 'dynamic' is the controller with dynamic functions, and
 index
   is a
 (static) function that calls function dynamically. You might
 optimize
   the
 lookup function to extract only the one desired function from your
 page
 table.
 
 Depending on your overall URL structure, you could rewrite the URLs
 to
 shorten them up.
 
 A closure example - FAILS in web2py:
 top_pages = db(db.page.id  0).select()
 def add_actions(top_pages):
 for page in top_pages:
 def inneraction(msg):
 sidebar = None
 return dict(message=msg, sidebar=sidebar)
 inneraction.__name__ = page.link_name
 globals()[page.link_name] = inneraction
 
 add_actions(top_pages)
 
 A exec example - FAILS in web2py:
 
 ACTION_TEMPLATE = 
  def NEW_ACTION():
 sidebar = None
 return dict(message='s', sidebar=sidebar)
  
 top_pages = db(db.page.id  0).select()
 def makePages(pages):
 for page in top_pages:
 exec ACTION_TEMPLATE
 NEW_ACTION.__name__ = page.link_name
 globals()[page.link_name] = NEW_ACTION
 
 makePages(pages)
 
 Miguel



Re: [web2py] Re: A catchall action per controller - would be proposal

2011-07-08 Thread Miguel Lopes
Yes. That's what I meant. Thank you for making it much clearer.

Like you mention the benefit is unclear. This makes it unnecessary to toy
with routes or router, which I believe is in the spirit of web2py and
benefits beginners with one less location to edit, thing to learn (routes
rules vs. simply overriding a magic function). On the other hand, this is
use case is arguably uncommon and advanced, a clean solution exists, and
__catchall() can be seem as very magical and just adding more to the inner
plumbings of web2py.

Because I'm unsure of the value of the idea I posted the suggestion.
However, after considering better routes/router arguments and the fact that
they do not impose a real penalty on performance this is likely unnecessary.

Miguel


On Thu, Jul 7, 2011 at 6:28 PM, Anthony abasta...@gmail.com wrote:

 Are you suggesting the possibility of defining a function like:

 def __catchall():
 # do stuff
 return dict(...)

 in a controller, and any time a request comes in for a function that
 doesn't exist in the controller, web2py looks for a function called
 __catchall, and if it exists, passes the request to that function (and
 converts the function part of the url to the first argument, so the
 __catchall function knows what to do with the request)?

 What is the benefit of that over using routes and simply specifying a
 default function (which would then not have to appear in URLs)?

 Anthony


 On Thursday, July 7, 2011 3:52:08 AM UTC-4, miguel wrote:

 Yesterday I posted about implementing dynamic actions (functions) in a
 controller.
 This is interesting because one can achieve clean urls, instead of passing
 the names of the dynamic pages in args or vars. In a system with a cms this
 has the benefit of user defined pages being indistinguishable from extant
 hard-coded actions (if any).

 However, given the static nature of controllers (they are compiled with
 web2py) this cannot be achieved with closures or metaprogramming. The
 solution is to use routes to hide a dispatching action. It maybe possible to
 add to the controller namespace at runtime (but it is beyond my knowledge to
 explore this).

 This made me think that controllers might allow for the implementation
 (override?) a single dynamic action that would serve as a catchall for calls
 to non defined actions. I wonder if there as been any debate on this sort of
 built-in default action? This would supply a way to dealt with all calls
 that have no defined action per controller (including errors) without having
 to use routes. A small idea that perhaps does not bring enough benefits to
 be argued for. What do you think?

 Miguel




R: Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Valter Foresto
I'm using the last version souces of web2py - Version 1.97.1 (2011-06-26 
19:25:44) .

With the view:
   {{extend 'layout.html'}}
   {{=SQLTABLE(records, truncate=None)}}
I get the Traceback (most recent call last):

  File C:\Users\valter\Desktop\ALTECH\web2py\web2py\gluon\restricted.py, line 
192, in restricted
exec ccode in environment
  File 
C:\Users\valter\Desktop\ALTECH\web2py\web2py\applications\ALTECH\views\default/current_alarms.html,
 line 103, in module
  File C:\Users\valter\Desktop\ALTECH\web2py\web2py\gluon\sqlhtml.py, line 
1329, in __init__
columns = sqlrows.colnames
AttributeError: 'SQLTABLE' object has no attribute 'colnames'


If I change the 'truncate' default in the 'sqlhtml.py' and use '{{=records}}'  
in the view all work fine.

Many thanks Martin, I believe SQLTABLE is a great tool and hope to use it 
more but, actually, I'm not able to solve the error described above.

-- Valter




[web2py] Re: Passing JavaScript variable to web2py session variable?

2011-07-08 Thread Ross Peoples
You're doing it right, but there are a couple of things to keep in mind. 
Using $.post(url, {input_n: input_number}); is easier than using $.ajax, but 
that's merely preference. The other thing you should know is that if a 
web2py ticket is generated during an AJAX call, you will not know about it. 
The call will appear to do nothing, which sounds like what you described.

Whenever I make an AJAX call, this is how I usually do it:

jQuery.post(url, {myvar: myvalue}, function(data) {
// do something with the returned data from server (only gets called if 
call was successful).
}).error(function(data) {
// error is usually HTML, so convert it to plain text for the alert() 
function.
alert(data.replace(/(.*?)/ig,));
});

This way, you will know if AJAX was successful or failed.


[web2py] Re: Passing JavaScript variable to web2py session variable?

2011-07-08 Thread Vasil Petkov
On Jul 8, 3:02 pm, Ross Peoples ross.peop...@gmail.com wrote:
 You're doing it right, but there are a couple of things to keep in mind.
 Using $.post(url, {input_n: input_number}); is easier than using $.ajax, but
 that's merely preference. The other thing you should know is that if a
 web2py ticket is generated during an AJAX call, you will not know about it.
 The call will appear to do nothing, which sounds like what you described.

 Whenever I make an AJAX call, this is how I usually do it:

 jQuery.post(url, {myvar: myvalue}, function(data) {
     // do something with the returned data from server (only gets called if
 call was successful).}).error(function(data) {

     // error is usually HTML, so convert it to plain text for the alert()
 function.
     alert(data.replace(/(.*?)/ig,));

 });

 This way, you will know if AJAX was successful or failed.

Hello!

I would like to save the JavaScript variable to a web2py session
variable.

I have tried the following in my view (that has no controller
associated with it):

function submit_form(input_number, input_egn) {
$('input#user_input_number').val(input_number);
$('input#user_input_egn').val(input_egn);
$.ajax({
type: POST,
url: http://127.0.0.1:8000/games/xs-software/vaucher.html;,
data: {game_id : $
('input#user_input_number').val(input_number)}
success: function(msg){
alert( Data Saved:  + msg );
}
});
{{session.game_id = 4}}
{{if request.vars['game_id']:
session.game_id = request.vars['game_id']}}
$('form:first').submit();
return false;
}

, but i receice the following error traceback:

1 Traceback (most recent call last):
2   File /home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py, line 1064, in run
3 self.run_app(conn)
4   File /home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py, line 1531, in run_app
5 self.environ = environ = self.build_environ(sock_file, conn)
6   File /home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py, line 1363, in build_environ
7 request = self.read_request_line(sock_file)
8   File /home/vpetkov/Documents/cashterminal_new/terminal/gluon/
rocket.py, line 1138, in read_request_line
9 raise SocketTimeout(Socket timed out before request.)
10 SocketTimeout: Socket timed out before request.

I mean, does web2py has a way to RECEIVE JavaScript variables FROM
Python/web2py templates? Where are they stored? And how to call these
JavaScript variables inside {{ }} in a web2py view/template?

 Thank you in advance for your answers!


[web2py] conditional {{include}} in view

2011-07-08 Thread Kernc
Ok, so this is my setup:

I have article() function inside default controller, which obtains
article title in request.args, puts ('articles/'+str(request.args[0])
+'.html') into returned dict(article=...), and serves appropriate
article's HTML from article.html with

!-- various common tags along with body above and /html below...
--
article
{{include article}}!-- includes the right article/with-some-
title.html --
/article
!-- ... --

For example, if I access http://domain/article/with-some-title, it
renders views/articles/with-some-title.html.
I like that. :-)

But then I have /about URL, which calls about() function inside
default controller, but which I would like to use the same article
template from article.html, i.e. to follow DRY.

So I have tried to put my content in about.html in a variable
{{article_content = MARKMIN('About us...')}} and then {{include}}
modified article.html

article
{{if article_content:}}{{=article_content}}{{pass}}{{else}}{{include
article}}{{pass}}
/article

(Besides {{if article_content:}} I tried with try-except too. Neither
worked.)
When accessing /about, the ticket told me the error was in undefined
'article' variable in the include expression.

So I tried it another way, by defining block with default content in
article.html

{{block article_content}}{{include article}}{{end}}

and extending article.html in about.html

{{extend 'article.html'}}{{block article_content}}{{=MARKMIN('About
us...')}}{{end}}

As per documentation, default value inside {{block}} (in my case
'{{include article}}') should be replaced with specified value (in
my case {{=MARKMIN(...)}}). But again, the ticket reports the same
error:

  ...
  File /home//web2py/gluon/template.py, line 449, in include
text = self._get_file_text(filename)
  File /home//web2py/gluon/template.py, line 430, in
_get_file_text
filename = eval(filename, self.context)
  File string, line 1, in module
NameError: name 'article' is not defined

To avoid using {{include}}, the next thing I am about to try is:

{{block article_contents}}{{if article:}}{{=open(article).read()}}
{{pass}}{{end}}

but this way I have to maintain os.getcwd() and annote the article
with proper path to my views. I don't know how stable this is.

Inexperienced as I am, I'm assuming it's possible I'm doing something
horribly wrong. What is that? :-)

TL;DR: The templating system counter-intuitively gives unconditional
priority to {{include}} expressions, which it evaluates first.

Oh, and if you can please tell me how I can make the about() function
to use the article.html view instead of default about.html view, that
would solve my DRY problem as well, I suppose. :-)

Thanks!


[web2py] Re: Passing JavaScript variable to web2py session variable?

2011-07-08 Thread Ross Peoples
Going from web2py - JavaScript is easy:

{{=var}}

However, going from JavaScript - web2py requires an AJAX call. Since 
JavaScript is run on the user's machine and not the web server, the two 
machines have to communicate somehow, which is where AJAX comes in. You 
should also know that things inside {{ }} will NOT run on the user's 
machine. So if you are expecting something in these blocks to happen after 
the page loads, it won't work and you have to use AJAX.


[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread Anthony
On Friday, July 8, 2011 3:25:45 AM UTC-4, cjrh wrote: 

 On Monday, January 10, 2011 6:36:18 AM UTC+2, Anthony wrote: 

 On Sunday, January 9, 2011 1:24:02 AM UTC-5, Graham Dumpleton wrote: 

  You guys really just got to learn to do your own thing and not treating 
 it like a crusade where you have to convert the world.

  
 But that's exactly the problem -- web2py is trying to do its own thing, 


 ...so far so good...
  

 and there is a vocal clique of Pythonistas who don't like that thing and 
 want to stop it. 


 ...and here we get it wrong.  Why should we *care* about this vocal 
 clique?

 
Well, we probably shouldn't care too much, but that doesn't mean we 
shouldn't care at all. Note, the unfounded criticisms are effectively 
impugning both the technical and personal integrity of web2py's developers 
and users, in very public forums. This can have negative professional (and 
personal) consequences. If you have chosen to build an app with web2py and 
your client, manager, or investor reads bad things about web2py, you may 
lose their confidence and favor. So, occassional polite and professional 
corrections may be appropriate, especially on purely factual 
misunderstandings (rather than issues of opinion and taste).
 

 *Why* should we care how many users we have?

 
Again, this is not the most important thing, but the number of users is not 
entirely without consequence either. Generally, more users will translate 
into more expert contributors and volunteers, which will contribute to the 
development of the framework and its ecosystem and to its long-term 
sustainability (i.e., more features, better testing and performance, better 
documentation, more plugins and applications, better support, more 
third-party hosting and development tool support, etc.). In many cases, when 
you select a framework, you want some confidence that it will still be 
actively maintained several years hence, and that confidence will be 
bolstered if there is a sizable and active community around it.
 

 The best, and IMO only real way to promote web2py is to facilitate the 
 building of awesome websites.  That is the whole ball game, so let's focus 
 on that.

 
Absolutely. :-)
 


[web2py] Re: conditional {{include}} in view

2011-07-08 Thread Anthony
First, if you want to use a particular view, you can always explicitly 
assign response.view:
 
def about():
response.view='default/article.html' # This view will be used instead of 
'default/about.html'.
# more code
return dict(...)
 
Also, note that the {{include}} statement is not a Python statement -- it is 
processed by the template engine before everything is converted to Python. 
So, if you have an {{include 'someview.html'}} inside an if statement, the 
'someview.html' template will still be included in the assembled Python 
code, though it will only be executed conditionally (based on the condition 
of the if statement). Also, because of this, although you may use variables 
in your {{include}} statements, as you have, usage of variables prevents 
bytecode compiling of the views. The reason is that the included views have 
to be determined at compile time, but the value of the variables is not 
known until run time.
 
In the places where you are getting the error about 'article' not being 
defined, I assume your controller action is not actually returning a 
variable called 'article' to the view. If you need to conditionally test 
whether a particular variable is available in a view, you can do {{if 
'article' in response._vars:}} or {{if 'article' in globals():}}.
 
Anthony
 

On Friday, July 8, 2011 2:07:16 AM UTC-4, Kernc wrote:

 Ok, so this is my setup: 

 I have article() function inside default controller, which obtains 
 article title in request.args, puts ('articles/'+str(request.args[0]) 
 +'.html') into returned dict(article=...), and serves appropriate 
 article's HTML from article.html with 

 !-- various common tags along with body above and /html below... 
 -- 
 article 
 {{include article}}!-- includes the right article/with-some- 
 title.html -- 
 /article 
 !-- ... -- 

 For example, if I access http://domain/article/with-some-title, it 
 renders views/articles/with-some-title.html. 
 I like that. :-) 

 But then I have /about URL, which calls about() function inside 
 default controller, but which I would like to use the same article 
 template from article.html, i.e. to follow DRY. 

 So I have tried to put my content in about.html in a variable 
 {{article_content = MARKMIN('About us...')}} and then {{include}} 
 modified article.html 

 article 
 {{if article_content:}}{{=article_content}}{{pass}}{{else}}{{include 
 article}}{{pass}} 
 /article 

 (Besides {{if article_content:}} I tried with try-except too. Neither 
 worked.) 
 When accessing /about, the ticket told me the error was in undefined 
 'article' variable in the include expression. 

 So I tried it another way, by defining block with default content in 
 article.html 

 {{block article_content}}{{include article}}{{end}} 

 and extending article.html in about.html 

 {{extend 'article.html'}}{{block article_content}}{{=MARKMIN('About 
 us...')}}{{end}} 

 As per documentation, default value inside {{block}} (in my case 
 '{{include article}}') should be replaced with specified value (in 
 my case {{=MARKMIN(...)}}). But again, the ticket reports the same 
 error: 

   ... 
   File /home//web2py/gluon/template.py, line 449, in include 
 text = self._get_file_text(filename) 
   File /home//web2py/gluon/template.py, line 430, in 
 _get_file_text 
 filename = eval(filename, self.context) 
   File string, line 1, in module 
 NameError: name 'article' is not defined 

 To avoid using {{include}}, the next thing I am about to try is: 

 {{block article_contents}}{{if article:}}{{=open(article).read()}} 
 {{pass}}{{end}} 

 but this way I have to maintain os.getcwd() and annote the article 
 with proper path to my views. I don't know how stable this is. 

 Inexperienced as I am, I'm assuming it's possible I'm doing something 
 horribly wrong. What is that? :-) 

 TL;DR: The templating system counter-intuitively gives unconditional 
 priority to {{include}} expressions, which it evaluates first. 

 Oh, and if you can please tell me how I can make the about() function 
 to use the article.html view instead of default about.html view, that 
 would solve my DRY problem as well, I suppose. :-) 

 Thanks!



[web2py] Re: Passing JavaScript variable to web2py session variable?

2011-07-08 Thread ron_m
You need to have the AJAX URL formed in a way that invokes a controller.

eg /application_name/controller_name/function_name/arg0/arg1 .

and include the variable(s) you want to send back. The variables can be 
either addition items after the function as above where they show up as args 
or if they are part of a form POST then the variables would be in the vars 
dict.

The controller will then validate the variables if need be and store what it 
needs to in the session. You don't need a view for this.


Re: R: Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Anthony
Can you show the code that produces the 'records' object -- it looks like 
it's already a SQLTABLE object rather than a DAL Rows object.
 
Anthony

On Friday, July 8, 2011 7:53:08 AM UTC-4, Valter Foresto wrote:

 I'm using the last version souces of web2py - Version 1.97.1 (2011-06-26 
 19:25:44) .

 With the view:
{{extend 'layout.html'}}
{{=SQLTABLE(records, truncate=None)}}
 I get the Traceback (most recent call last):

   File C:\Users\valter\Desktop\ALTECH\web2py\web2py\gluon\restricted.py, 
 line 192, in restricted
 exec ccode in environment
   File 
 C:\Users\valter\Desktop\ALTECH\web2py\web2py\applications\ALTECH\views\default/current_alarms.html,
  line 103, in module
   File C:\Users\valter\Desktop\ALTECH\web2py\web2py\gluon\sqlhtml.py, line 
 1329, in __init__
 columns = sqlrows.colnames
 AttributeError: 'SQLTABLE' object has no attribute 'colnames'


 If I change the 'truncate' default in the 'sqlhtml.py' and use '
 {{=records}}'  in the view all work fine.

 Many thanks Martin, I believe SQLTABLE is a great tool and hope to use it 
 more but, actually, I'm not able to solve the error described above.

 -- Valter




[web2py] New Plugin: plugin_ckeditor

2011-07-08 Thread Ross Peoples
This will be my second public plugin release. I will put it up on BitBucket 
soon, but for now, I thought I would introduce a new plugin I've been 
working on. Sometimes you just need a WYSIWYG editor. This plugin integrates 
CKEditor into web2py. It acts much like the Auth object in its usage. For 
example, in your model, you need to import and initialize it:

from plugin_ckeditor import CKEditor
ckeditor = CKEditor(db)
ckeditor.define_tables()

It's most basic usage is to assign it to a Field widget:

db.define_table('content',
Field('title', length=255),
Field('public', 'boolean', default=True),
Field('text', 'text', widget=ckeditor.widget)
)

The CKEditor now automatically becomes available every time SQLFORM is used. 
This is a screen shot of it in action:

https://lh4.googleusercontent.com/-HLLFte_tXCw/ThclwgF-TtI/AC8/cu3qqcUuDeE/Screen%252520shot%2525202011-07-08%252520at%25252011.01.36%252520AM.png

This is great by itself, however, I decided to take it a few steps further. 
First of all, also supports edit in place. This is a test page to 
demonstrate:

https://lh4.googleusercontent.com/-bsWPwiuQg20/Thcl_C0sraI/ADE/73qIJK9_OS8/Screen%252520shot%2525202011-07-08%252520at%25252011.02.06%252520AM.png
To make this content editable, all it takes is the following line in the 
view:

{{=ckeditor.edit_in_place('.editable', URL())}}

This makes any element with the 'editable' class editable in place. It also 
requires a URL to save the data to when the save button is clicked. Here's 
what it looks like in edit mode:

https://lh3.googleusercontent.com/-9kv2lFa4JjA/ThcmcWAGF5I/ADM/UAwhM6LxoeQ/Screen%252520shot%2525202011-07-08%252520at%25252011.02.16%252520AM.png
It is all AJAX enabled, spellchecks as you type, and it's fast. Edit in 
place is another great feature, but I also took it a step further than that 
and integrated upload and browse functionality for images and Flash movies:

https://lh4.googleusercontent.com/-XtkEW2sXXyU/Thcm-IwkZ8I/ADU/uyPo2FTMob0/Screen%252520shot%2525202011-07-08%252520at%25252011.33.28%252520AM.png

https://lh3.googleusercontent.com/-mBjk0bs_-Z8/ThcnEixpCDI/ADc/_xH6sWwgs6o/Screen%252520shot%2525202011-07-08%252520at%25252011.35.29%252520AM.png

https://lh5.googleusercontent.com/-M4ddg9Dz9Kg/ThcnH0dubEI/ADk/9WzdPj1ZiVE/Screen%2Bshot%2B2011-07-08%2Bat%2B11.35.06%2BAM.png

https://lh4.googleusercontent.com/-8DKGzp3qqbs/ThcnV3GNCOI/ADs/A6_-CGOM8-g/Screen%252520shot%2525202011-07-08%252520at%25252011.35.42%252520AM.png
The upload and browse functionality is all taken care of by the plugin and 
does not require you to do anything on your end once you have initialized 
the plugin in your model as demonstrated above.

I used the following resources in developing this plugin, so a special 
thanks to the authors of these for providing the ground work required to 
make this possible:

http://www.web2pyslices.com/main/slices/take_slice/18
http://www.bitsntuts.com/jquery/ckeditor-edit-in-place-jquery-plugin

I have a couple other issues to resolve before I post the code, but I'd love 
to get some feedback to see if the community finds this plugin useful.


[web2py] Re: Call functions periodically from WEB2PY at short time basis (like 0.05 ... 5 seconds)

2011-07-08 Thread Francisco Costa
 Hardo to say. 0.9.7 branch is now obsolete, and a lot of fix has been
 added to signal framework in 0.9.8. If you want to manage timer reliably
 you should use the latest tip (it is really the 0.9.8.2 release, i am only
 waiting for a last patch before release)

 --
 Roberto De Iorishttp://unbit.it

I now have installed uwsgi-0.9.8.1 from source

How do you install uwsgi decorators in Ubuntu 11.04

I found that there is a python-uwsgidecorators package but its only
available for Ubuntu 11.10


Re: [web2py] Re: conditional {{include}} in view

2011-07-08 Thread Kernc
OMG, setting response.view does it for me 110%!
Confident in the ease of use of web2py, I swear I tried this the very first.
Maybe I mistyped it to response.view = 'article.html' or request.view, and
then just turned to alternatives. Anyway, now it works! :-D

I also understand your explanation, except one thing: if I have an
{{include}} inside a {{block}} as a default value (both these statements are
template, non-python statements), and that default is overridden, and since
{{block}} somewhat introduces conditioning, the inner {{include}} statement
need-not be expanded, so {{block some}}{{include article}}{{end}}, with some
block overridden, shouldn't throw error on article variable not set. I
think.

Anyway, taking note of your comment regarding not compiled views, I now see
I am doing the whole thing wrong, so I'm switching to {{extends}} and
{{blocks}} instead (no more need for variable includes). response.view saves
the day! :-)

Thank you and KUGW!

On Fri, Jul 8, 2011 at 4:26 PM, Anthony abasta...@gmail.com wrote:

 First, if you want to use a particular view, you can always explicitly
 assign response.view:

 def about():
 response.view='default/article.html' # This view will be used instead
 of 'default/about.html'.
 # more code
 return dict(...)

 Also, note that the {{include}} statement is not a Python statement -- it
 is processed by the template engine before everything is converted to
 Python. So, if you have an {{include 'someview.html'}} inside an if
 statement, the 'someview.html' template will still be included in the
 assembled Python code, though it will only be executed conditionally (based
 on the condition of the if statement). Also, because of this, although you
 may use variables in your {{include}} statements, as you have, usage of
 variables prevents bytecode compiling of the views. The reason is that the
 included views have to be determined at compile time, but the value of the
 variables is not known until run time.

 In the places where you are getting the error about 'article' not being
 defined, I assume your controller action is not actually returning a
 variable called 'article' to the view. If you need to conditionally test
 whether a particular variable is available in a view, you can do {{if
 'article' in response._vars:}} or {{if 'article' in globals():}}.

 Anthony


 On Friday, July 8, 2011 2:07:16 AM UTC-4, Kernc wrote:

 Ok, so this is my setup:

 I have article() function inside default controller, which obtains
 article title in request.args, puts ('articles/'+str(request.args[**0])
 +'.html') into returned dict(article=...), and serves appropriate
 article's HTML from article.html with

 !-- various common tags along with body above and /html below...
 --
 article
 {{include article}}!-- includes the right article/with-some-
 title.html --
 /article
 !-- ... --

 For example, if I access 
 http://domain/article/with-**some-titlehttp://domain/article/with-some-title,
 it
 renders views/articles/with-some-**title.html.
 I like that. :-)

 But then I have /about URL, which calls about() function inside
 default controller, but which I would like to use the same article
 template from article.html, i.e. to follow DRY.

 So I have tried to put my content in about.html in a variable
 {{article_content = MARKMIN('About us...')}} and then {{include}}
 modified article.html

 article
 {{if article_content:}}{{=article_**content}}{{pass}}{{else}}{{**include
 article}}{{pass}}
 /article

 (Besides {{if article_content:}} I tried with try-except too. Neither
 worked.)
 When accessing /about, the ticket told me the error was in undefined
 'article' variable in the include expression.

 So I tried it another way, by defining block with default content in
 article.html

 {{block article_content}}{{include article}}{{end}}

 and extending article.html in about.html

 {{extend 'article.html'}}{{block article_content}}{{=MARKMIN('**About
 us...')}}{{end}}

 As per documentation, default value inside {{block}} (in my case
 '{{include article}}') should be replaced with specified value (in
 my case {{=MARKMIN(...)}}). But again, the ticket reports the same
 error:

   ...
   File /home//web2py/gluon/**template.py, line 449, in include
 text = self._get_file_text(filename)
   File /home//web2py/gluon/**template.py, line 430, in
 _get_file_text
 filename = eval(filename, self.context)
   File string, line 1, in module
 NameError: name 'article' is not defined

 To avoid using {{include}}, the next thing I am about to try is:

 {{block article_contents}}{{if article:}}{{=open(article).**read()}}
 {{pass}}{{end}}

 but this way I have to maintain os.getcwd() and annote the article
 with proper path to my views. I don't know how stable this is.

 Inexperienced as I am, I'm assuming it's possible I'm doing something
 horribly wrong. What is that? :-)

 TL;DR: The templating system counter-intuitively gives unconditional
 priority to {{include}} 

R: Re: R: Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Valter Foresto
Anthony, you are a 'clairvoyant', the controller code is :

@auth.requires_login()
def current_logs():
records=SQLTABLE(db().select(db.logs.ALL))
return dict(records=records)

... oops, you say that I need to use DAL Rows object. not SQLTABLE object !

Then I suddenly changed the controller using :
records = db(db.logs.id0).select()
... and all works fine !

It is evident that I'm a beginner with web2py, sorry and may thanks !
-- Valter



Re: [web2py] Re: conditional {{include}} in view

2011-07-08 Thread Anthony
On Friday, July 8, 2011 12:14:48 PM UTC-4, Kernc wrote: 

 I also understand your explanation, except one thing: if I have an 
 {{include}} inside a {{block}} as a default value (both these statements are 
 template, non-python statements), and that default is overridden, and since 
 {{block}} somewhat introduces conditioning, the inner {{include}} statement 
 need-not be expanded, so {{block some}}{{include article}}{{end}}, with some 
 block overridden, shouldn't throw error on article variable not set. I 
 think.

 
Yes, that's a good point -- I'm not sure exactly how blocks work on the back 
end, but apparently it does read that include statement before replacing the 
block content.
 
Anthony


Re: [web2py] Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread valter.foresto
Anthony,
I reply to you also privately to say many thanks for your support on the 
web2py-users group.

I give you my references and if you are on LinkedIn I very appreciate if you 
join my professional networks.
Best Regards.
Valter Foresto


http://www.electronicbricks.it
Reti Ottiche a Larga Banda in Fibra Ottica Plastica
Red Light for Green Broadband Optical Networks Consulting, Training, 
Design, Marketing and Sales

Comm.SEC di Valter Foresto - ElectronicBRICKS™
Operation: Strada della Pronda 66/8bis - 10142 Torino - Italy (floor 1°, 
office 3)
Email: valter.fore...@electronicbricks.it
Skype: comm.sec
Mobile: +39 347 0144028
LinkedIN: commsec
Twitter: valterforesto
Legal: Via Francesco Millio 57 – 10141 Torino - Italy
IVA/VAT: IT08775700019

  - Original Message - 
  From: Anthony
  To: web2py@googlegroups.com
  Sent: Friday, July 08, 2011 12:00 AM
  Subject: [web2py] Re: How to display 'complete strings' in a view table ?


  Rows objects are rendered via the SQLTABLE helper (see 
http://code.google.com/p/web2py/source/browse/gluon/sqlhtml.py#1229). It 
takes a 'truncate' argument that defaults to 16 (i.e., it truncates text at 
16 characters). Try:

  {{=SQLTABLE(records, truncate=xx)}}

  where xx is 19 or greater in your case (to accommodate a date-time 
string). I think you can also set truncate=None to avoid truncation 
altogether.

  Anthony

  On Thursday, July 7, 2011 5:39:36 PM UTC-4, Valter Foresto wrote:
I use the view :
   {{extend 'layout.html'}}
   {{=records}}
to display a records table.
One field in the record report the date and time :
logs.event_time_stamp
2011-07-07 23...
but the date and time is 2011-07-07 23... instead of  the complete 
2011-07-07 23:01:15 string.

What can I do to have the complete string displayed on the view table ?


Re: R: Re: R: Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Anthony
No problem. Unfortunately, SQLTABLE does not appear to be well documented in 
the book. You could also leave the call to SQLTABLE in the controller and 
just add the 'truncate' argument there (and keep {{=records}} in the view), 
though since it's a display issue, I suppose it makes most sense in the view 
(that will also enable you to generate other types of views, such as JSON, 
from the same output).
 
Anthony

On Friday, July 8, 2011 12:29:53 PM UTC-4, Valter Foresto wrote:

 Anthony, you are a 'clairvoyant', the controller code is :

 @auth.requires_login()
 def current_logs():
 records=SQLTABLE(db().select(db.logs.ALL))
 return dict(records=records)

 ... oops, you say that I need to use DAL Rows object. not SQLTABLE object !

 Then I suddenly changed the controller using :
 records = db(db.logs.id0).select()
 ... and all works fine !

 It is evident that I'm a beginner with web2py, sorry and may thanks !
 -- Valter



[web2py] Re: New Plugin: plugin_ckeditor

2011-07-08 Thread Anthony
This looks great. I would certainly find it useful. Thanks for contributing.
 
Anthony


[web2py] Re: New Plugin: plugin_ckeditor

2011-07-08 Thread mart
I think this is awesome and really like the double-click  edit
feature! I'm sure this will be of great use to many.

Good on you!

Mart :)

On Jul 8, 12:00 pm, Ross Peoples ross.peop...@gmail.com wrote:
 This will be my second public plugin release. I will put it up on BitBucket
 soon, but for now, I thought I would introduce a new plugin I've been
 working on. Sometimes you just need a WYSIWYG editor. This plugin integrates
 CKEditor into web2py. It acts much like the Auth object in its usage. For
 example, in your model, you need to import and initialize it:

 from plugin_ckeditor import CKEditor
 ckeditor = CKEditor(db)
 ckeditor.define_tables()

 It's most basic usage is to assign it to a Field widget:

 db.define_table('content',
     Field('title', length=255),
     Field('public', 'boolean', default=True),
     Field('text', 'text', widget=ckeditor.widget)
 )

 The CKEditor now automatically becomes available every time SQLFORM is used.
 This is a screen shot of it in action:

 https://lh4.googleusercontent.com/-HLLFte_tXCw/ThclwgF-TtI/AC...

 This is great by itself, however, I decided to take it a few steps further.
 First of all, also supports edit in place. This is a test page to
 demonstrate:

 https://lh4.googleusercontent.com/-bsWPwiuQg20/Thcl_C0sraI/AD...
 To make this content editable, all it takes is the following line in the
 view:

 {{=ckeditor.edit_in_place('.editable', URL())}}

 This makes any element with the 'editable' class editable in place. It also
 requires a URL to save the data to when the save button is clicked. Here's
 what it looks like in edit mode:

 https://lh3.googleusercontent.com/-9kv2lFa4JjA/ThcmcWAGF5I/AD...
 It is all AJAX enabled, spellchecks as you type, and it's fast. Edit in
 place is another great feature, but I also took it a step further than that
 and integrated upload and browse functionality for images and Flash movies:

 https://lh4.googleusercontent.com/-XtkEW2sXXyU/Thcm-IwkZ8I/AD...

 https://lh3.googleusercontent.com/-mBjk0bs_-Z8/ThcnEixpCDI/AD...

 https://lh5.googleusercontent.com/-M4ddg9Dz9Kg/ThcnH0dubEI/AD...

 https://lh4.googleusercontent.com/-8DKGzp3qqbs/ThcnV3GNCOI/AD...
 The upload and browse functionality is all taken care of by the plugin and
 does not require you to do anything on your end once you have initialized
 the plugin in your model as demonstrated above.

 I used the following resources in developing this plugin, so a special
 thanks to the authors of these for providing the ground work required to
 make this possible:

 http://www.web2pyslices.com/main/slices/take_slice/18http://www.bitsntuts.com/jquery/ckeditor-edit-in-place-jquery-plugin

 I have a couple other issues to resolve before I post the code, but I'd love
 to get some feedback to see if the community finds this plugin useful.


Re: [web2py] New Plugin: plugin_ckeditor

2011-07-08 Thread Bruno Rocha
Congrats, this is a very useful plugin, and certainly will be one of most
importants and for sure it is very wanted.

I would like to use, let me know if you want some help testing.

(i am curious to see how it integrates with FormWizard plugin)

I am working a lot to finish the web2pyslices 2. In the new site you will be
able to create a page for the plugin and host an example app.

I need your to use as the default htmk editor for web2pyslices too.

Thank you for sharing.

Bruno

http://zerp.ly/rochacbruno
Em 08/07/2011 13:00, Ross Peoples ross.peop...@gmail.com escreveu:
 This will be my second public plugin release. I will put it up on
BitBucket
 soon, but for now, I thought I would introduce a new plugin I've been
 working on. Sometimes you just need a WYSIWYG editor. This plugin
integrates
 CKEditor into web2py. It acts much like the Auth object in its usage. For
 example, in your model, you need to import and initialize it:

 from plugin_ckeditor import CKEditor
 ckeditor = CKEditor(db)
 ckeditor.define_tables()

 It's most basic usage is to assign it to a Field widget:

 db.define_table('content',
 Field('title', length=255),
 Field('public', 'boolean', default=True),
 Field('text', 'text', widget=ckeditor.widget)
 )

 The CKEditor now automatically becomes available every time SQLFORM is
used.
 This is a screen shot of it in action:

 
https://lh4.googleusercontent.com/-HLLFte_tXCw/ThclwgF-TtI/AC8/cu3qqcUuDeE/Screen%252520shot%2525202011-07-08%252520at%25252011.01.36%252520AM.png


 This is great by itself, however, I decided to take it a few steps
further.
 First of all, also supports edit in place. This is a test page to
 demonstrate:

 
https://lh4.googleusercontent.com/-bsWPwiuQg20/Thcl_C0sraI/ADE/73qIJK9_OS8/Screen%252520shot%2525202011-07-08%252520at%25252011.02.06%252520AM.png

 To make this content editable, all it takes is the following line in the
 view:

 {{=ckeditor.edit_in_place('.editable', URL())}}

 This makes any element with the 'editable' class editable in place. It
also
 requires a URL to save the data to when the save button is clicked. Here's

 what it looks like in edit mode:

 
https://lh3.googleusercontent.com/-9kv2lFa4JjA/ThcmcWAGF5I/ADM/UAwhM6LxoeQ/Screen%252520shot%2525202011-07-08%252520at%25252011.02.16%252520AM.png

 It is all AJAX enabled, spellchecks as you type, and it's fast. Edit in
 place is another great feature, but I also took it a step further than
that
 and integrated upload and browse functionality for images and Flash
movies:

 
https://lh4.googleusercontent.com/-XtkEW2sXXyU/Thcm-IwkZ8I/ADU/uyPo2FTMob0/Screen%252520shot%2525202011-07-08%252520at%25252011.33.28%252520AM.png


 
https://lh3.googleusercontent.com/-mBjk0bs_-Z8/ThcnEixpCDI/ADc/_xH6sWwgs6o/Screen%252520shot%2525202011-07-08%252520at%25252011.35.29%252520AM.png


 
https://lh5.googleusercontent.com/-M4ddg9Dz9Kg/ThcnH0dubEI/ADk/9WzdPj1ZiVE/Screen%2Bshot%2B2011-07-08%2Bat%2B11.35.06%2BAM.png


 
https://lh4.googleusercontent.com/-8DKGzp3qqbs/ThcnV3GNCOI/ADs/A6_-CGOM8-g/Screen%252520shot%2525202011-07-08%252520at%25252011.35.42%252520AM.png

 The upload and browse functionality is all taken care of by the plugin and

 does not require you to do anything on your end once you have initialized
 the plugin in your model as demonstrated above.

 I used the following resources in developing this plugin, so a special
 thanks to the authors of these for providing the ground work required to
 make this possible:

 http://www.web2pyslices.com/main/slices/take_slice/18
 http://www.bitsntuts.com/jquery/ckeditor-edit-in-place-jquery-plugin

 I have a couple other issues to resolve before I post the code, but I'd
love
 to get some feedback to see if the community finds this plugin useful.


[web2py] Demystifying some web2py magic

2011-07-08 Thread Jim Steil

Hi

I have a utility module that I use regularly where I put some of my 
application-specific helper functions.  What is the proper way to import 
this to make it available in my controllers and views?


I've tried the local_import in db.py but have seen references on this 
list that recommend against using that.  This method had the reload=True 
option that allowed me to make changes to my utility module and not have 
to restart the web2py server to make the changes visible.


If I recall correctly (and I certainly could be wrong), the preferred 
method is to now use import.  But, using this method I have to restart 
web2py every time I make a change so I can see the results.


Can someone please tell me how I can import a module and have it reload 
automatically like local_import('module', reload=True) does?  Or, should 
I still be using local_import when I want reloading to occur?


Thanks

-Jim



R: Re: R: Re: R: Re: [web2py] R: Re: How to display 'complete strings' in a view table ?

2011-07-08 Thread Valter Foresto
Yes, SQLTABLE is not well documented  but WEB2PY is fantastic !
I agree with you that the use of SQLTABLE should be (typically) in the view.
-- Valter


[web2py] Re: Demystifying some web2py magic

2011-07-08 Thread Anthony
local_import should work, but you should now use regular import statements 
instead. If you want your modules reloaded automatically, do the following:
 
from gluon.custom_import import track_changes
track_changes()
 
That will reload your modules, but only when they change (which is an 
improvement over local_import, which will reload whether or not there are 
changes). Note, I believe the above will affect all applications. To turn 
off reloading, do:
 
track_changes(track=False)
 
And to test whether changes are currently being tracked:
 
from gluon.custom_import import track_changes, is_tracking_changes
if not is_tracking_changes():
track_changes()
 
 
Anthony

On Friday, July 8, 2011 3:06:07 PM UTC-4, Jim S wrote:

 Hi

 I have a utility module that I use regularly where I put some of my 
 application-specific helper functions.  What is the proper way to import 
 this to make it available in my controllers and views?

 I've tried the local_import in db.py but have seen references on this list 
 that recommend against using that.  This method had the reload=True option 
 that allowed me to make changes to my utility module and not have to restart 
 the web2py server to make the changes visible.  

 If I recall correctly (and I certainly could be wrong), the preferred 
 method is to now use import.  But, using this method I have to restart 
 web2py every time I make a change so I can see the results.

 Can someone please tell me how I can import a module and have it reload 
 automatically like local_import('module', reload=True) does?  Or, should I 
 still be using local_import when I want reloading to occur?

 Thanks

 -Jim



Re: [web2py] Re: Demystifying some web2py magic

2011-07-08 Thread Jim Steil

Fantastic, that is exactly what I was looking for!

-Jim

On 7/8/2011 2:20 PM, Anthony wrote:
local_import should work, but you should now use regular import 
statements instead. If you want your modules reloaded automatically, 
do the following:

from gluon.custom_import import track_changes
track_changes()
That will reload your modules, but only when they change (which is an 
improvement over local_import, which will reload whether or not there 
are changes). Note, I believe the above will affect all applications. 
To turn off reloading, do:

track_changes(track=False)
And to test whether changes are currently being tracked:
from gluon.custom_import import track_changes, is_tracking_changes
if not is_tracking_changes():
track_changes()
Anthony

On Friday, July 8, 2011 3:06:07 PM UTC-4, Jim S wrote:

Hi

I have a utility module that I use regularly where I put some of
my application-specific helper functions.  What is the proper way
to import this to make it available in my controllers and views?

I've tried the local_import in db.py but have seen references on
this list that recommend against using that.  This method had the
reload=True option that allowed me to make changes to my utility
module and not have to restart the web2py server to make the
changes visible.

If I recall correctly (and I certainly could be wrong), the
preferred method is to now use import.  But, using this method I
have to restart web2py every time I make a change so I can see the
results.

Can someone please tell me how I can import a module and have it
reload automatically like local_import('module', reload=True)
does?  Or, should I still be using local_import when I want
reloading to occur?

Thanks

-Jim



[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread cjrh
On Friday, 8 July 2011 16:05:54 UTC+2, Anthony wrote:

 On Friday, July 8, 2011 3:25:45 AM UTC-4, cjrh wrote: 

 On Monday, January 10, 2011 6:36:18 AM UTC+2, Anthony wrote: 

 On Sunday, January 9, 2011 1:24:02 AM UTC-5, Graham Dumpleton wrote: 

  You guys really just got to learn to do your own thing and not 
 treating it like a crusade where you have to convert the world.

  
 But that's exactly the problem -- web2py is trying to do its own thing, 


 ...so far so good...
  

 and there is a vocal clique of Pythonistas who don't like that thing 
 and want to stop it. 


 ...and here we get it wrong.  Why should we *care* about this vocal 
 clique?

  
 Note, the unfounded criticisms are effectively impugning both the technical 
 and personal integrity of web2py's developers and users, in very public 
 forums. This can have negative professional (and personal) consequences. If 
 you have chosen to build an app with web2py and your client, manager, or 
 investor reads bad things about web2py, you may lose their confidence and 
 favor.


Haters gonna hate :)  
 

  

 *Why* should we care how many users we have?

  
 Again, this is not the most important thing, but the number of users is not 
 entirely without consequence either. Generally, more users will translate 
 into more expert contributors and volunteers, which will contribute to the 
 development of the framework and its ecosystem and to its long-term 
 sustainability (i.e., more features, better testing and performance, better 
 documentation, more plugins and applications, better support, more 
 third-party hosting and development tool support, etc.).


This is almost definitely not true.  Or rather, it certainly hasn't been my 
experience anyway.  The number of people in a project or community appears 
to have no bearing whatsoever on the quality of the code or the abilities of 
contributors. 
 

 In many cases, when you select a framework, you want some confidence that 
 it will still be actively maintained several years hence, and that 
 confidence will be bolstered if there is a sizable and active community 
 around it.


I still don't see why this is my problem, or indeed even yours, or anyone 
else's for that matter.  I do not see why I need to care about whether some 
pointy-hair boss thinks web2py will be actively maintained in the future.  I 
have selected web2py on technical merit.  I do not care how active the 
community is, for I have the source code.  

In truth, I have selected web2py because my value system around coding has a 
large intersection with Massimo's, IMO.  I value the conveniences that he 
built into web2py early on; conveniences that other frameworks left as an 
exercise to the reader.  I think that matters.  I think that remains a 
selling point for web2py.  I think it is unfortunate that he uses the word 
Enterprise to indicate that those conveniences exist, and I think that 
that causes a lot more confusion than it should.  But our PR face is way, 
way too defensive.  I understand that *we *might not see it like that, but 
if someone like Graham happens point out that that is how it looks from the 
outside, then we should take note of that.

IMO there is very little merit in just about anything that goes through 
reddit.  So why bother wasting time on it?   I am not sure I even want to 
attract too many coders that spend time reading reddit anyway.  Apologies 
upfront if that offends anyone.



Re: [web2py] New Plugin: plugin_ckeditor

2011-07-08 Thread Ross Peoples
Ok, I have posted the source code on BitBucket. I don't have time to put any 
documentation up there yet other than what's here in this thread. I will 
update with more documentation hopefully this weekend when I have time. 
Until then, enjoy!

https://bitbucket.org/PhreeStyle/web2py_ckeditor



[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread Anthony
On Friday, July 8, 2011 3:47:09 PM UTC-4, cjrh wrote: 

  *Why* should we care how many users we have?

  Again, this is not the most important thing, but the number of users is 
 not entirely without consequence either. Generally, more users will 
 translate into more expert contributors and volunteers, which will 
 contribute to the development of the framework and its ecosystem and to its 
 long-term sustainability (i.e., more features, better testing and 
 performance, better documentation, more plugins and applications, better 
 support, more third-party hosting and development tool support, etc.).


 This is almost definitely not true. Or rather, it certainly hasn't been my 
 experience anyway. The number of people in a project or community appears to 
 have no bearing whatsoever on the quality of the code or the abilities of 
 contributors.

 It's not just about the core framework, but the larger ecosystem. Right now 
there are several hosting services in beta dedicated specifically to hosting 
Django apps. Pycharm includes special functionality to support Django 
development. There are lots of libraries and reusable apps specifically for 
Django. (Not to mention what you can find in the Rails, PHP, or ASP.NET 
worlds.) So, I think there can be some benefits to a larger community and 
user base, though such benefits may not matter to everyone.
 
  In many cases, when you select a framework, you want some confidence that 
 it will still be actively maintained several years hence, and that 
 confidence will be bolstered if there is a sizable and active community 
 around it.


 I still don't see why this is my problem, or indeed even yours, or anyone 
 else's for that matter. I do not see why I need to care about whether some 
 pointy-hair boss thinks web2py will be actively maintained in the future. I 
 have selected web2py on technical merit. I do not care how active the 
 community is, for I have the source code.

 
Yes, but not everyone wants to worry about having to take over development 
and maintenance of their app's framework should it be abandoned by its core 
developers. Why do we worry about backward compatibility? Backward 
compatibility only matters if the framework is actively being developed to 
begin with, so concern about backward compatibility follows from a concern 
about long-term sustainability. I agree that technical merit is critical, 
but it's not the only consideration, at least not for all users.
 

 In truth, I have selected web2py because my value system around coding has 
 a large intersection with Massimo's, IMO. I value the conveniences that he 
 built into web2py early on; conveniences that other frameworks left as an 
 exercise to the reader. I think that matters. I think that remains a 
 selling point for web2py.

 
Hear, hear!
 

 But our PR face is way, way too defensive. I understand that *we *might 
 not see it like that, but if someone like Graham happens point out that that 
 is how it looks from the outside, then we should take note of that.

 
Note, this thread is from back in January, and in the past few months, there 
has been relatively little negative reddit activity, so perhaps we have 
already moved on to better days. :-)


[web2py] Re: plugins

2011-07-08 Thread Anthony
Adding to the plugins thread...
 
*web2py_ckeditor:*
https://bitbucket.org/PhreeStyle/web2py_ckeditor
https://groups.google.com/d/topic/web2py/fCia6IvhZew/discussion
 
Thanks, Ross.


[web2py] DAL: About upload field and S3

2011-07-08 Thread Oscar
Hi,

There exist a way to do an upload when a Upload field is defined at
the model but it upload the file to a S3 bucket?

Do I have to extend the upload field properties? How?

Thanks in advance.

Oscar.


[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread pbreit
Sorry cjrh, but the number of users and the perception of the project DO 
matter. Some of us are building businesses around Web2py and need to feel 
comfortable that the project has longevity, that we can hire and retain 
engineers, that we can find resources if we need them, etc. Not everyone is 
doing just their own one-person projects.

I don't really care if engineering candidates have Web2py experience or not 
but I do care if any perceptual issues handicap recruiting.

You need to think slightly bigger than your own personal projects.


[web2py] URL() unexpectedly including app name in URLs

2011-07-08 Thread pbreit
I seem to have forgotten exactly how URL() works. I believe my URLs used to 
look like /static/image/asdfadsfa.jpg but now they are including /init at 
the beginning (ie: /init/static/image/asdfadsfa.jpg). I 
have default_application = 'init' in my route file. Am I missing something?



[web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread pbreit
It only seems to be happening on images.

OK:
URL('default', 'item', extension='', args=item.item.slug)
http://pricetack.com/item/us-open-2010-pebble-beach-greg-norman-golf-shirt-x-99

Not OK:
{{=URL('static', 'uploads', extension='', args=item.item.image_thumb)}}
http://pricetack.com/init/static/uploads/item.image.b0e43b99a1d0fea6.494d475f323232322e4a5047_thumb.JPG

Maybe it has to do with 'default' being a controller and 'static' just being 
a directory?


Re: [web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread Jonathan Lundell
On Jul 8, 2011, at 2:31 PM, pbreit wrote:
 It only seems to be happening on images.
 
 OK:
 URL('default', 'item', extension='', args=item.item.slug)
 http://pricetack.com/item/us-open-2010-pebble-beach-greg-norman-golf-shirt-x-99
 
 Not OK:
 {{=URL('static', 'uploads', extension='', args=item.item.image_thumb)}}
 http://pricetack.com/init/static/uploads/item.image.b0e43b99a1d0fea6.494d475f323232322e4a5047_thumb.JPG
 
 Maybe it has to do with 'default' being a controller and 'static' just being 
 a directory?

This is the default behavior of the parametric router. The idea is to make it 
easier to handle static files in the host server.

You can override it by setting the map_static flag:

 #  map_static: By default, the default application is not stripped from 
 static URLs. 
 #   Set map_static=True to override this policy.




[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread Massimo Di Pierro
Have I missed some new controversial reddit thread?

On Jul 8, 4:18 pm, pbreit pbreitenb...@gmail.com wrote:
 Sorry cjrh, but the number of users and the perception of the project DO
 matter. Some of us are building businesses around Web2py and need to feel
 comfortable that the project has longevity, that we can hire and retain
 engineers, that we can find resources if we need them, etc. Not everyone is
 doing just their own one-person projects.

 I don't really care if engineering candidates have Web2py experience or not
 but I do care if any perceptual issues handicap recruiting.

 You need to think slightly bigger than your own personal projects.


Re: [web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread pbreit
Bingo, thx. Not sure how I missed except that I guess it works either way. 
But now I have nginx handling /static which I presume is better.

Re: [web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread Jonathan Lundell
On Jul 8, 2011, at 3:21 PM, pbreit wrote:
 Bingo, thx. Not sure how I missed except that I guess it works either way. 
 But now I have nginx handling /static which I presume is better.

Up to you.

The idea is that static URLs aren't very visible to users, so there's less 
motivation to shorten them, and if they're always generated as /app/static, 
then it's a little easier for nginx (or whatever) to pick them out. But it's up 
to you.

[web2py] admin complains at encoder

2011-07-08 Thread Carl
in my db.py I have

import datetime
rom time import mktime, localtime
timestamp = SQLCustomType(type='datetime',
  native='NUMERIC(16,6)',
  encoder=(lambda x: str(mktime(x.timetuple()) +
x.microsecond/100.0 if x else None)),
  decoder=(lambda x: datetime.datetime(*
(list(localtime(int(x))[:6])+[int(round(x%1,6)*100)]) ) if x else
None))

I then use timestamp for various fields.

In /admin when attempt to update a row this is kicked out:
File E:/projects/workspace/TestEnvoy/web2py/applications/init/models/
db.py, line 39, in lambda
encoder=(lambda x: str(mktime(x.timetuple()) + x.microsecond/
100.0 if x else None)),
AttributeError: 'str' object has no attribute 'timetuple'

Any idea where I've gone a stray?



Re: [web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread pbreit
I think I'd rather have my static URLs resemble my other URLs. Seems like if 
I'm removing the default appname, that should be global?

Although I don't even know: on a URL like this, does it even touch web2py?
http://pricetack.com/init/static/uploads/item.image.b0e43b99a47_thumb.JPGhttp://pricetack.com/init/static/uploads/item.image.b0e43b99a1d0fea6.494d475f323232322e4a5047_thumb.JPG


[web2py] Re: admin complains at encoder

2011-07-08 Thread pbreit
Could be a copy/paste error but there's a typo in line 2: rom should be 
from.

[web2py] Re: admin complains at encoder

2011-07-08 Thread Carl
thanks pbreit
alas (and o heck!) it was just a lost character in my pasted posting.

On Jul 8, 11:48 pm, pbreit pbreitenb...@gmail.com wrote:
 Could be a copy/paste error but there's a typo in line 2: rom should be
 from.


Re: [web2py] Re: URL() unexpectedly including app name in URLs

2011-07-08 Thread Jonathan Lundell
On Jul 8, 2011, at 3:39 PM, pbreit wrote:
 I think I'd rather have my static URLs resemble my other URLs. Seems like if 
 I'm removing the default appname, that should be global?
 
 Although I don't even know: on a URL like this, does it even touch web2py?
 http://pricetack.com/init/static/uploads/item.image.b0e43b99a47_thumb.JPG

It depends on your configuration. If apache/nginx is handling static files 
directly, then web2py never sees it. Otherwise it does.

[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread cjrh
No, or rather, not that I am aware.  We are discussing, I think, the 
principal of the matter.

[web2py] Re: Apache, Wsgi problem

2011-07-08 Thread cjrh
On Friday, 8 July 2011 23:18:57 UTC+2, pbreit wrote:

 You need to think slightly bigger than your own personal projects.


Why should I?  The bigger community does not concern me.  I contribute to 
web2py for entirely selfish reasons, because it want it to be the best tool 
for me to use for my own personal (actually work) projects.  I do not care 
one iota about what other people may or may not think about web2py.  It 
doesn't concern me even one bit.  I have tried the various web frameworks, 
and I have made a decision based on the relative merits to focus on web2py. 
 I don't see AT ALL why I need to think any bigger than my own current 
needs.