[web2py] Help about the restful api

2011-05-18 Thread Tiago Moutinho
Hi,

I have some difficulties on using @resquest.restful().
I want to do some experiments using GET, POST, PUSH and DELETE, but i can 
not make it work.
Only GET works for me.

How can i do for example a def POST(name): ??

I did this:

def POST(name):
return db.blog.validate_and_insert(name = name)

cumps,
Tiago




Re: [web2py] Re: New importer in trunk

2011-05-18 Thread Martín Mulone
Use it like a helper.

in a module I have:
(this fail because LOAD is not passed in current and loadfactory need
enviroment)

def renderimages(self, page=1, postid=0):curvars = {}
  curvars['page']=pagecurvars['postid']=postid
   return LOAD('plugin_i2padmin', 'imageslist.load',
vars=curvars, ajax=True)


in a view:


{{=current.myapp.mymodule.renderimages(page,postid)}}


I know you are going to say use directly the load in a view, but sometimes
the things get more complex than this example.

2011/5/17 Massimo Di Pierro massimo.dipie...@gmail.com

 What do you want to do exactly with LOAD in modules?

 On May 17, 1:36 pm, Martín Mulone mulone.mar...@gmail.com wrote:
  Pierreth I'm testing this, and it all seem to work very well, nice
 feature
  indeed!. I'm looking for memory leak but it's seem stable in my notebook.
 I
  already rewrite powerpack, to support this, at first sigth it's double
 the
  speed from the old way putting all in models (I have many models). So I'm
  waiting to be stable. Also I'm waiting an answer on how can I use the
 LOAD()
  in modules.
 
  2011/5/17 pierreth pierre.thibau...@gmail.com
 
   It would be nice to have feedback to know if the new feature is
   working well for you. Tell me if everything is OK or not.
 
  --
   http://martin.tecnodoc.com.ar




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


Re: [web2py] Re: little bug ldap_auth

2011-05-18 Thread José Luis Redrejo
If works for me too.
(tested against servers running OpenLdap over Debian Squeeze and Debian Lenny)
Regards.

2011/5/17 Joseph.Piron joseph.pi...@gmail.com:
 Yes it works (MS2003 AD server).

 On May 17, 3:54 pm, Massimo Di Pierro massimo.dipie...@gmail.com
 wrote:
 It is possible that some system are more picky than others
 does it work if you replace (in line 10)

 '(objectClass=*)'

 with

 'objectClass=*'

 If it does, it should be changed.

 On May 17, 6:51 am, José Luis Redrejo jredr...@gmail.com wrote:







  2011/5/17 Joseph.Piron joseph.pi...@gmail.com:

   Hi all,

   I think there's a little bug in ldap_auth.py, indeed for the parameter
   filterstr of ldap_auth(..) (line 10), the default value is set to
   (objectClass=*) and during the call of search_ext_s (line 97), the
   filter argument is constructed with
   ((sAMAccountName=%s)(%s)) % (username_bare, filterstr)

   which will introduce double parenthesis around objectClass=*  .
   I suggest to remove them from the default parameter value.

  Sorry, but I don't see the bug, and it's working perfectly in my 
  systems

   Regards all!


Re: [web2py] Post Data Obfuscation

2011-05-18 Thread José Luis Redrejo
2011/5/18 luckysmack luckysm...@gmail.com:
 I recently listened to a podcast from a HOPE conference last year, and
 the podcast talked about post data obfuscation. Where when the post
 data is submitted it is obfuscated by javascript and a false copy is
 passed through POST and a real copy is sent to the server. it also
 send a special key that is encrypted and the server only knows the
 real key. So if the hacker find out the POST data is obfuscated and
 tries to do the same, the server will know whether its the real copy
 or not.

 I was curious if web2py (or really python in general, that i could
 plug into web2py) had any kind of feature like this. I figured it
 might not, So my second part of the question is if anyone knows of a
 way to do this in python that I can use with web2py. In the end if I
 can get this to work I would be willing to submit my code for others
 to use so we can all benefit.

 So for eaither method, i was looking if anyone had something to help
 me get started.

 Heres the podcast (mp3) in questioned I listened to:

 http://c2047862.cdn.cloudfiles.rackspacecloud.com/tnhb05.mp3

 which is from this site (they have some other great talks about web as
 well. though most are generally security and hackerish related)

 http://thenexthope.org/talks-list/


Running the application over https you get the same benefit when using
Post (supposing the hacker access to the posted data using a network
sniffer)


[web2py] Re: recommendations for production system?

2011-05-18 Thread villas
I use vps.net with apache and firebird DB, but when the server was
under higher loads it used to easily jam and require reboot.  I now do
this:

1 node:  Firebird DB server
2 nodes: Apache

It is no longer a 'cheap' set-up, but it is the most reliable we ever
had and I can effectively run as many domains as I want.  It seems
very robust indeed.

I tried the various control panels, but they always cost me more time
than simply logging in and doing things manually. The point is that
when your backups and cron scripts are working ok,  the server
requires hardly any management at all.

For me,  root access is much easier from a server management point of
view,  but make sure you have a full strength password and always
change sshd from port 22!  Of course if you need high-security,  you
should not use root - there are just too many bots out there!


On May 17, 11:54 pm, Carlos carlosgali...@gmail.com wrote:
 Hi all,

 In order to prepare my web2py production system, I would really welcome all
 your advice.

 I will get one node from vps.net:

    http://vps.net/product/cloud-servers
    dedicated cpu = 0.6 GHz
    dedicated ram = 376 MB
    disk space = 10 GB
    network transfer = 250 GB

 I am planning to install the following software:

    os = ubuntu 10.04 (lucid) x64 basic installation
    web = apache2
    db = postgresql
    sh =http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh

 Is the above the recommended configuration (based on my one node capacity @
 vps.net)?.

 I've read that nginx web server is really good, should I reconsider this?,
 instead or in addition to apache?.

 Would you recommend a different configuration if I eventually add more
 nodes/capacity?.

 Any other software?, e.g. web server control panels?.

    - isp manager
    - webmin
    - virtualmin
    - landscape

 Thanks in advance for all your recommendations.

 p.s. my experience has been mostly with Windows.

    Carlos


[web2py] Re: recommendations for production system?

2011-05-18 Thread Ross Peoples
On a quick side note, you are not supposed to use Webmin with Ubuntu. It is 
mentioned in several places that it breaks Debian-based systems. Ubutnu has 
been pushing eBox (now Zentyal) which is more for setting up a small 
business infrastructure than managing a web server. As is mentioned, 
managing Apache (or whatever you intend to use) yourself is the best way, 
even though it's not the easiest or the most convenient.

[web2py] Re: Help about the restful api

2011-05-18 Thread Tiago Moutinho
I just make POST method work with an script, but i still have some
doubts about PUSH, and DELETE.

def testing():

import urllib
import urllib2
params = {
'name': request.args(0),
'birth': request.args(1)
}
http_response = urllib2.urlopen('http://localhost/post/post_test',
urllib.urlencode(params))
return http_response

Does anyone have some ideas in makinh PUSH AND DELETE work???



On May 18, 10:31 am, Tiago Moutinho tiago...@gmail.com wrote:
 Hi,

 I have some difficulties on using @resquest.restful().
 I want to do some experiments using GET, POST, PUSH and DELETE, but i can
 not make it work.
 Only GET works for me.

 How can i do for example a def POST(name): ??

 I did this:

 def POST(name):
     return db.blog.validate_and_insert(name = name)

 cumps,
 Tiago


