[web2py] Re: sqlform.grid and represent vs. format

2011-10-30 Thread szimszon
http://code.google.com/p/web2py/issues/detail?id=491

tnx.


[web2py] Cheaper hosting...

2011-10-30 Thread Magnitus
So far, I've been using this service for my personal apps at 1 node:
http://www.vps.net/product/cloud-servers/

Recently, someone suggested this: http://fibervolt.com/vps.php

At the lower specs range (and assuming you don't use even a 1/10 of
the bandwidth vps provides), you have something that is almost as good
for like 25$/year (instead of 20$/month) and something that is
definitely better at less than 1/3 of the price (6$/month instead of
20$/month).

Seems too good to be true.

Anybody has any experience with them?


[web2py] Re: Found a bug: XMLRPC with basic authorization fails

2011-10-30 Thread szimszon
http://code.google.com/p/web2py/issues/detail?id=492


[web2py] Re: curl post with authentication

2011-10-30 Thread szimszon
http://code.google.com/p/web2py/issues/detail?id=492


[web2py] grid - hiding reconds found count

2011-10-30 Thread peter
I am hoping that the developers of SQLFORM.grid will add an option to
hide the 'nn records found' message. In fact I do not think it should
appear at all when there is no search in place. I have discovered a
neat way of hiding this message
Put in your layout.html (or more locally if you wish)

.web2py_counter { display:none}


Put it just before {{include}}
Unfortunately it leaves a gap, but it is much better way of getting
rid of the message than editing gluon.

Peter


Re: [web2py] Cheaper hosting...

2011-10-30 Thread Marin Pranjić
If you need very cheap hosting, you can look here: http://www.lowendbox.com/

However, price does matter :) Uptime, customer support...
These providers are good for testing, backup, or small unimportant sites.
It's risky but if you pay monthly, not a big loss if something goes bad.
If you need solid provider, you'll have to pay for it.

On Sun, Oct 30, 2011 at 10:29 AM, Magnitus  wrote:

> So far, I've been using this service for my personal apps at 1 node:
> http://www.vps.net/product/cloud-servers/
>
> Recently, someone suggested this: http://fibervolt.com/vps.php
>
> At the lower specs range (and assuming you don't use even a 1/10 of
> the bandwidth vps provides), you have something that is almost as good
> for like 25$/year (instead of 20$/month) and something that is
> definitely better at less than 1/3 of the price (6$/month instead of
> 20$/month).
>
> Seems too good to be true.
>
> Anybody has any experience with them?
>


[web2py] Re: Question to Bruno on grid and styles

2011-10-30 Thread peter
I am seeing the comments like a programmer sees comments, you comment
out a bit of code when you want to temporarily disable it. I see that
this is a different kind of comment to a comment where you want the
generated html to contain comments.  Having seen Massimo's video on
floss I can see why the html comments do not affect the python
execution. However for a programmer, having things within comments
execute is an 'unexpected behaviour'. Any way when one knows it works
in this way it is easy to work round.

Peter

On Oct 29, 10:39 pm, Anthony  wrote:
> On Saturday, October 29, 2011 1:30:58 PM UTC-4, Anthony wrote:
>
> > There is a function called response.include_files() that is called in
> > web2py_ajax.html, which is likely included in the head of your layout.html.
> > Any files added to the response.files list prior to that being called will
> > be included in the head by response.include_files(). The default
> > layout.html as well as web2py_ajax.html itself both add files to
> > response.files. Perhaps plugin_jqgrid adds to response.files as well.
>
> Note, specifically regarding HTML comments, how would the template engine
> be able to differentiate between your case (i.e., you want the stuff
> between the HTML comments not to appear in the rendered output at all) and
> the case in which you do want to render the content between the comments
> (which is usually the case when you enter comments in HTML)?
>
> Anthony


[web2py] Re: Massimo Di Pierro talks about web2py on FLOSS Weekly

2011-10-30 Thread peter
I will think about making it open source in the future. The problem is
a) It is my first python and web2py project, so the coding is not
always as clean as an experienced python programmer would produce.
Secondly a music download store is not close to a generic ecommerce
store. When I have some more time I can maybe tidy up the code and
make it an open source music download project. This week I wrote a
picture gallery for my sister in law. I had previously written it in
net objects fusion with the idea that she would be able to modify it.
It proved much to complex so I have to add each picture for her. By
rewriting in with web2py, which took perhaps half a day, she can now
manage it herself. In the near future I will add this as an appliance.
The one there is very incomplete and more javascript than web2py.

Peter

On Oct 29, 7:26 am, Gour  wrote:
> On Fri, 28 Oct 2011 14:48:52 -0700 (PDT)
>
> peter  wrote:
> > I have just written an ecommerce site in web2py. ukjazz.net.
>
> [...]
>
> > So I think that web2py is well suited to ecommerce.
>
> Do you plan to open-source your project?
>
> I'd like that we have some standard components in the web2py arena...e.g.
> Massimo said that IP is 'defacto standard' for cms/blog. Considering that it
> would be nice to have extra modules which could be plugged in IP to handle
> ecommerce etc.
>
> Finally, the name of IP resembles WP, so why not having such a ecosystem
> developed around it?
>
> > The biggest problem is that the most useful things are not yet
> > documented at all. However I would much rather use them undocumented
> > than have to wait until they are fully tested and documented.
>
> In my case, I'm not full time developer and by using PHP CMS-es like WP, one
> can build a site using available components (plugins & themes) which can be
> tweaked further or by adding extra functionality (writing plugin), so having
> some established components would have to quickly build sites not having to
> start from the scratch.
>
> I believe that Massimo's endeavour to iron out the 'appliances' is going in
> this direction.
>
> Of course, I understand that Web2py is not CMS/blogging platform, but
> framework, but having stable CMS/blog/ecommerce would bring many new people to
> web2py...
>
> Sincerely,
> Gour
>
> --
> Those who are on this path are resolute in purpose,
> and their aim is one. O beloved child of the Kurus,
> the intelligence of those who are irresolute is many-branched.
>
> http://atmarama.net| Hlapicina (Croatia) | GPG: 52B5C810
>
>  signature.asc
> < 1KViewDownload


[web2py] WebFactions Applications

2011-10-30 Thread Web2Py Freak
Dear All ,

 I am using WebFaction for hosting , i install the web2py app in a
custom script , now do i have to install an app for every website or
use just one app , and if using one app how can i point the domain to
it ??


Best Regards ,
Hassan Alnator


[web2py] Re: adjusting default select() behavior

2011-10-30 Thread lucas
thanx massimo,

i guess that does give the most optimum customization and control.

thank you.  lucas


[web2py] web2py App for sharing research results.

2011-10-30 Thread Richard
Does anybody have an web2py app for sharing research data?

We are with a number of teams of students researching the same
subject. To increase the statistical power we want to share research
data so one can increase validity.