[web2py] HELP IN DELETE AND PUSH METHODS USING RESTFUL API

2011-05-18 Thread Tiago Moutinho
Hi,

I need some help about the delete and push methods using restful api.
I made POST method work using urllib2, but i can not find anything on the 
web about DELETE AND PUSH

Please help

Thks in advance


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread SergeyPo
Vasile,

I am using Python 2.5 on Windows XP,
MySQL mysql  Ver 14.14 Distrib 5.1.32, for Win32 (ia32)
InnoDB engine, UTF-8 encoding

I have large database with lots of data, hard to reproduce here.
Application works fine on web2py version 1.86.2 and works with many
small errors in web2py 1.95, about 3 times slower.
For benchmarking I use my own app which includes heavy offline process
that I call with
python web2py.py -S advantage -M -R applications/advantage/modules/
preparer.py

It takes 12 hours under 1.95 (pymysql) and 4 hours under 1.86
I am also watching on memory in task manager...

I am experienced developer but I don't have time to dig in third party
modules like pymysql, esp. that I know that before the whole thing
worked much better.

Thank you!
Sergey

On 16 май, 17:19, Vasile Ermicioi elff...@gmail.com wrote:
 and python version please (needed for benchmarking)

 pymysql also have the advantage to run on top of jython and pypy with no
 efforts
 and I guess that on top of pypy it will have much better performance


[web2py] Re: recommendations for production system?

2011-05-18 Thread glimmung
Hi Ross,

On May 18, 11:59 am, Ross Peoples ross.peop...@gmail.com wrote:
 On a quick side note, you are not supposed to use Webmin with Ubuntu. It is
 mentioned in several places that it breaks Debian-based systems. Ubutnu has
 been pushing eBox (now Zentyal) which is more for setting up a small
 business infrastructure than managing a web server. As is mentioned,
 managing Apache (or whatever you intend to use) yourself is the best way,
 even though it's not the easiest or the most convenient.

I'm baffled by that statement - can you provide a source, please?

Ubuntu (in its LTS versions) is specifically listed as a supported
operating system for Webmin, and a Grade A supported operating
system for Virtualmin [1]. As you suggest, eBox/Zentyal does *NOT* do
the same job as Webmin/Virtualmin.

I have used Webmin and Virtualmin for a couple of years now on LTS
versions of Ubuntu, and have had a very positive experience of it. As
well as web2py, I also do integration and hosting with Zope and Plone,
and I've been very happy letting Virtualmin manage Apache for the
standard virtual hosts, and managing web2py, Zope and Plone virtual
hosts by hand.

HTH

[1] http://www.virtualmin.com/os-support

---

Cheers,

PhilK



[web2py] with_alias with where clause

2011-05-18 Thread Rohan
web2py: Version 1.92.1 (2011-02-16 15:04:40)


with_alias fails to work when where clause is specified. It works fine when 
documented example is run

 db()._select(db.person.name, Father.name, Mother.name, 
left=(Father.on(Father.id==db.person.father_id), 
Mother.on(Mother.id==db.person.mother_id)))

'SELECT  person.name, father.name, mother.name FROM person LEFT JOIN person 
AS father ON (father.id = person.father_id) LEFT JOIN person AS mother ON 
(mother.id = person.mother_id);'

but it fails where I specify a where clause

 db((db.person.father_id == Father.id))._select(db.person.name, 
Father.name)

SELECT  person.name, father.name FROM person, father WHERE (person.father_id 
= father.id);

in second case, alias is not created. Read in a thread that with_alias 
currently supports left outer join only. Any plan to extend its usage?


[web2py] Re: recommendations for production system?

2011-05-18 Thread Carlos
Hi,

Thank you all for your comments and recommendations.

Based on your feedback, I'm leaning towards using Nginx (instead of Apache) 
for all static and dynamic content.

One question: is the following script up-to-date with everything I need to 
setup web2py with nginx?:

   
http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-ubuntu.sh

I am planning on using 'root' as well, but I will follow your advice about 
picking a strong password and changing the default 22 port - would this be 
enough?.

I would also want to be able to edit my application files (models, 
controllers, views) remotely from my Windows environment (via sftp?), just 
in case of emergencies, and hopefully use the same ide (wing) as my 
development environment - is this possible via any of the following 
options?:

   http://www.expandrive.com
   http://www.swish-sftp.org
   http://cyberduck.ch
   http://winscp.net
   http://us3.samba.org
   http://dokan-dev.net/en
   http://www.webdrive.com/products/webdrive

... or do you recommend another file manager client from Windows to the 
remote ubuntu server (with capabilities for editing in wing ide)?.

Furthermore, what scripts (fabric?) should I actually have in place in order 
to be fully ready?.

Btw I will be using mercurial:
   - for development, pushing to bitbucket for my own remote repository, in 
addition to a 2nd. respository for web2py,
   - for production, with two respositories, one pulling from 
https://web2py.googlecode.com/hg/web2py and another one pulling from my 
bitbucket remote repository.

Very important: please confirm that Nginx is a better (and stable) 
alternative to Apache.

Thanks very much !

   Carlos



[web2py] App blog as subdomain of another app

2011-05-18 Thread Tiago Moutinho
Hello,

How can I change this http://www.test.com/blog to this blog.test.com ??
I know that ia have to change in routes.py but i do not know how.

i tried this in routes.py:

(r'.*blog.test.com*', r'http://www.test.com/blog'),

but it still does not work.

Many thaks in advance.


[web2py] New Exception in Trunk.

2011-05-18 Thread David J.

I just upgraded my trunk;

I get this exception

S('define_table argument is not a Field or Table: no table.first_name',)

Any ideas?


[web2py] Re: New Exception in Trunk.

2011-05-18 Thread David J.

More Info...