A short functional design:
. Users will be authenticated
. This site will be hosted on the Internet, accessible for all
researchers.
. User will have only access to their own and to the created total
dataset.
. This total dataset will contain all shared attributes between the
different research.
. Research data can be viewed in a table.
. Research data is read from excel
. Export to excel of total data set.

Richard.


[web2py] How about auth.define_tables(..., format='...')?

2011-10-30 Thread Ray (a.k.a. Iceberg)
Hi Massimo,

How about add a new parameter to auth.define_tables()? As below.

  def define_tables(..., format=''%(first_name)s %(last_name)s (%
(id)s)"):
 ...
db.define_table(..., format=format)
...

The idea is to let user has a change to customize it. Currently we can
override this value at all.

Regards,
Ray


[web2py] Re: WebFactions Applications

2011-10-30 Thread Ray (a.k.a. Iceberg)
On Oct 30, 7:23 pm, Web2Py Freak  wrote:
> Dear All ,
>
>  I am using WebFaction for hosting , i install the web2py app in a
> custom script , now do i have to install an app for every website or
> use just one app , and if using one app how can i point the domain to
> it ??
>
> Best Regards ,
> Hassan Alnator


Hi Hassan,

You use so many webfaction slang in your post. Fortunately I use
webfaction too so I can understand.

Yes I think you can install the entire web2py package as a "webfaction
app" for your each "webfaction website". But that way each "webfaction
app" contains at least one dedicate process. Your webfaction account
may exceed memory quota quickly.

I install only one web2py package as a one-for-all "webfaction app".
Then bind my several domains to this unique "webfaction app" via
webfaction control panel, so requests to all my domain go to that same
web2py process. Later, setup some url rewrite rules so requests for
different domain go to different "web2py app". This solution is good
for many light traffic sites.

Hope I describe it clearly.

Regards,
Ray




[web2py] Re: Persistent variables in web2py

2011-10-30 Thread evilaliv3
On 30 Ott, 00:39, Massimo Di Pierro 
wrote:
> You must use cache.ram but this is not guaranteed to work.

Excuse me Massimo,
but, if i understand well this answer, there is no way to have also a
persistent connection to the database or a global application variable
in web2py?
for every request the whole application is reinitialized?

> In a multi-threaded environment the web server decides which threads
> to start/stop/kill.

does this happen in a deterministic fashion? is there some
documentation about?

Giovanni Pellerano


[web2py] Re: How about auth.define_tables(..., format='...')?

2011-10-30 Thread Anthony
I think you'd need different format arguments for auth_user and auth_group, 
as they both have formats specified.

Anthony

On Sunday, October 30, 2011 9:48:04 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>
> Hi Massimo, 
>
> How about add a new parameter to auth.define_tables()? As below. 
>
>   def define_tables(..., format=''%(first_name)s %(last_name)s (% 
> (id)s)"): 
>  ... 
> db.define_table(..., format=format) 
> ... 
>
> The idea is to let user has a change to customize it. Currently we can 
> override this value at all. 
>
> Regards, 
> Ray 
>


[web2py] Re: WebFactions Applications

2011-10-30 Thread Web2Py Freak
i understand it but i really dont know how to do it


[web2py] slideshow in plugin wiki

2011-10-30 Thread peter
The slideshow plugin in plugin wiki has a height and width parameter.
Unless I am mistaken, these are not connected to anything and have no
effect.

Eventually I discovered the way to adjust the size of the slideshow
is:

In base.css put

#slideshow1 {
height:  500px;
width:   580px;
padding: 0;
margin:  0;
}

img#slideshow1 {
padding: 15px;
border:  1px solid #ccc;
background-color: #eee;
width:  580px;
height: 500px;
text-align: right;
top:  0;
left: 0
}


It would be good if this were put in the comments of the slideshow
function in plugin wiki. Maybe the section on this in the book could
reflect this.

Peter



[web2py] Re: grid - hiding reconds found count

2011-10-30 Thread Anthony
You can also get rid of it using server side DOM manipulation:

del grid[0][2]  # the web2py_counter div is the third component within the 
first div of the returned grid object

Anthony

On Sunday, October 30, 2011 6:00:12 AM UTC-4, peter wrote:
>
> I am hoping that the developers of SQLFORM.grid will add an option to 
> hide the 'nn records found' message. In fact I do not think it should 
> appear at all when there is no search in place. I have discovered a 
> neat way of hiding this message 
> Put in your layout.html (or more locally if you wish) 
>  
> .web2py_counter { display:none} 
>  
>
> Put it just before {{include}} 
> Unfortunately it leaves a gap, but it is much better way of getting 
> rid of the message than editing gluon. 
>
> Peter



[web2py] Re: WebFactions Applications

2011-10-30 Thread Web2Py Freak
My app name is 'Web2py'  and in it i have two 'web2py app':

1- welcome
2-maestro

now i have a domain and in the site app i selected web2py and there is
nothing in the path so it takes the welcome app

and now i have some other domain and i want it to start mastro web2py
app  .. i will select web2py and then what to add in the URL path ???


Re: [web2py] Re: Persistent variables in web2py

2011-10-30 Thread Michele Comitini
You have persistent connections: just use the pool: it is documented in the
book.
If you find problems with speed use the profiler that comes with web2py and
post here or open a ticket with the results and a model to reproduce those
problems, they will be fixed.

mic
Il giorno 30/ott/2011 15:06, "evilaliv3"  ha scritto:

> On 30 Ott, 00:39, Massimo Di Pierro 
> wrote:
> > You must use cache.ram but this is not guaranteed to work.
>
> Excuse me Massimo,
> but, if i understand well this answer, there is no way to have also a
> persistent connection to the database or a global application variable
> in web2py?
> for every request the whole application is reinitialized?
>
> > In a multi-threaded environment the web server decides which threads
> > to start/stop/kill.
>
> does this happen in a deterministic fashion? is there some
> documentation about?
>
> Giovanni Pellerano


[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Massimo Di Pierro
this is not a web2py issue. This is an issue for all web applications.

What if your application is replicated on two server behing a load
balancer? The two servers cannot share objects. What if you use a web
servers that forks (apache can) than different requests are executed
by different processes, not different threads? Processes cannot share
objects. What if you have to restart the web server for maintenance
purposes? Do you want to store all persistent data?
The same user may request two pages and these two pages may be server
by different servers or different processes.

Web applications must be written without persistent objects. State is
share using the database, using sessions and using cache.

The bahvior you seek can be mimicked by serializing/deserializing the
objects at every request in session or cache.

Massimo



On Oct 30, 4:39 am, evilaliv3  wrote:
> On 30 Ott, 00:39, Massimo Di Pierro 
> wrote:
>
> > You must use cache.ram but this is not guaranteed to work.
>
> Excuse me Massimo,
> but, if i understand well this answer, there is no way to have also a
> persistent connection to the database or a global application variable
> in web2py?
> for every request the whole application is reinitialized?
>
> > In a multi-threaded environment the web server decides which threads
> > to start/stop/kill.
>
> does this happen in a deterministic fashion? is there some
> documentation about?
>
> Giovanni Pellerano


[web2py] Re: Question to Bruno on grid and styles

2011-10-30 Thread Anthony
On Sunday, October 30, 2011 6:45:02 AM UTC-4, peter wrote:
>
> I am seeing the comments like a programmer sees comments


Yes, but as a programmer, you have to use the correct comment syntax for 
the language you are using. In the web2py template language, everything 
outside {{ }} is left as is in the generated output. You can comment out 
code within {{ }}, but you obviously have to use Python comments for that.

Keep in mind that web2py templates can generate any type of output (JSON, 
XML, Javascript, CSS, or any arbitrary language/markup), not just HTML. It 
would not be expected or desirable for it to parse the comment syntax for 
all possible target languages and completely remove the content within. 
Rather, you want the template language to be able to generate comments in 
the target language if needed. This is particularly important in HTML 
because in HTML, sometimes you do actually want the browser to execute 
content within comments (e.g., HTML comments are used to create conditional 
markup for IE and to hide Javascript code within script tags from 
non-Javascript browsers).
 

> However for a programmer, having things within comments 
> execute is an 'unexpected behaviour'.


Though if you tried to generate an HTML comment using the template language 
but found the content of that comment to be empty within the generated 
HTML, that would also be unexpected behavior.

Anthony


[web2py] Re: How about auth.define_tables(..., format='...')?

2011-10-30 Thread Ray (a.k.a. Iceberg)
Nice comment Anthony. So I would like to mend my previous suggestion
as:

1. the auth.define_tables(...) interface remains state quo
2. the auth.define_tables(...) implementation follows some new
settings, e.g.

db.define_table(
...,
format = self.settings.table_user_name_format)

Regards,
Ray


On Oct 30, 10:12 pm, Anthony  wrote:
> I think you'd need different format arguments for auth_user and auth_group,
> as they both have formats specified.
>
> Anthony
>
>
>
>
>
> On Sunday, October 30, 2011 9:48:04 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>
> > Hi Massimo,
>
> > How about add a new parameter to auth.define_tables()? As below.
>
> >   def define_tables(..., format=''%(first_name)s %(last_name)s (%
> > (id)s)"):
> >      ...
> >     db.define_table(..., format=format)
> >     ...
>
> > The idea is to let user has a change to customize it. Currently we can
> > override this value at all.
>
> > Regards,
> > Ray


[web2py] Re: How about auth.define_tables(..., format='...')?

2011-10-30 Thread Anthony
Probably just settings.table_user_format (i.e., the format for the user 
table), and maybe settings.table_group_format as well.

Anthony

On Sunday, October 30, 2011 10:48:25 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>
> Nice comment Anthony. So I would like to mend my previous suggestion 
> as: 
>
> 1. the auth.define_tables(...) interface remains state quo 
> 2. the auth.define_tables(...) implementation follows some new 
> settings, e.g. 
>
> db.define_table( 
> ..., 
> format = self.settings.table_user_name_format) 
>
> Regards, 
> Ray 
>
>
> On Oct 30, 10:12 pm, Anthony  wrote: 
> > I think you'd need different format arguments for auth_user and 
> auth_group, 
> > as they both have formats specified. 
> > 
> > Anthony 
> > 
> > 
> > 
> > 
> > 
> > On Sunday, October 30, 2011 9:48:04 AM UTC-4, Ray (a.k.a. Iceberg) 
> wrote: 
> > 
> > > Hi Massimo, 
> > 
> > > How about add a new parameter to auth.define_tables()? As below. 
> > 
> > >   def define_tables(..., format=''%(first_name)s %(last_name)s (% 
> > > (id)s)"): 
> > >  ... 
> > > db.define_table(..., format=format) 
> > > ... 
> > 
> > > The idea is to let user has a change to customize it. Currently we can 
> > > override this value at all. 
> > 
> > > Regards, 
> > > Ray



[web2py] Re: WebFactions Applications

2011-10-30 Thread Ray (a.k.a. Iceberg)
On Oct 30, 10:31 pm, Web2Py Freak  wrote:
> My app name is 'Web2py'  and in it i have two 'web2py app':
>
> 1- welcome
> 2-maestro
>
> now i have a domain and in the site app i selected web2py and there is
> nothing in the path so it takes the welcome app
>
> and now i have some other domain and i want it to start mastro web2py
> app  .. i will select web2py and then what to add in the URL path ???


If ALL your other domains only need ONE SAME "web2py app" named
mastro, you are lucky. You only need to rename "mastro" as "welcome"
or "init". Problem solved.

If, in my cases, different domain needs different web2py app to serve,
I use a naive trick. Here is my "web2py app" welcome/default.py 's
index():
Well, my simple

def index():  # serves as a springboard
if request.env.http_host.endswith('site_alpha.com'):
redirect(URL(a='alpha',c='default',f='index'))
if request.env.http_host.endswith('site_beta.com'):
redirect(URL(a='beta',c='default',f='index'))
...

You get the idea.

It is not perfect. End users see a long url, e.g.
http://www.site_alpha.com/alpha/default/index
Besides, if site alpha 's end user types in 
http://www.site_ALPHA.com/BETA/default/index,
oops, he sees contents in site beta. I can live with that. How about
you?

It is possible to use web2py's builtin url rewriting feature, or
nginx's url rewrite feature, which should be faster by the way. But I
did not go that far yet. People who've been there please give some
light.

Regards,
Ray


[web2py] How to hide uuid field in crud create form

2011-10-30 Thread clarix
Hello,

I added an uuid field to my tables to allow to merge dababases:

Field('uuid',default=web2py_uuid(),writable = False),

The problem I find is that the uuid field now shows in the crud.create
forms. I tried to set the uuid readable property to
False but in doing so the crud.create form not only shows the uuid
field but it also allows editing the field.

I would appreciate any help on this. Many thanks!

Clara


[web2py] Advantage to requires clause in controller vs model?

2011-10-30 Thread Tom Campbell
In the building a minimalist facebook  clone 
video at around 7:30 I see this in default.py:

def search()
 # make a form where to type a name
 form = SQLFORM.factory(Field('name',requires=IS_NOT_EMPTY())) 

Question about the requires. This no difference between putting the 
requires clause there vs. in the define_table() method in the model, 
correct? If not is either way considered to be a better web2py convention? 
Generally I think I'd like it in the model, and put it in the controller 
only where it does something contrary to expected behavior, but I'm a noob.


[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Ray (a.k.a. Iceberg)
Hi Massimo,

In the first post of this thread, Arturo said,

"Is there a way in web2py to have varibles be persistent. For example
when I instantiate a class I don't want to re-instantiate it every
time a page is loaded."

I guess what he concerns is performance. In other word, "web2py re-
instantiate all class, variables, app logics, etc. ... every time a
page is loaded. Isn't that sounds slow?" Do we have a doc for this
faq? By the way, does binary compiling a web2py app help much in this
aspect?

Regards,
Ray


On Oct 30, 10:40 pm, Massimo Di Pierro 
wrote:
> this is not a web2py issue. This is an issue for all web applications.
>
> What if your application is replicated on two server behing a load
> balancer? The two servers cannot share objects. What if you use a web
> servers that forks (apache can) than different requests are executed
> by different processes, not different threads? Processes cannot share
> objects. What if you have to restart the web server for maintenance
> purposes? Do you want to store all persistent data?
> The same user may request two pages and these two pages may be server
> by different servers or different processes.
>
> Web applications must be written without persistent objects. State is
> share using the database, using sessions and using cache.
>
> The bahvior you seek can be mimicked by serializing/deserializing the
> objects at every request in session or cache.
>
> Massimo
>
> On Oct 30, 4:39 am, evilaliv3  wrote:
>
>
>
>
>
>
>
> > On 30 Ott, 00:39, Massimo Di Pierro 
> > wrote:
>
> > > You must use cache.ram but this is not guaranteed to work.
>
> > Excuse me Massimo,
> > but, if i understand well this answer, there is no way to have also a
> > persistent connection to the database or a global application variable
> > in web2py?
> > for every request the whole application is reinitialized?
>
> > > In a multi-threaded environment the web server decides which threads
> > > to start/stop/kill.
>
> > does this happen in a deterministic fashion? is there some
> > documentation about?
>
> > Giovanni Pellerano


[web2py] Re: How to hide uuid field in crud create form

2011-10-30 Thread Anthony
Are you saying Field('uuid', default=web2py_uuid(), readable=False, 
writable=False) doesn't hide the field (it should)? Can you show more code?

Also, note that default=web2py_uuid() will only set the default value once 
per request, so if your code happens to insert multiple records in the same 
request, they will get the same uuid. If you want the default to be a 
function that gets called once for each insert, then just pass the function 
itself as the default, rather than calling the function:

default=web2py_uuid

or

default=lambda: web2py_uuid()

Anthony

On Sunday, October 30, 2011 11:18:03 AM UTC-4, clarix wrote:
>
> Hello, 
>
> I added an uuid field to my tables to allow to merge dababases: 
>
> Field('uuid',default=web2py_uuid(),writable = False), 
>
> The problem I find is that the uuid field now shows in the crud.create 
> forms. I tried to set the uuid readable property to 
> False but in doing so the crud.create form not only shows the uuid 
> field but it also allows editing the field. 
>
> I would appreciate any help on this. Many thanks! 
>
> Clara



[web2py] Re: WebFactions Applications

2011-10-30 Thread Anthony
See here: http://web2py.com/book/default/chapter/04#Parameter-Based-System 
-- there's an example mapping domains to apps.

On Sunday, October 30, 2011 10:31:13 AM UTC-4, Web2Py Freak wrote:
>
> My app name is 'Web2py'  and in it i have two 'web2py app': 
>
> 1- welcome 
> 2-maestro 
>
> now i have a domain and in the site app i selected web2py and there is 
> nothing in the path so it takes the welcome app 
>
> and now i have some other domain and i want it to start mastro web2py 
> app  .. i will select web2py and then what to add in the URL path ???



[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Anthony
On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>
> I guess what he concerns is performance. In other word, "web2py re- 
> instantiate all class, variables, app logics, etc. ... every time a 
> page is loaded.


Only the stuff in models, and you can reduce that by using conditional 
models or by moving some code to modules and calling only when needed.

Anthony 


[web2py] Re: Advantage to requires clause in controller vs model?

2011-10-30 Thread Anthony
In general, you would define the validators with the model. However, the 
example below uses SQLFORM.factory, which is not based on an existing model 
(i.e., DB table definition). In other words, there is no define_table in a 
model file associated with that particular form creation.

Anthony

On Sunday, October 30, 2011 11:21:00 AM UTC-4, Tom Campbell wrote:
>
> In the building a minimalist facebook  clone 
> video at around 7:30 I see this in default.py:
>
> def search()
>  # make a form where to type a name
>  form = SQLFORM.factory(Field('name',requires=IS_NOT_EMPTY())) 
>
> Question about the requires. This no difference between putting the 
> requires clause there vs. in the define_table() method in the model, 
> correct? If not is either way considered to be a better web2py convention? 
> Generally I think I'd like it in the model, and put it in the controller 
> only where it does something contrary to expected behavior, but I'm a noob.
>


[web2py] Using a decorator to choose which view to use

2011-10-30 Thread ~redShadow~
In many cases, I find out that I can use a single view to render results
from multiple controllers, for example, I use this to render forms::

{{left_sidebar_enabled=right_sidebar_enabled=False}}
{{extend 'layout.html'}}
{{=title}}
{{=form}}

So I stored that view in ``default/form.html``, and I was calling that
this way from the controller::

def my_form():
# ...
response.view = 'default/form.'+request.extension
return dict(title=mytitle, form=myform)

But it doesn't look very clear at first look which controllers use which
custom view, etc. so I decided to write a decorator to do that.

I came up with this::

def use_custom_view(viewname):
"""Decorator to be used to customize the view to be used
to render a given controller.
"""
def _use_newcontroller(func):
def _newcontroller():
response.view = viewname+'.'+request.extension
return func()
return _newcontroller
return _use_newcontroller

It works quite nicely, and so I replaced the above ``my_form()`` with
this::

@use_custom_view('default/form')
def my_form():
# ...
return dict(title=mytitle, form=myform)

Then, I decided to move the ``use_custom_view()`` function into a
module, in order to reuse it in many controllers.
So, I created a module named ``helpers`` and placed the decorator
function there.

Now the problem is: how do I access ``request`` and ``response`` from
the module? There are many ways, as passing the two variables as
arguments to constructor, or copying them into the module scope.

I choose the second one, doing this::

helpers = local_import('helpers')
helpers.request = request
helpers.response = response

But I don't like having to do this each time I import that module..
Any suggestions on how to do better?
And, isn't already there something like this in the core?

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: Using a decorator to choose which view to use

2011-10-30 Thread Anthony
You can use the new thread local 'current' object. In your module file:

from gluon import *
def use_custom_view(viewname):
[snip]
current.response.view = '%s.%s' % (viewname, 
current.request.extension)
[snip]

Also, note that local_import is no longer necessary -- now you can just do:

import helpers

Anthony

On Sunday, October 30, 2011 11:35:27 AM UTC-4, Samuele Santi wrote:
>
> In many cases, I find out that I can use a single view to render results
> from multiple controllers, for example, I use this to render forms::
>
> {{left_sidebar_enabled=right_sidebar_enabled=False}}
> {{extend 'layout.html'}}
> {{=title}}
> {{=form}}
>
> So I stored that view in ``default/form.html``, and I was calling that
> this way from the controller::
>
> def my_form():
> # ...
> response.view = 'default/form.'+request.extension
> return dict(title=mytitle, form=myform)
>
> But it doesn't look very clear at first look which controllers use which
> custom view, etc. so I decided to write a decorator to do that.
>
> I came up with this::
>
> def use_custom_view(viewname):
> """Decorator to be used to customize the view to be used
> to render a given controller.
> """
> def _use_newcontroller(func):
> def _newcontroller():
> response.view = viewname+'.'+request.extension
> return func()
> return _newcontroller
> return _use_newcontroller
>
> It works quite nicely, and so I replaced the above ``my_form()`` with
> this::
>
> @use_custom_view('default/form')
> def my_form():
> # ...
> return dict(title=mytitle, form=myform)
>
> Then, I decided to move the ``use_custom_view()`` function into a
> module, in order to reuse it in many controllers.
> So, I created a module named ``helpers`` and placed the decorator
> function there.
>
> Now the problem is: how do I access ``request`` and ``response`` from
> the module? There are many ways, as passing the two variables as
> arguments to constructor, or copying them into the module scope.
>
> I choose the second one, doing this::
>
> helpers = local_import('helpers')
> helpers.request = request
> helpers.response = response
>
> But I don't like having to do this each time I import that module..
> Any suggestions on how to do better?
> And, isn't already there something like this in the core?
>
> -- 
> Samuele ~redShadow~ Santi
> 
>  redshadow[at]hackzine.org - redshadowhack[at]gmail.com
>
>   Blog: http://hackzine.org
>
>   GPG Key signature:
>050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933
> 
> /me recommends:
> Squadra Informatica - http://www.squadrainformatica.com
> 
>  - Proud ThinkPad T-Series owner
>  - Registered Linux-User: #440008
>   * GENTOO User since 1199142000 (2008-01-01)
>   * former DEBIAN SID user
> 
>   "Software is like sex: it's better when it's free!"
>   -- Linus Torvalds
>
>

Re: [web2py] Re: Persistent variables in web2py

2011-10-30 Thread Michele Comitini
If you need distributed caching look at http://memcached.org/.

mic
Il giorno 30/ott/2011 16:30, "Anthony"  ha scritto:

> On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>>
>> I guess what he concerns is performance. In other word, "web2py re-
>> instantiate all class, variables, app logics, etc. ... every time a
>> page is loaded.
>
>
> Only the stuff in models, and you can reduce that by using conditional
> models or by moving some code to modules and calling only when needed.
>
> Anthony
>


[web2py] issueTracking

2011-10-30 Thread mart
Hi,

I am shamelessly using Massimo's issueTracking and redoing it to
replace my own "request" app (because obviously, massimo does it
better than i could ;) )

If any body has played with it, i would have a few questions:

1) depending on the type of request, i would like the form to expose
different form fields
2) I wold like to do either of the following:


[web2py] Re: issueTracking

2011-10-30 Thread mart
sorry... i hit 'return' to quickly ;)

continuing:

2) I would like to do have a layout where fields are grouped by
"category", maybe using something like a . I.e.