S'Traceback (most recent call last):\n  File 
/apps/www/web2py.trunk/gluon/restricted.py, line 184, in 
restricted\nexec ccode in environment\n  File 
/apps/www/web2py.trunk/applications/app/models/db.py, line 92, in 
module\nauth.define_tables()   # creates 
all needed tables\n  File /apps/www/web2py.trunk/gluon/tools.py, line 
1179, in define_tables\nformat=\'%(first_name)s %(last_name)s 
(%(id)s)\')\n  File /apps/www/web2py.trunk/gluon/dal.py, line 4089, in 
define_table\nlimits = 
(int(vars.get(\'min\',0)),int(vars.get(\'max\',1000)))\n  File 
/apps/www/web2py.trunk/gluon/dal.py, line 4392, in __init__\n
\'define_table argument is not a Field or Table: %s\' % 
field\nSyntaxError: define_table argument is not a Field or Table: no 
table.first_name\n'

p6516


On 5/18/11 10:48 AM, David J. wrote:

I just upgraded my trunk;

I get this exception

S('define_table argument is not a Field or Table: no 
table.first_name',)


Any ideas?




[web2py] Re: Class-based controllers and prefixes in wizard

2011-05-18 Thread Dmitriy
Thanks Bruno, this is an interesting optimisation!

On May 15, 9:16 pm, Bruno Rocha rochacbr...@gmail.com wrote:
 in your controllers you will just need to instantiate your classes and work 
 with inheritance,

But I need to have some basic controller class. It must expose methods
as callable URLs. Do you have any idea how to implement such class?


[web2py] Re: App blog as subdomain of another app

2011-05-18 Thread pbreit
For one, that regex doesn't look right since there is no . in the front of 
blog.test.com

Also, you should be able to do it with domains like this:

 domains = {   blog.domain.com : blog},

More info:
http://code.google.com/p/web2py/source/browse/router.example.py



[web2py] Re: App blog as subdomain of another app

2011-05-18 Thread pbreit
Don't for get to restart web2py between edits to your routes file.

[web2py] Re: Post Data Obfuscation

2011-05-18 Thread pbreit
Seems unnecessary. Is there a specific reason you need this level of 
protection?

[web2py] Re: little bug ldap_auth

2011-05-18 Thread Massimo Di Pierro
the fix is in trunk

On May 18, 5:29 am, José Luis Redrejo jredr...@gmail.com wrote:
 If works for me too.
 (tested against servers running OpenLdap over Debian Squeeze and Debian Lenny)
 Regards.

 2011/5/17 Joseph.Piron joseph.pi...@gmail.com:







  Yes it works (MS2003 AD server).

  On May 17, 3:54 pm, Massimo Di Pierro massimo.dipie...@gmail.com
  wrote:
  It is possible that some system are more picky than others
  does it work if you replace (in line 10)

  '(objectClass=*)'

  with

  'objectClass=*'

  If it does, it should be changed.

  On May 17, 6:51 am, José Luis Redrejo jredr...@gmail.com wrote:

   2011/5/17 Joseph.Piron joseph.pi...@gmail.com:

Hi all,

I think there's a little bug in ldap_auth.py, indeed for the parameter
filterstr of ldap_auth(..) (line 10), the default value is set to
(objectClass=*) and during the call of search_ext_s (line 97), the
filter argument is constructed with
((sAMAccountName=%s)(%s)) % (username_bare, filterstr)

which will introduce double parenthesis around objectClass=*  .
I suggest to remove them from the default parameter value.

   Sorry, but I don't see the bug, and it's working perfectly in my 
   systems

Regards all!


[web2py] Re: Help about the restful api

2011-05-18 Thread Massimo Di Pierro
Is the problem how to build the client or the server?

On May 18, 7:02 am, Tiago Moutinho tiago...@gmail.com wrote:
 I just make POST method work with an script, but i still have some
 doubts about PUSH, and DELETE.

 def testing():

     import urllib
     import urllib2
     params = {
         'name': request.args(0),
         'birth': request.args(1)
     }
     http_response = urllib2.urlopen('http://localhost/post/post_test',
 urllib.urlencode(params))
     return http_response

 Does anyone have some ideas in makinh PUSH AND DELETE work???

 On May 18, 10:31 am, Tiago Moutinho tiago...@gmail.com wrote:







  Hi,

  I have some difficulties on using @resquest.restful().
  I want to do some experiments using GET, POST, PUSH and DELETE, but i can
  not make it work.
  Only GET works for me.

  How can i do for example a def POST(name): ??

  I did this:

  def POST(name):
      return db.blog.validate_and_insert(name = name)

  cumps,
  Tiago


[web2py] Export result set to PDF file

2011-05-18 Thread Neveen Adel
Hello,

 How can i export  a result set to PDF file?

e.g.:

def export_PDF()
  results = db().select()
  return pdf_file



Thanks in Advance




[web2py] Re: HELP IN DELETE AND PUSH METHODS USING RESTFUL API

2011-05-18 Thread Massimo Di Pierro
Please show us what you have so far

On May 18, 7:33 am, Tiago Moutinho tiago...@gmail.com wrote:
 Hi,

 I need some help about the delete and push methods using restful api.
 I made POST method work using urllib2, but i can not find anything on the
 web about DELETE AND PUSH

 Please help

 Thks in advance


[web2py] Re: with_alias with where clause

2011-05-18 Thread Massimo Di Pierro
alias work only with left outer joins only.


On May 18, 9:40 am, Rohan yourbuddyro...@gmail.com wrote:
 web2py: Version 1.92.1 (2011-02-16 15:04:40)

 with_alias fails to work when where clause is specified. It works fine when
 documented example is run

  db()._select(db.person.name, Father.name, Mother.name,

 left=(Father.on(Father.id==db.person.father_id),
 Mother.on(Mother.id==db.person.mother_id)))

 'SELECT  person.name, father.name, mother.name FROM person LEFT JOIN person
 AS father ON (father.id = person.father_id) LEFT JOIN person AS mother ON
 (mother.id = person.mother_id);'

 but it fails where I specify a where clause

  db((db.person.father_id == Father.id))._select(db.person.name,

 Father.name)

 SELECT  person.name, father.name FROM person, father WHERE (person.father_id
 = father.id);

 in second case, alias is not created. Read in a thread that with_alias
 currently supports left outer join only. Any plan to extend its usage?


[web2py] Re: New Exception in Trunk.

2011-05-18 Thread Massimo Di Pierro
what's in your db.py?

On May 18, 9:50 am, David J. da...@styleflare.com wrote:
 More Info...

 S'Traceback (most recent call last):\n  File
 /apps/www/web2py.trunk/gluon/restricted.py, line 184, in
 restricted\n    exec ccode in environment\n  File
 /apps/www/web2py.trunk/applications/app/models/db.py, line 92, in
 module\n    auth.define_tables()                           # creates
 all needed tables\n  File /apps/www/web2py.trunk/gluon/tools.py, line
 1179, in define_tables\n    format=\'%(first_name)s %(last_name)s
 (%(id)s)\')\n  File /apps/www/web2py.trunk/gluon/dal.py, line 4089, in
 define_table\n    limits =
 (int(vars.get(\'min\',0)),int(vars.get(\'max\',1000)))\n  File
 /apps/www/web2py.trunk/gluon/dal.py, line 4392, in __init__\n    
 \'define_table argument is not a Field or Table: %s\' %
 field\nSyntaxError: define_table argument is not a Field or Table: no
 table.first_name\n'
 p6516

 On 5/18/11 10:48 AM, David J. wrote:







  I just upgraded my trunk;

  I get this exception

  S('define_table argument is not a Field or Table: no
  table.first_name',)

  Any ideas?


[web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread Massimo Di Pierro
import mysqldb
from dal import MySQLAdapter
MySQLAdapter.driver = mysqldb

On May 18, 7:51 am, SergeyPo ser...@zarealye.com wrote:
 Vasile,

 I am using Python 2.5 on Windows XP,
 MySQL mysql  Ver 14.14 Distrib 5.1.32, for Win32 (ia32)
 InnoDB engine, UTF-8 encoding

 I have large database with lots of data, hard to reproduce here.
 Application works fine on web2py version 1.86.2 and works with many
 small errors in web2py 1.95, about 3 times slower.
 For benchmarking I use my own app which includes heavy offline process
 that I call with
 python web2py.py -S advantage -M -R applications/advantage/modules/
 preparer.py

 It takes 12 hours under 1.95 (pymysql) and 4 hours under 1.86
 I am also watching on memory in task manager...

 I am experienced developer but I don't have time to dig in third party
 modules like pymysql, esp. that I know that before the whole thing
 worked much better.

 Thank you!
 Sergey

 On 16 май, 17:19, Vasile Ermicioi elff...@gmail.com wrote:







  and python version please (needed for benchmarking)

  pymysql also have the advantage to run on top of jython and pypy with no
  efforts
  and I guess that on top of pypy it will have much better performance


[web2py] Re: recommendations for production system?

2011-05-18 Thread pbreit
Sounds like you are going in the right direction.

That Nginx setup scripts looks OK at a glance.

If you are already using version control, I would suggest avoiding editing 
files directly on your server. Instead, edit locally, push to Bitbucket and 
then pull from your server. It sounds tedious but it's pretty fast and 
ultimately a better procedure.

This is where you might consider Fabric. You could very easily set it up to 
log in to your server and issue the hg pull; hg update commands. From your 
command like you just type fab production update where production is a 
description of your production environment and update is python function 
in your fabfile.


[web2py] Re: recommendations for production system?

2011-05-18 Thread villas
Hi Carlos

 I will follow your advice about picking a strong password and
 changing the default 22 port - would this be enough?.

Well, is there ever enough security?  All I can say is that it has
been good enough for my modest security requirements. Oh,  I think I
also limited the ssh access to two IP ranges. It still does not feel
good to log on as root, but that is my trade-off for convenience.  You
will have to make your own judgements.

Emergency access to files:  I have an FTP server available on the
server (again on a non-standard port) which I start up whenever I need
to fiddle around.  I very seldom use it,  but on occasions it is
helpful.


On May 18, 3:41 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 Thank you all for your comments and recommendations.

 Based on your feedback, I'm leaning towards using Nginx (instead of Apache)
 for all static and dynamic content.

 One question: is the following script up-to-date with everything I need to
 setup web2py with nginx?:

 http://web2py.googlecode.com/hg/scripts/setup-web2py-nginx-uwsgi-ubun...

 I am planning on using 'root' as well, but I will follow your advice about
 picking a strong password and changing the default 22 port - would this be
 enough?.

 I would also want to be able to edit my application files (models,
 controllers, views) remotely from my Windows environment (via sftp?), just
 in case of emergencies, and hopefully use the same ide (wing) as my
 development environment - is this possible via any of the following
 options?:

    http://www.expandrive.com
    http://www.swish-sftp.org
    http://cyberduck.ch
    http://winscp.net
    http://us3.samba.org
    http://dokan-dev.net/en
    http://www.webdrive.com/products/webdrive

 ... or do you recommend another file manager client from Windows to the
 remote ubuntu server (with capabilities for editing in wing ide)?.

 Furthermore, what scripts (fabric?) should I actually have in place in order
 to be fully ready?.

 Btw I will be using mercurial:
    - for development, pushing to bitbucket for my own remote repository, in
 addition to a 2nd. respository for web2py,
    - for production, with two respositories, one pulling 
 fromhttps://web2py.googlecode.com/hg/web2pyand another one pulling from my
 bitbucket remote repository.

 Very important: please confirm that Nginx is a better (and stable)
 alternative to Apache.

 Thanks very much !

    Carlos


[web2py] Re: HELP IN DELETE AND PUSH METHODS USING RESTFUL API

2011-05-18 Thread Tiago Moutinho
I created this controller named api, as seen in you video.

@request.restful()
def place():
def GET(id):
place = db.place(id)
return place.as_dict() if place else None
def POST(name, description):
return db.place.validate_and_insert(name = name, description = 
description)
def PUSH(place,name):
db.place[place].update_record(name = name)
return dict()
#delete place by name
def DELETE(name):
del db.place(name)
return dict()
return locals()


when i call in url localhost/appname/api/place/1, it only makes the GET 
method for the id=1 of the place, and then for the POST method i did this 
script on the default controler:

def post():
import urllib
import urllib2

api_params = {
'name': request.args(0),
'description' : request.args(1),
}

http_response = urllib2.urlopen('http://localhost/api/place', 
urllib.urlencode(api_params))
return http_response

I put this: http://localhost/appname/post/name_example/description_example 
and it add another place with that name and that description.

And this script work perfectly. But i can not find any support for the 
DELETE and PUSH methods. I think i will have to do another script, but i can 
not find support about that on the web. 


[web2py] Re: recommendations for production system?

2011-05-18 Thread Ross Peoples
This is the original source:

https://help.ubuntu.com/community/WebMin

and here's a bug report about it:

https://answers.edge.launchpad.net/ubuntu/+question/2873

These two are a bit old now, so I don't know if things have changed, but 
merely mentioning the word webmin in the Ubuntu forums a couple years ago 
meant you got a quick, terse reply about how webmin is bad for ubuntu 
systems and you shouldn't use it. Just scanning the latest entries on the 
forums tagged with webmin, it doesn't seem like it still has the bad 
reputation it once did.

My own personal experience it with it a couple years was terrible. It 
destroyed several systems that needed to be rebuilt because webmin messed 
them up so bad. But again, I don't know if this has changed or not.


[web2py] Changing columns for TEXTAREA

2011-05-18 Thread Jay Shaffstall
I thought this might have gotten lost in the philosophical discussions
about line breaks, so figured I'd post it as a separate thread:

Using the advice given in a previous post, I'm doing this to try to
change the rows and columns for a TEXTAREA:

form=SQLFORM(db.contest,record=contest,submit_button=T(Save
Changes),fields=[name,description],_style='width:100%')

form.element('textarea')['_rows']=30
form.element('textarea')['_cols']=80

This works, in that the HTML output does have cols=80 and rows=30.
 And the number of rows does change appropriately.

However, the number of columns displayed for the textarea does not
change, despite the HTML having the right value.

Is there something else that could be overriding the number of
columns?  Something in Javascript perhaps?

Jay


[web2py] Re: Help about the restful api

2011-05-18 Thread Tiago Moutinho
Hi,

i answer it the other post.
But my problem is in the client.



[web2py] Re: Export result set to PDF file

2011-05-18 Thread Anthony
I haven't tried it, bu there's a 'generic.pdf' view template. Looks like it 
takes the HTML inside the 'content' div of a rendered HTML template and 
converts it to markmin and then to PDF. So, maybe try:
 
def export_PDF():
results=db().select()
return dict(results=results)
 
 
Then define an 'export_PDF.html' view to render the results in HTML, and 
when you go to /app/controller/export_PDF.pdf, the generic PDF view should 
convert the HTML view into a PDF. I think your HTML view will either have to 
extend the default 'layout.html', or make sure the results go inside a div 
with id=content for generic.pdf to work -- otherwise, you could create your 
own custom export_PDF.pdf view based on generic.pdf.
 
You could also try http://code.google.com/p/pyfpdf/wiki/Web2Py (pyfpdf is a 
contributed module that comes with web2py) or 
https://github.com/lucasdavila/plugin-appreport/wiki.
 
Anthony
 

On Wednesday, May 18, 2011 11:40:34 AM UTC-4, Neveen Adel wrote:

 Hello, 

  How can i export  a result set to PDF file? 

 e.g.: 

 def export_PDF() 
   results = db().select() 
   return pdf_file 



 Thanks in Advance 




[web2py] Re: recommendations for production system?

2011-05-18 Thread glimmung
Hi Ross,

Thanks for the links. I have seen mixed reports, certainly in the more
distant past, but as I said my experience since Hardy (8.04) has been
very good.

On May 18, 5:03 pm, Ross Peoples ross.peop...@gmail.com wrote:
 My own personal experience it with it a couple years was terrible. It
 destroyed several systems that needed to be rebuilt because webmin messed
 them up so bad. But again, I don't know if this has changed or not.

Well, from my PoV it has!

A couple of cautions though: -

- Webmin/Virtualmin need a clean, freshly installed system as a
starting point. If there is any configuration work done before
installing them, I'd expect problems.

- When I started out with my production hosting I had very limited
linux-fu, and needed to use  Webmin/Virtualmin to work safely (e.g. I
was a bigger risk than they were!), and so I set things up to do
everything apart from my narrow specialty (then the care and feeding
of Zope and Plone) using the web interface, and have been very
conservative about changing that.

I would recommend them without hesitation to anyone in the same
predicament as I was a couple of years back (an application developer
with limited Linux sysadmin skills), but since you are effectively
delegating your sysadmin load to that s/w in that case, it's important
to be careful and test your understanding of what you can do by hand.
In my case, there is an additional apache .conf file where all my
Zope, Plone and web2py config lives, and that is pretty much the only
thing I manage by hand, other than my Zope/Plone instances which I
install to /opt and Webmin leaves well alone.

My suggestion to the OP would be to fire up a VM and test the
alternatives - but I'd include Webmin as one of those alternatives.

HTH!

--

Cheers,

PhilK


[web2py] Re: Post Data Obfuscation

2011-05-18 Thread luckysmack
Im proccessing credit card transactions where clients will be
government entities (in the US). So I want to make it as secure as
possible. Also, they talked about doing this over https as well as
there are programs out there to get past the ssl.

On May 18, 8:30 am, pbreit pbreitenb...@gmail.com wrote:
 Seems unnecessary. Is there a specific reason you need this level of
 protection?


[web2py] Re: Changing columns for TEXTAREA

2011-05-18 Thread Ross Peoples
Have you checked the base.css file for textarea references?

[web2py] Re: Post Data Obfuscation

2011-05-18 Thread pbreit
Https would be required but also sufficient. I've done lots of government 
credit card processing and never heard of the need for further obfuscation.


[web2py] Re: Using the web2py template system to create new file.

2011-05-18 Thread Christopher Steel
OK, I will answer my own question first...

In your controller:

import os

def index():
context=dict(first_name='Bob is',last_name='your uncle')
template = test_template_path =
os.path.join(current_app,'static','template_test')
test_content = response.render(template,context)
destination =
os.path.join(current_app,'static','template_test_target')
with open(destination, 'w') as f:
f.write(test_content)
exit_message = f.closed
return dict(message=exit_message)

Template contents:
(called template_test in the above example)

{{=first_name}}
{{=last_name}}


Controller output
(Indicates the exit status of your write)

True # hopefully

Output file content:
(the called template_test_target in this example)

Bob is
Your Uncle




On May 6, 8:04 am, Christopher Steel chris.st...@gmail.com wrote:
 How would I go about creating a new file using the Web2py template
 system? Would something like this be a practical way to use it?

 Example:

 template_source_path = ./static/my_readme_template
 template_target_path = ./static/README

 Template Example:

 contents of static/my_readme_template

 # {{=plugin_name}}
 static/{{plugin_name}}/README
 This file was created from a template /static/my_readme_template

 # Requirements
 {{=plugin_name}] no longer requires mako!

 # General Notes
 In the plugin_plugin's static directory you will find the templates
 used to create new plugins. At this writing templates have been
 created to make skeletal plugin menu, controller and about text.
 Others will probably be added over time.

 What would the controller function contain to get a user variable and
 then do the file creation? I want to eliminate the usage of mako for
 templating in this applicaiton if it is practical and makes sense, it
 would be nice to have no dependencies if possible.

 http://code.google.com/p/uc-plugin-dev/

 Thank You,


[web2py] Embedding web2py

2011-05-18 Thread j2kvideo
Hi All,

I was wondering if it would be possible to embed web2py within a C++
application.  I have embedded python before in C/C++ applications to
run a script etc so I am assuming that there maybe a way to embed
web2py in another C++ process.

Thanks in advance, Andy


Re: [web2py] Re: New Exception in Trunk.

2011-05-18 Thread David J.

Seems to complain about auth.define_tables()

I have other table but I commented out.



On 5/18/11 11:45 AM, Massimo Di Pierro wrote:

what's in your db.py?

On May 18, 9:50 am, David J.da...@styleflare.com  wrote:

More Info...

S'Traceback (most recent call last):\n  File
/apps/www/web2py.trunk/gluon/restricted.py, line 184, in
restricted\nexec ccode in environment\n  File
/apps/www/web2py.trunk/applications/app/models/db.py, line 92, in
module\nauth.define_tables()   # creates
all needed tables\n  File /apps/www/web2py.trunk/gluon/tools.py, line
1179, in define_tables\nformat=\'%(first_name)s %(last_name)s
(%(id)s)\')\n  File /apps/www/web2py.trunk/gluon/dal.py, line 4089, in
define_table\nlimits =
(int(vars.get(\'min\',0)),int(vars.get(\'max\',1000)))\n  File
/apps/www/web2py.trunk/gluon/dal.py, line 4392, in __init__\n
\'define_table argument is not a Field or Table: %s\' %

field\nSyntaxError: define_table argument is not a Field or Table:no
table.first_name\n'
p6516

On 5/18/11 10:48 AM, David J. wrote:








I just upgraded my trunk;
I get this exception
S('define_table argument is not a Field or Table:no
table.first_name',)
Any ideas?




Re: [web2py] Embedding web2py

2011-05-18 Thread Jason Brower
That would have to depend at what level you need to do that 
integration.  For example, starting web2py from your application is very 
easy, you can just run the script to start the server.
When I have to integrate with something, I like to actually just create 
a communication layer between them.

Best Regards,
Jason

On 05/18/2011 08:24 PM, j2kvideo wrote:

Hi All,

I was wondering if it would be possible to embed web2py within a C++
application.  I have embedded python before in C/C++ applications to
run a script etc so I am assuming that there maybe a way to embed
web2py in another C++ process.

Thanks in advance, Andy




Re: [web2py] Re: Error in SQLTABLE in pymysql

2011-05-18 Thread Vasile Ermicioi
I also use dal (outside web2py) with pymysql and have no problems,
100 000+ of products are updated daily with new data from ebay

so I am interested to know if pymysql is buggy or not, and when this bug can
appear


[web2py] GAE for Dummies

2011-05-18 Thread bee
Hello All,
I have been trying to run the GAE appserver as descried in the book
and in this slice: http://web2pyslices.com/main/slices/take_slice/126#end

For some reason I cant get it to run.I am using Ubuntu 11.04 and have
installed Python2.5.
Here is the error I get:

:/webdev/google_appengine$ python2.5 dev_appserver.py web2py
WARNING  2011-05-18 18:58:45,989 urlfetch_stub.py:108] No ssl package
found. urlfetch will not be able to validate SSL certificates.
ERROR2011-05-18 18:58:46,158 dev_appserver_main.py:579] Fatal
error when loading application configuration:
Unable to assign value 'rtPlanB' to attribute 'application':
Value 'rtPlanB' for application does not match expression '^(?:[a-z\d
\-]{1,100}\~)?(?:(?!\-)[a-z\d\-\.]{1,100}:)?(?!-)[a-z\d\-]{1,100}$'
  in web2py/app.yaml, line 6, column 14


Any help would be very much appreciated (I Do have my application
working and running on the live GAE but I wanted to test a run a newer
version locally)


Re: [web2py] Re: New Exception in Trunk.

2011-05-18 Thread Ross Peoples
Did you subclass the Auth class or something? And more importantly, did you 
restart your web2py server after updating from trunk?

Re: [web2py] Re: New Exception in Trunk.

2011-05-18 Thread David J.

Ross;Massimo; sometimes the most obvious solution is the best;

I just updated again and restarted; seems to be ok;

Not sure what the trouble was; seems like something was modified since 
last time I updated from trunk.


AOK;

Thanks for your help.

David


On 5/18/11 3:26 PM, Ross Peoples wrote:
Did you subclass the Auth class or something? And more importantly, 
did you restart your web2py server after updating from trunk? 




[web2py] Re: Post Data Obfuscation

2011-05-18 Thread Ross Peoples
I would also have to say that SSL is an industry standard, even by 
government and payment card processing standards. I have to keep a Ubuntu 
web server up to the latest PCI (payment card industry) tests since we 
process credit cards internally. The test runs quarterly and emails me a 
report of any vulnerabilities found. It has never found a problem with SSL 
(unless you are using an old version).

If there really is a program out there that can get past a properly 
configured HTTPS server, then the Internet as we know it would not exist. 
There would be no online banking, no government sites, no Amazon, no eBay, 
etc. Remember that Sony's PSN network was taken down because it wasn't using 
any security at all, and running an unpatched version of Apache.

On another note, the only way obfuscate the data, would be to have an 
encryption implementation in JavaScript, and a matching version in Python to 
transmit the data over the wire. In this case, all a hacker would have to do 
is read your JavaScript code, which is just a right-click - view source 
away. So you gain nothing by trying to obfuscate the data, which is exactly 
why HTTPS and SSL exist, because the security experts know that security is 
NOT obfuscation.


[web2py] Re: Embedding web2py

2011-05-18 Thread GoldenTiger
File web2py.exe created by py2exe is a simple example of an embedded
web2py.


On 18 mayo, 19:24, j2kvideo allba...@gmail.com wrote:
 Hi All,

 I was wondering if it would be possible to embed web2py within a C++
 application.  I have embedded python before in C/C++ applications to
 run a script etc so I am assuming that there maybe a way to embed
 web2py in another C++ process.

 Thanks in advance, Andy


[web2py] MSSQL to CSV

2011-05-18 Thread mart
Hi,

there's this MSSQL server running remotely, and I would like to access
it with DAL. So I'm thinking, i should export to CSV then import using
dal.py in something local (like SQLite). Here's the problem... I don't
know how to dump the MSSQL tables to CSV :(

This is a 2005 MS SQL install. Would anyone have a trick? is there
some sort of tool/option/something i can use to say 'dump all tables
to csv' ?


I assume, them i can simply point top those CSV file and import?

Thanks for the help,
Mart :)


[web2py] Web2py Feature or terminology?

2011-05-18 Thread greenpoise
Hi there. Is there an official features page? I am looking for a
feature that was added to web2py a few months ago (did not bookmark
it!!!) but anyways, it was a feature that was common in ruby and was
added to web2py. The example presented was of listing prices from
other websites (I think it was walmart)..anyways, I really dont
remember the terminology used for it..

Thanks


[web2py] Re: MSSQL to CSV

2011-05-18 Thread Massimo Di Pierro
If you know the mssql table structure, you can create a quick web2py
model:

db=DAL('mssql://...')
db.define_table('yourtable',Field(...),)
print str(db(db.yourtable).select()) # outputs the CSV

On May 18, 3:32 pm, mart msenecal...@gmail.com wrote:
 Hi,

 there's this MSSQL server running remotely, and I would like to access
 it with DAL. So I'm thinking, i should export to CSV then import using
 dal.py in something local (like SQLite). Here's the problem... I don't
 know how to dump the MSSQL tables to CSV :(

 This is a 2005 MS SQL install. Would anyone have a trick? is there
 some sort of tool/option/something i can use to say 'dump all tables
 to csv' ?

 I assume, them i can simply point top those CSV file and import?

 Thanks for the help,
 Mart :)


[web2py] Re: Web2py Feature or terminology?

2011-05-18 Thread Massimo Di Pierro
Perhaps this helps:
http://code.google.com/p/web2py/source/list

we do not have a features page other than the main index page.

On May 18, 3:36 pm, greenpoise danel.sega...@gmail.com wrote:
 Hi there. Is there an official features page? I am looking for a
 feature that was added to web2py a few months ago (did not bookmark
 it!!!) but anyways, it was a feature that was common in ruby and was
 added to web2py. The example presented was of listing prices from
 other websites (I think it was walmart)..anyways, I really dont
 remember the terminology used for it..

 Thanks


[web2py] Re: MSSQL to CSV

2011-05-18 Thread mart
ok, that's sounds like a good idea (btw - dal is worth gold!)

Thanks for the help Massimo! :)

On May 18, 4:43 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 If you know the mssql table structure, you can create a quick web2py
 model:

 db=DAL('mssql://...')
 db.define_table('yourtable',Field(...),)
 print str(db(db.yourtable).select()) # outputs the CSV

 On May 18, 3:32 pm, mart msenecal...@gmail.com wrote:







  Hi,

  there's this MSSQL server running remotely, and I would like to access
  it with DAL. So I'm thinking, i should export to CSV then import using
  dal.py in something local (like SQLite). Here's the problem... I don't
  know how to dump the MSSQL tables to CSV :(

  This is a 2005 MS SQL install. Would anyone have a trick? is there
  some sort of tool/option/something i can use to say 'dump all tables
  to csv' ?

  I assume, them i can simply point top those CSV file and import?

  Thanks for the help,
  Mart :)


[web2py] Re: MSSQL to CSV

2011-05-18 Thread Massimo Di Pierro
ERRATA:

 db=DAL('mssql://...')
 db.define_table('yourtable',Field(...),,migrate=True,fake_migrate=True)
 print str(db(db.yourtable).select()) # outputs the CSV


[web2py] Re: Post Data Obfuscation

2011-05-18 Thread Richard G
I agree with majority of sentiments above. I would like to point out that I 
disagree with the statement:
On another note, the only way obfuscate the data, would be to have an 
encryption implementation in JavaScript, and a matching version in Python to 
transmit the data over the wire. In this case, all a hacker would have to do 
is read your JavaScript code, which is just a right-click - view source 
away. So you gain nothing by trying to obfuscate the data, which is exactly 
why HTTPS and SSL exist, because the security experts know that security is 
NOT obfuscation.

If I was actually implementing encryption (not obfuscation, the two terms 
are used interchangeably above) I would use an asymmetric key algorithm, 
thus assuming we had man in the middle, even being able to view our 
javascript, public key  encrypted text would provide no method of 
identifying original data. 

All this being said, I don't believe I would use javascript as an integral 
part of my website security architecture. :) 

PS: If you really do care, a quick web search identifies multiple des/aes 
javascript implementations. (Obviously, use at your own risk)


[web2py] Re: Changing columns for TEXTAREA

2011-05-18 Thread JayShaffstall
On May 18, 12:43 pm, Ross Peoples ross.peop...@gmail.com wrote:
 Have you checked the base.css file for textarea references?

Yes, there is a reference to the width of a textarea in base.css.
However, removing that reference or changing the width there doesn't
change how wide the textarea appears.

But I'd just recalled that I'm using the layout plugin, and a theme
from there had a style.css that also had a width specified for
textareas.  Removing that one fixes the problem.

Why does the width when specified in one .css file force the textarea
to that width, and the width specified in another (base.css) not?
Anyway, that question is mostly rhetorical...I can adjust the columns
of my textareas now, so I'm happy.

Thanks for the pointer to the .css files.  I'd been thinking
Javascript as what would have to be overriding the width, and CSS as
providing defaults only.


[web2py] Re: Web2py Feature or terminology?

2011-05-18 Thread Anthony
There's also the change log: 
http://www.web2py.com/examples/default/changelog
 

On Wednesday, May 18, 2011 4:44:57 PM UTC-4, Massimo Di Pierro wrote:

 Perhaps this helps: 
 http://code.google.com/p/web2py/source/list 

 we do not have a features page other than the main index page. 

 On May 18, 3:36 pm, greenpoise danel@gmail.com wrote: 
  Hi there. Is there an official features page? I am looking for a 
  feature that was added to web2py a few months ago (did not bookmark 
  it!!!) but anyways, it was a feature that was common in ruby and was 
  added to web2py. The example presented was of listing prices from 
  other websites (I think it was walmart)..anyways, I really dont 
  remember the terminology used for it.. 
  
  Thanks



[web2py] vps hosting: vps.net or linode?

2011-05-18 Thread Carlos
Hi,

What do you recommend for vps hosting?.

I was pretty sure going with vps.net, but there have been several bad 
experiences out there that make me nervous.

For reference: http://thepcspy.com/read/why-i-cant-recommend-vpsnet/

I am now undecided: which is better vps?, vps.net or linode?.

   http://vps.net/

   http://www.linode.com/

My main market will be Mexico, if it helps to make a decision.

Thanks for all your input.

   Carlos



[web2py] Re: MSSQL to CSV

2011-05-18 Thread mart
ok, got it! thanks again :)

On May 18, 5:02 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 ERRATA:







  db=DAL('mssql://...')
  db.define_table('yourtable',Field(...),,migrate=True,fake_migrate=True)
  print str(db(db.yourtable).select()) # outputs the CSV


[web2py] Re: vps hosting: vps.net or linode?

2011-05-18 Thread pbreit
Invariably, everyone seems to have a problem with their hosting provider at 
some point. Heck, even Amazon went down for over a day recently! I don't 
have experience hosting on Linode but I can say that their knowledge base is 
by far the best which I think speaks very well for them. And from what I've 
heard, Linode is a solid provider.

I am currently on RackSpace cloud which is a hair more expensive but has 
been great so far. Their servers are in Dallas mostly if that matters.


[web2py] Re: GAE for Dummies

2011-05-18 Thread howesc
i have never seen this error myself, but it seems like perhaps a type in 
your app.yaml file?


[web2py] apresentacao

2011-05-18 Thread Thiago Abreu
Fala ai galera,
sou novo na lista e web2py e pretendo estudar pelo grubo



-- 
Um Abraço,
Thiago Abreu


[web2py] Re: GAE caching

2011-05-18 Thread howesc
actually i would recommend that this be removed from web2py.  Ikai Lan (app 
engine system developer at google) says they can detect those dummy requests 
and punish apps that do that (was chatting with him at a conference last 
fall).  i would instead pay the modest $9 a month for always on.

or the other solution is to just get enough users that you have constant 
traffic. ;)

cfh


[web2py] Re: MSSQL to CSV

2011-05-18 Thread DenesL


On May 18, 5:02 pm, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 db.define_table('yourtable',Field(...),,migrate=True,fake_migrate=True)

why not just ...,migrate=False) ?
what does that combo provide?




[web2py] Re: Logging of user actions

2011-05-18 Thread Joseph.Piron
Has noone ever had this king of need ??

On May 17, 11:59 pm, Joseph.Piron joseph.pi...@gmail.com wrote:
 Hi all,

 I was wondering what would be the best way to log actions with the
 username of the logger user.
 I found several leads but none very conclusive.

 For example, define a filter in my model:

 import logging
 class ContextFilter(logging.Filter):
     def filter(self, record):
         record.user = auth.user.username if hasattr(auth.user,
 'username') else None
         return True

 logger = logging.getLogger(web2py.app. +
 request.application.lower())
 if len(logger.filters) == 0:
     logger.addFilter(ContextFilter())

 but two issues: auth.user = None in runtime when the context is the
 filter method (tried with eclipse debugger)
 and moreover, would it work, I would have to define new handlers to
 get a new formatter using this new attribute.. not very handy.

 What could be the best option here ?

 Thanks in advance for your advices!


Re: [web2py] Re: vps hosting: vps.net or linode?

2011-05-18 Thread Vasile Ermicioi
I suggest you to try webfaction


[web2py] Static file caching problem?

2011-05-18 Thread ron_m
Host is Ubuntu 10.04, web2py is 1.95.1
I use Firefox 3.6.17 from the Ubuntu distribution
Added the Firebug plugin.

Running on the rocket built in server port 8000 if I enable the Net tab of 
Firebug

Clicking around on the application buttons all the static CSS and Javascript 
resources such as jQuery and jQueryUI and anything else the response loads 
is always 200 OK and the CSS and Javascript is downloaded. Even pushing the 
same top level menu item twice in a row yields the same load every time.

If I hit the refresh button in the browser toolbar then the response for the 
CSS and Javascript files is 304 Not Modified.

Images are not affected and only show up as 304 Not Modified responses.

I then went to the Apache WSGI installation running on port 80 and get the 
same result.

This could be a serious drag on performance depending on the network 
connection. I probably didn't notice because the browser and server are on 
the same machine for development work.

The files that avoid caching are the ones added to the response.files 
collection in the view from what I have seen so far.

Anyone else seeing this?

Thanks,
Ron


[web2py] Re: Logging of user actions

2011-05-18 Thread pbreit
Not sure exactly what you need but, yes, I think it's kind of rare.

Maybe this will work for you: by default, Web2py creates an auth_event table 
and automatically records a bunch of actions like register, login, etc.

You can add your own actions with this one-liner:
auth.log_event(description='this happened', origin='auth')

Both description and origin can be anything I believe.



Re: [web2py] apresentacao

2011-05-18 Thread Bruno Rocha
Seja bem-vindo ao grupo, qualquer dúvida é só falar

Abraço
--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



2011/5/18 Thiago Abreu thiago.ab...@gmail.com

 Fala ai galera,
 sou novo na lista e web2py e pretendo estudar pelo grubo



 --
 Um Abraço,
 Thiago Abreu



[web2py] How to pass image into new SQLFORM

2011-05-18 Thread pbreit
I am trying to program the ability to create a new record that defaults to a 
copy of an existing record. The records include an image that I would also 
like to use but can't seem to figure out how to pass it in to the SQLFORM.

For editing records, I do this which works fine:
form = SQLFORM(db.item, item, upload=(URL('static', 'uploads')))

For the other input fields, i'm just doing something simple like this:
form.vars.title = ref_item.title

I'd like to do something like:
form.vars.image = ref_item.image

Or something like this (without item since it's a new record):
form = SQLFORM(db.item, upload=(URL('static', 'uploads')))

Also, I have a compute field to generate a thumbnail.

Has anyone done anything like this?


[web2py] Re: How to pass image into new SQLFORM

2011-05-18 Thread pbreit
I ended up bypassing the built-in functionality and instead:

1) when copying pass an image to view
2) in view, if an image field is passed, display it (the form is customized)
3) in form.accepts, if copying another record, do a 
record.update_record(image = ref.image)

I currently don't have a way to delete the image so I'll need to code that.


[web2py] Re: vps hosting: vps.net or linode?

2011-05-18 Thread villas
I have been very happy with vps.net and although have the odd minor
problem now and again, I find them very responsive.  The reason I like
them in particular is that they offer Europe and USA services and the
former is good for us.

I believe web2py.com runs on vps.net and Massimo also said he was
happy in the past,  but again that's just one small example.  I am
sure they are comparison sites around which give a more objective
picture. I know that vps.net have been doing a lot of additional
investment in customer service,  so hopefully that will show through
soon.



On May 18, 10:21 pm, Carlos carlosgali...@gmail.com wrote:
 Hi,

 What do you recommend for vps hosting?.

 I was pretty sure going with vps.net, but there have been several bad
 experiences out there that make me nervous.

 For reference:http://thepcspy.com/read/why-i-cant-recommend-vpsnet/

 I am now undecided: which is better vps?, vps.net or linode?.

    http://vps.net/

    http://www.linode.com/

 My main market will be Mexico, if it helps to make a decision.

 Thanks for all your input.

    Carlos


Re: [web2py] Re: Install in hostgator

2011-05-18 Thread Brian M
Yep it'll work similar on hostgator - tried it out a few months back just to 
see if I could get it working, haven't actually deployed anything useful but 
it appears to run ok.  I recall that an appropriate version of Python  flup 
were already installed on my hostgator shared box. I did my install of 
web2py into a subfolder rather than the site root which probably made things 
harder.  Here's that I can quickly grab from my setup, sorry didn't take 
detailed notes :(


.htaccess
--
AddHandler fcgid-script .fcgi 
Options +FollowSymLinks  +ExecCGI 
RewriteEngine On 
RewriteBase /web2py/ 
RewriteRule ^dispatch\.fcgi/ - [L] 
RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


dispatch.fcgi
---
#!/usr/bin/python2.7 
import sys 
from flup.server.fcgi_fork import WSGIServer 
import gluon.main 
application=gluon.main.wsgibase 
## or 
# application=gluon.main.wsgibase_with_logging 
WSGIServer(application).run() 

routes.py (sorry honestly don't remember if I changed this or not, think I 
had to add the /web2py/ because I put web2py in a subfolder of the site)

#routes_in = ((r'.*:/favicon.ico', r'/examples/static/favicon.ico'),
# (r'.*:/robots.txt', r'/examples/static/robots.txt'),
# ((r'.*http://otherdomain.com.* (?Pany.*)', 
r'/app/ctr\gany')))
routes_in = (('/web2py/(?Pa.*)','/\ga'),)