* category 1
* bla: blabla
* bla_1 : blabla
* bla_2: blabla

* category 2
* bla_3: blabla
* bla_4 : blabla
* bla_5: blabla

* etc

also, in the 'issue' grid, i am not seeing the dafault "view"
button... does somebody know how to get them to display?

ANy help is appreciated :)

thanks,
Mart :)


On Oct 30, 1:43 pm, mart  wrote:
> Hi,
>
> I am shamelessly using Massimo's issueTracking and redoing it to
> replace my own "request" app (because obviously, massimo does it
> better than i could ;) )
>
> If any body has played with it, i would have a few questions:
>
> 1) depending on the type of request, i would like the form to expose
> different form fields
> 2) I wold like to do either of the following:


Re: [web2py] Re: table.format cannot be set after define_table()?

2011-10-30 Thread Anthony
Now that I think about it, this has already been fixed in trunk. In trunk, 
you should be able to do:

db.person._format='whatever'

without having to first delete _format. That will work for any table 
attribute starting with an underscore, including the new _singular and 
_plural attributes (which are used as singular and plural table labels).

Anthony

On Sunday, October 30, 2011 2:51:42 AM UTC-4, viniciusban wrote:
>
> Thank you.
>
> It worked. :-)
>
> I think it would be nice to update book to document it, right?
>
> On Sun, Oct 30, 2011 at 4:24 AM, Anthony  wrote:
> > On Sunday, October 30, 2011 1:44:47 AM UTC-4, viniciusban wrote:
> >>
> >> In the book there's this comments about it:
> >>
> >> [cite]
> >> Most attributes of fields and tables can be modified after they are
> >> defined:
> >>
> >> db.define_table('person',Field('name',default=''),format='%(name)s')
> >> db.person._format = '%(name)s/%(id)s'
> >
> > You can make the above work by preceding that last line with:
> > db.person.pop('_format')
> > That will remove the '_format' key from db.person, which will then allow 
> you
> > to add a new one. Note, you can't do del db.person['_format'] because in
> > that case it thinks you are trying to access a record in the db.person 
> table
> > (nor del db.person._format, because it won't recognize _format as an
> > attribute, since technically it is a dict key).
> > Anyway, perhaps we should enable keys that start with _ to be changed 
> (which
> > is the case with DAL objects).
> > Anthony
>
>

[web2py] Powertable and DAL count

2011-10-30 Thread Wes Hall
I am trying to show a grouped count in a powertable. How do I
reference the count's storage object?


def event_list():
class Virtual(object):
@virtualsettings(label='Count')
def email_count(self):
return ??? # What do I need to reference?

report_id = int(request.args[0])

count1 = db.events.email.count()
datasource = db(
(db.events.report_id==report_id) &
(db.events.event_type=='event1')
).select(
db.events.id,
count1,
db.events.email,
db.events.name,
db.users.first_name,
db.users.last_name,
left=db.users.on(
db.events.email==db.users.email),
groupby=db.events.email)

table = plugins.powerTable
table.datasource=datasource
table.headers = 'labels'
table.virtualfields = Virtual()
table.keycolumn = 'events.id'
table.columns = ['virtual.email_count','events.email']

...


This is my first web2py project and second python project, so if it is
a lack of basic understanding, pointing me towards helpful resources
would also be appreciated.

Thank you


Re: [web2py] Re: Using a decorator to choose which view to use

2011-10-30 Thread ~redShadow~
On Sun, 2011-10-30 at 08:54 -0700, Anthony wrote:
> You can use the new thread local 'current' object. In your module
> file:
> 
> 
> from gluon import *
> def use_custom_view(viewname):
> [snip]
> current.response.view = '%s.%s' % (viewname,
> current.request.extension)
> [snip]
> 
> 
> Also, note that local_import is no longer necessary -- now you can
> just do:
> 
> 
> import helpers

Nice! It did the job.