# routes_out, like routes_in translates URL paths created with the web2py 
URL()
# function in the same manner that route_in translates inbound URL paths.
#

#routes_out = ((r'.*http://otherdomain.com.* /app/ctr(?Pany.*)', 
r'\gany'),
#  (r'/app(?Pany.*)', r'\gany'))
routes_out=(('/(?Pa.*)','/web2py/\ga'),)


[web2py] Re: recommendations for production system?

2011-05-18 Thread niknok
It's nice to see feedback from real users of these hosts. Could you
please add how much traffic you got with those plans you have?

On May 18, 6:54 am, Carlos carlosgali...@gmail.com wrote:
 Hi all,

 In order to prepare my web2py production system, I would really welcome all
 your advice.

 I will get one node from vps.net:

    http://vps.net/product/cloud-servers
    dedicated cpu = 0.6 GHz
    dedicated ram = 376 MB
    disk space = 10 GB
    network transfer = 250 GB

 I am planning to install the following software:

    os = ubuntu 10.04 (lucid) x64 basic installation
    web = apache2
    db = postgresql
    sh =http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh

 Is the above the recommended configuration (based on my one node capacity @
 vps.net)?.

 I've read that nginx web server is really good, should I reconsider this?,
 instead or in addition to apache?.

 Would you recommend a different configuration if I eventually add more
 nodes/capacity?.

 Any other software?, e.g. web server control panels?.

    - isp manager
    - webmin
    - virtualmin
    - landscape

 Thanks in advance for all your recommendations.

 p.s. my experience has been mostly with Windows.

    Carlos