BTW, is there any way to automatically watch module files for changes
using inotify and reload() them automatically upon change, at least
during development? Many times it gets confusing when changes in modules
in the modules dir don't apply while changes in controllers etc. does..

Some times ago I created a similar mechanism for a PyQt4 application;
for what I remember I took some code from a CherryPy "autoreload"
component but http://www.cherrypy.org/wiki/AutoReload is a 404 and
http://docs.cherrypy.org/dev/progguide/autoreloader.html seems to work
using a clock instead of inotify to watch files, plus it relaunches
process instead of reload()ing modules.. 
-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] Re: Using a decorator to choose which view to use

2011-10-30 Thread Anthony
On Sunday, October 30, 2011 2:04:47 PM UTC-4, Samuele Santi wrote:
>
> BTW, is there any way to automatically watch module files for changes
> using inotify and reload() them automatically upon change, at least
> during development?
>
from gluon.custom_import import track_changes; track_changes(True)

This will reload modules, but only when they change.

BTW, all of this will be documented in the upcoming revision of the book.

Anthony


Re: [web2py] Re: WebFactions Applications

2011-10-30 Thread Vasile Ermicioi
a few steps that I use, I assume that you already installed web2py :)
0) set your domain at your registrar to point to webfaction dns servers
1) add your domain to webfaction domains
2) set your domain to be handled by your app (see webfaction's websites)
3 )create a routes.py (or rename routes_example.py) file with the content

routes_in = (
('(.*):https?://(www\.)?yoursitename1\.com:(.*)/', '/yourapp1/'),
('(.*):https?://(www\.)?yoursitename2\.com:(.*)/', '/yourapp2/'),
 )


def __routes_doctest():
pass

if __name__ == '__main__':
import doctest
from gluon.rewrite import *
load(routes=__file__)
doctest.testmod()

4) restart your server (apache, nginx or whatever server you use)

this kind of installation doesn't need multiple web2py's installations


[web2py] putting a condition in a form

2011-10-30 Thread mart
Hi,

does anyone know if I can have some sort of condition in a form (but
BEFORE the form is submitted)?

For example, lets say I have 5 fields in a form where depending on
what a user decides, we would expose 2 extra fields (or not). Anyway
to do something like this? I am open to any suggestion :)

thanks,
Mart :)


[web2py] Re: How to hide uuid field in crud create form

2011-10-30 Thread clarix
Hello Anthony,

I think I found the problem. I had generated the table with the wizard
and I had an id field in the table. I removed the id field and the
uuid didn't show in the form anymore. I assume you either have an id
field or a uuid field not both. Sorry for my clumsiness, I am a
starter.

Also, thanks for the advice about making sure the web2py_uuid is
called for each individual request.

Thanks very much for your help, it is awesome to get sound answers so
quickly in this forum.

Regards,

Clara

On Oct 30, 12:28 pm, Anthony  wrote:
> Are you saying Field('uuid', default=web2py_uuid(), readable=False,
> writable=False) doesn't hide the field (it should)? Can you show more code?
>
> Also, note that default=web2py_uuid() will only set the default value once
> per request, so if your code happens to insert multiple records in the same
> request, they will get the same uuid. If you want the default to be a
> function that gets called once for each insert, then just pass the function
> itself as the default, rather than calling the function:
>
> default=web2py_uuid
>
> or
>
> default=lambda: web2py_uuid()
>
> Anthony
>
>
>
>
>
>
>
> On Sunday, October 30, 2011 11:18:03 AM UTC-4, clarix wrote:
>
> > Hello,
>
> > I added an uuid field to my tables to allow to merge dababases:
>
> > Field('uuid',default=web2py_uuid(),writable = False),
>
> > The problem I find is that the uuid field now shows in the crud.create
> > forms. I tried to set the uuid readable property to
> > False but in doing so the crud.create form not only shows the uuid
> > field but it also allows editing the field.
>
> > I would appreciate any help on this. Many thanks!
>
> > Clara


[web2py] Re: putting a condition in a form

2011-10-30 Thread apple
http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms

On Oct 30, 9:30 pm, mart  wrote:
> Hi,
>
> does anyone know if I can have some sort of condition in a form (but
> BEFORE the form is submitted)?
>
> For example, lets say I have 5 fields in a form where depending on
> what a user decides, we would expose 2 extra fields (or not). Anyway
> to do something like this? I am open to any suggestion :)
>
> thanks,
> Mart :)


[web2py] Communicating With C Application

2011-10-30 Thread Ialejandro
Hi! I'm building a simple (really) bank simulator for my class, I need
to communicate my existing web2py app (just a CRUD) with a C
application, what´s the best way to do that??

I mean, I need to have the same CRUD functionality in both sides, web
(with web2py) and client (Ansi C, Unix/Linux/Mac), I'm using the
default SQLITE integrated with web2py.


[web2py] Re: Communicating With C Application

2011-10-30 Thread Ialejandro
I think the question is fuzzy...

I know It can be done by writing SQL queries from C... but I want to
use web2py as intermediary, so for example,

to insert a new client the C app just send a query like this:

127.0.0.1:8080/bank/remoteCalls/insertClient?name=

but what's the best way to retrieve rows from web2py?

On Oct 30, 3:47 pm, Ialejandro  wrote:
> Hi! I'm building a simple (really) bank simulator for my class, I need
> to communicate my existing web2py app (just a CRUD) with a C
> application, what´s the best way to do that??
>
> I mean, I need to have the same CRUD functionality in both sides, web
> (with web2py) and client (Ansi C, Unix/Linux/Mac), I'm using the
> default SQLITE integrated with web2py.


[web2py] Vim and syntax highlight.

2011-10-30 Thread f4eedu
Hi,
Did anyone managed to set vim showing proper syntax highlight? It
would be great if syntax could be displayed just like in the admin
editor.
Regards,
F4eedu


[web2py] Re: putting a condition in a form

2011-10-30 Thread mart
cool! thanks :)

On Oct 30, 5:39 pm, apple  wrote:
> http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms
>
> On Oct 30, 9:30 pm, mart  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > does anyone know if I can have some sort of condition in a form (but
> > BEFORE the form is submitted)?
>
> > For example, lets say I have 5 fields in a form where depending on
> > what a user decides, we would expose 2 extra fields (or not). Anyway
> > to do something like this? I am open to any suggestion :)
>
> > thanks,
> > Mart :)


[web2py] Wordpress and web2py

2011-10-30 Thread Kenneth Lundström

Hi listmembers,

a client of mine asked if Wordpress and web2py could be combined somehow.

He has an Wordpress website and wants to continue using but has some 
specifiec needs that he would like to be solved with web2py.


So when a user logins he does it in Wordpress, then he wants to look at 
some charts that are generated with pychart so somehow we need to login 
the user into web2py without having the user do it.


Any ideas how to do this?


Kenneth



[web2py] Re: Wordpress and web2py