[web2py] Need an experienced dev for project

2011-05-18 Thread skwasha
I have a project I've been working on. I managed to get a working
prototype going in web2py myself. But I'm not quite proficient enough
to really take it to the next stage - i.e., something a lot more
streamlined, professionally coded and ready to deploy.

It's not too terribly complicated. I imagine a seasoned web2py'er
could crank it out quite quickly given the parameters. Esp. based on
my own experience getting the prototype going.

If you're interested, please drop me a line and I can provide further
detail: skwa...@gmail.com.

tia


[web2py] Re: Embedding web2py

2011-05-18 Thread JorgeRpo
what about license issues or conflict


[web2py] Blitz.io: nifty load tester with a free tier

2011-05-18 Thread pbreit
I just found this neat little load testing service that has a decent free 
tier: http://blitz.io/gclFk7822pd0W

Disclaimer: the invite link gets me additional testing capacity. But I do 
think the service would be of interest to this group.




Re: [web2py] Blitz.io: nifty load tester with a free tier

2011-05-18 Thread Bruno Rocha
Nice tool.

I saw in my tests some headers with:  X-Powered-By: ASP.NET  - X-Powered-By:
Zend - X-Powered-By: Zope
why sont we have a header like that? X-Powered-By: web2py

So it will be easy to create a www.isitweb2py.com service

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Thu, May 19, 2011 at 1:19 AM, pbreit pbreitenb...@gmail.com wrote:

 I just found this neat little load testing service that has a decent free
 tier: http://blitz.io/gclFk7822pd0W

 Disclaimer: the invite link gets me additional testing capacity. But I do
 think the service would be of interest to this group.