2011-10-30 Thread Anthony
I haven't tried it, but maybe you can set up single sign-on and make use of 
web2py's CAS client 
functionality: 
http://web2py.com/book/default/chapter/08#Central-Authentication-Service.

On Sunday, October 30, 2011 7:44:45 PM UTC-4, Kenneth wrote:
>
> Hi listmembers,
>
> a client of mine asked if Wordpress and web2py could be combined somehow.
>
> He has an Wordpress website and wants to continue using but has some 
> specifiec needs that he would like to be solved with web2py.
>
> So when a user logins he does it in Wordpress, then he wants to look at 
> some charts that are generated with pychart so somehow we need to login 
> the user into web2py without having the user do it.
>
> Any ideas how to do this?
>
>
> Kenneth
>
>

[web2py] Re: Cheaper hosting...

2011-10-30 Thread pbreit
Looks like a decent deal. I'd wonder how well Web2py works in 128mb. I 
switched from 256mb to 512mb and got a lot better performance. But 256mb 
was enough to at least run.

[web2py] Re: How can I retain form data across a web2py_component() refresh?

2011-10-30 Thread TheSweetlink
How delightfully newbtastic of me.  I don't have it working quite the
way I want to yet but it does indeed appear that a global JS variable
will do the trick.

Thanks for the help Anthony.

David

On Oct 28, 6:52 pm, Anthony  wrote:
> On Friday, October 28, 2011 6:50:20 PM UTC-4, TheSweetlink wrote:
>
> > Do you mean something like use jQuery from the outer part of the page
> > which contains the component?
>
> > I do not know how I would do that.  I tried something along those
> > lines unsuccessfully before but I may have just implemented it
> > incorrectly.
>
> > My trouble is having js interact with the stuff loaded into the
> > component, from outside the component.
>
> Yes. The component is just a div in the page, so JS from outside the
> component should be able to interact with it. In fact, you can have one
> component interact with another (e.g., clicking a link in one component can
> trigger another to reload).
>
> Anthony


[web2py] Re: putting a condition in a form

2011-10-30 Thread mart
hum... doesn't seem to be working for me... maybe because I am using
these things:

myTable=db.Table(None,'myTable',
Field('name'))

db.define_table('stuff',myTable))

oh well, I'll keep digging...

Thanks,
Mart :)

On Oct 30, 7:10 pm, mart  wrote:
> cool! thanks :)
>
> On Oct 30, 5:39 pm, apple  wrote:
>
>
>
>
>
>
>
> >http://web2py.com/book/default/chapter/10#Conditional-Fields-in-Forms
>
> > On Oct 30, 9:30 pm, mart  wrote:
>
> > > Hi,
>
> > > does anyone know if I can have some sort of condition in a form (but
> > > BEFORE the form is submitted)?
>
> > > For example, lets say I have 5 fields in a form where depending on
> > > what a user decides, we would expose 2 extra fields (or not). Anyway
> > > to do something like this? I am open to any suggestion :)
>
> > > thanks,
> > > Mart :)


Re: [web2py] Re: Wordpress and web2py

2011-10-30 Thread Ovidio Marinho
Well with respect to a statistic that still needs to be done by someone, but
 LucasDávila already prepared to import the XML wordpress, this in your
github. https://github.com/lucasdavila/web2py-cms/tree/1.x



   Ovidio Marinho Falcao Neto
Web Developer
 ovidio...@gmail.com
  ovidiomari...@itjp.net.br
 ITJP - itjp.net.br
   83   8826 9088 - Oi
   83   9334 0266 - Claro
Brasil



2011/10/30 Anthony 

> I haven't tried it, but maybe you can set up single sign-on and make use
> of web2py's CAS client functionality:
> http://web2py.com/book/default/chapter/08#Central-Authentication-Service.
>
>
> On Sunday, October 30, 2011 7:44:45 PM UTC-4, Kenneth wrote:
>>
>> Hi listmembers,
>>
>> a client of mine asked if Wordpress and web2py could be combined somehow.
>>
>> He has an Wordpress website and wants to continue using but has some
>> specifiec needs that he would like to be solved with web2py.
>>
>> So when a user logins he does it in Wordpress, then he wants to look at
>> some charts that are generated with pychart so somehow we need to login
>> the user into web2py without having the user do it.
>>
>> Any ideas how to do this?
>>
>>
>> Kenneth
>>
>>


[web2py] Re: Persistent variables in web2py

2011-10-30 Thread Massimo Di Pierro
As Anthony suggests you can move code to modules and import modules.
Module can have global level variables (that do not depend on the user
or the request) that will be persistant within the process that
imports the module.

Database connections anyway, are handled by web2py in an efficient way
already, by using connection pooling.

On Oct 30, 10:30 am, Anthony  wrote:
> On Sunday, October 30, 2011 11:21:56 AM UTC-4, Ray (a.k.a. Iceberg) wrote:
>
> > I guess what he concerns is performance. In other word, "web2py re-
> > instantiate all class, variables, app logics, etc. ... every time a
> > page is loaded.
>
> Only the stuff in models, and you can reduce that by using conditional
> models or by moving some code to modules and calling only when needed.
>
> Anthony


Re: [web2py] Re: Auth in MongoDB

2011-10-30 Thread ~redShadow~
On Fri, 2011-10-28 at 12:12 -0700, Francisco Costa wrote: 
> Hi Samuele, thanks for your answer.
> Do you have any idea whats the status of the mongodb adapter
> development?

I know that Massimo was going to work on that once finished the new
documentation, and I am doing some experiments too (although I have to
reverse-engineer the whole DAL mechanism due to documentation lack, and
it's definitely not the primary thing I'm working on..).

Plus (IMHO: don't take this as official since it's only how I see it), I
think it would take some development on the DAL too in order to make
full use of the mongodb features while allowing to keep the same
functionality on other databases too.. (In mongodb you don't care about
the record schema at all, while in other databases you cannot, so either
you don't make use of that or you need something to make a similar
behavior work on all databases too..).

So, I guess the best thing for the moment is using directly pymongo
(using the ``DAL()`` just for the pooling mechanism) and subclass
``Auth`` and ``Crud`` to make them work with pymongo directly.

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


Re: [web2py] Cheaper hosting...

2011-10-30 Thread ~redShadow~
On Sun, 2011-10-30 at 02:29 -0700, Magnitus wrote: 
> So far, I've been using this service for my personal apps at 1 node:
> http://www.vps.net/product/cloud-servers/
> 
> Recently, someone suggested this: http://fibervolt.com/vps.php
> 
> At the lower specs range (and assuming you don't use even a 1/10 of
> the bandwidth vps provides), you have something that is almost as good
> for like 25$/year (instead of 20$/month) and something that is
> definitely better at less than 1/3 of the price (6$/month instead of
> 20$/month).
> 
> Seems too good to be true.
> 
> Anybody has any experience with them?