Re: [web2py] Blitz.io: nifty load tester with a free tier

2011-05-18 Thread Bruno Rocha
http://isitrails.com/

On Thu, May 19, 2011 at 1:34 AM, Bruno Rocha rochacbr...@gmail.com wrote:

 Nice tool.

 I saw in my tests some headers with:  X-Powered-By: ASP.NET - X-Powered-By: 
 Zend - X-Powered-By: Zope
 why sont we have a header like that? X-Powered-By: web2py

 So it will be easy to create a www.isitweb2py.com service

 --
 Bruno Rocha
 [ About me: http://zerp.ly/rochacbruno ]



 On Thu, May 19, 2011 at 1:19 AM, pbreit pbreitenb...@gmail.com wrote:

 I just found this neat little load testing service that has a decent free
 tier: http://blitz.io/gclFk7822pd0W

 Disclaimer: the invite link gets me additional testing capacity. But I do
 think the service would be of interest to this group.






Re: [web2py] Re: GAE for Dummies

2011-05-18 Thread Gary Bee
Thanks for your reply, I have double checked the app.yaml and the app 
name matches exactly that of the application in web2py

I will just check that the softlinks appear correct as per the slice(again)



On 18/05/11 23:09, howesc wrote:

i have never seen this error myself, but it seems like perhaps a type in
your app.yaml file?



--



Re: [web2py] recommendations for production system?

2011-05-18 Thread Bruno Rocha
I strongly recommend Linode http://bit.ly/linodelinode

I am runnning a VPS (2048) on Linode and it is amazing, simple, fast and a
helpful support.

You can choose a DataCenter when creating a new Node, I read that is best to
choose London - UK

--
Bruno Rocha
[ About me: http://zerp.ly/rochacbruno ]



On Tue, May 17, 2011 at 7:54 PM, Carlos carlosgali...@gmail.com wrote:

 Hi all,

 In order to prepare my web2py production system, I would really welcome all
 your advice.

 I will get one node from vps.net:

http://vps.net/product/cloud-servers
dedicated cpu = 0.6 GHz
dedicated ram = 376 MB
disk space = 10 GB
network transfer = 250 GB

 I am planning to install the following software:

os = ubuntu 10.04 (lucid) x64 basic installation
web = apache2
db = postgresql
sh = http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh

 Is the above the recommended configuration (based on my one node capacity @
 vps.net)?.

 I've read that nginx web server is really good, should I reconsider this?,
 instead or in addition to apache?.

 Would you recommend a different configuration if I eventually add more
 nodes/capacity?.

 Any other software?, e.g. web server control panels?.

- isp manager
- webmin
- virtualmin
- landscape

 Thanks in advance for all your recommendations.

 p.s. my experience has been mostly with Windows.

Carlos