My personal suggestion is for http://www.hetzner.de/
I have been using their products (both dedicated servers and vservers)
for about five years, and the service is great while prices are usually
lower than competitors.
Their lowest-price vserver is 7.90 EUR/month with 512MB ram and 20GB
HDD; the only disadvantage is that unless vps/linode/.. VMs are on
directly physical machines and not on a redundancy cloud, so it's a bit
less fault-tolerant; anyways, I never get any noticeable downtime, even
when they were turning off routers/switches for maintenance, etc..

-- 
Samuele ~redShadow~ Santi

 redshadow[at]hackzine.org - redshadowhack[at]gmail.com

  Blog: http://hackzine.org

  GPG Key signature:
   050D 3E9F 6E0B 44CE C008 D1FC 166C 3C7E EB26 4933

/me recommends:
Squadra Informatica - http://www.squadrainformatica.com

 - Proud ThinkPad T-Series owner
 - Registered Linux-User: #440008
  * GENTOO User since 1199142000 (2008-01-01)
  * former DEBIAN SID user

  "Software is like sex: it's better when it's free!"
  -- Linus Torvalds



signature.asc
Description: This is a digitally signed message part


[web2py] Re: JSONDecodeError: No JSON object could be decoded

2011-10-30 Thread wwwgong
ok, do you know a javascript client example? Thanks,

On Oct 30, 12:42 am, Jonathan Lundell  wrote:
> On Oct 29, 2011, at 9:36 PM, wwwgong wrote:
>
>
>
>
>
>
>
>
>
> > Hi,
> > add 2 functinos in myapp/controller/default.py
>
> > @service.run
> > def concat(a,b):
> >    return a+b
>
> > @service.jsonrpc
> > def concat2(a,b):
> >    return a+b
>
> > test them using browser
> > 1)
> >http://127.0.0.1:8000/myapp/default/call/run/concat?a=hello&b=world
> > --> return 'helloworld'
>
> > 2)
> >http://127.0.0.1:8000/myapp/default/call/jsonrpc/concat2?a=hello&b=world
> > --> error
> > Traceback (most recent call last):
> >  File "gluon/restricted.py", line 192, in restricted
> >  File "C:/web2py/applications/myapp/controllers/default.py", line
> > 100, in 
> >  File "gluon/globals.py", line 145, in 
> >  File "C:/web2py/applications/myapp/controllers/default.py", line 80,
> > in call
> >  File "gluon/tools.py", line 3937, in __call__
> >  File "gluon/tools.py", line 3776, in serve_jsonrpc
> >  File "gluon/contrib/simplejson/__init__.py", line 386, in loads
> >  File "gluon/contrib/simplejson/decoder.py", line 403, in decode
> >  File "gluon/contrib/simplejson/decoder.py", line 421, in raw_decode
> > JSONDecodeError: No JSON object could be decoded: line 1 column 0
> > (char 0)
>
> > I am able to run todoApp from web2py book, so json module should be
> > working, but why cannot I test jsonrpc this way in browser?
>
> The JSON-RPC service expects a JSON object (with specific content) as input. 
> You're not providing it.
>
>
>
>
>
>
>
>
>
> > Thanks,
> > Wen


Re: [web2py] Re: JSONDecodeError: No JSON object could be decoded

2011-10-30 Thread Jonathan Lundell
On Oct 30, 2011, at 9:00 PM, wwwgong wrote:

> ok, do you know a javascript client example? Thanks,

Not offhand, no. But there's JSON-RPC documentation on the web that explains 
the protocol pretty well. And there's a client in the web2py contrib directory.

> 
> On Oct 30, 12:42 am, Jonathan Lundell  wrote:
>> On Oct 29, 2011, at 9:36 PM, wwwgong wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi,
>>> add 2 functinos in myapp/controller/default.py
>> 
>>> @service.run
>>> def concat(a,b):
>>>return a+b
>> 
>>> @service.jsonrpc
>>> def concat2(a,b):
>>>return a+b
>> 
>>> test them using browser
>>> 1)
>>> http://127.0.0.1:8000/myapp/default/call/run/concat?a=hello&b=world
>>> --> return 'helloworld'
>> 
>>> 2)
>>> http://127.0.0.1:8000/myapp/default/call/jsonrpc/concat2?a=hello&b=world
>>> --> error
>>> Traceback (most recent call last):
>>>  File "gluon/restricted.py", line 192, in restricted
>>>  File "C:/web2py/applications/myapp/controllers/default.py", line
>>> 100, in 
>>>  File "gluon/globals.py", line 145, in 
>>>  File "C:/web2py/applications/myapp/controllers/default.py", line 80,
>>> in call
>>>  File "gluon/tools.py", line 3937, in __call__
>>>  File "gluon/tools.py", line 3776, in serve_jsonrpc
>>>  File "gluon/contrib/simplejson/__init__.py", line 386, in loads
>>>  File "gluon/contrib/simplejson/decoder.py", line 403, in decode
>>>  File "gluon/contrib/simplejson/decoder.py", line 421, in raw_decode
>>> JSONDecodeError: No JSON object could be decoded: line 1 column 0
>>> (char 0)
>> 
>>> I am able to run todoApp from web2py book, so json module should be
>>> working, but why cannot I test jsonrpc this way in browser?
>> 
>> The JSON-RPC service expects a JSON object (with specific content) as input. 
>> You're not providing it.
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Thanks,
>>> Wen




[web2py] Re: WebFactions Applications

2011-10-30 Thread Ray (a.k.a. Iceberg)

On Oct 31, 3:27 am, Vasile Ermicioi  wrote:
> a few steps that I use, I assume that you already installed web2py :)
> 0) set your domain at your registrar to point to webfaction dns servers
> 1) add your domain to webfaction domains
> 2) set your domain to be handled by your app (see webfaction's websites)
> 3 )create a routes.py (or rename routes_example.py) file with the content
>
> routes_in = (
> ('(.*):https?://(www\.)?yoursitename1\.com:(.*)/', '/yourapp1/'),
>         ('(.*):https?://(www\.)?yoursitename2\.com:(.*)/', '/yourapp2/'),
>  )
>
> def __routes_doctest():
>     pass
>
> if __name__ == '__main__':
>     import doctest
>     from gluon.rewrite import *
>     load(routes=__file__)
>     doctest.testmod()
>
> 4) restart your server (apache, nginx or whatever server you use)
>
> this kind of installation doesn't need multiple web2py's installations


Thanks for the hint. I managed to come up with a seemingly simpler
routes.py for same purpose.

routers = dict(
   BASE = dict(
domains = {
"my_domain.com" : "app1",
"another_domain.com" : "app2",
},
),
)

However, the only downside is only one said app is exposed to the said
domain. What if my domain need two apps to serve?

Regards,
Ray


[web2py] should this work? {{=form[0][-1]}}

2011-10-30 Thread mart
Hi,

in a view, should i be able to execute this submit button? {{=form[0]
[-1]}}

it does display the button, but doesn't submit..

Thanks,
Mart :)