Re: [web2py] Re: pymysql gives Broken Pipe

2011-02-06 Thread Fran Boon
On 6 February 2011 05:15, Massimo Di Pierro  wrote:
> Here is a proposed solution in trunk
> import mysqldb
> from gluon.dal import MySQLAdapter
> MySQLAdapter.adapter=mysqldb
> before calling db=DAL('mysql://...')

That seems very workable :)

Thanks a lot,
Fran.


[web2py] Re: pending issues?

2011-02-06 Thread dlypka
My patch 5. is the most serious.  That bug causes an exception when
creating a table which has
native GAE properties such as gae.ReferenceProperty() because that is
not a string (it is not in quotes)
For example, this will crash:

db.Field('seq','integer'), # OK because
'integer' is a string
db.Field('gaeRef', gae.ReferenceProperty()), #
crashes here because expression gae.ReferenceProperty() is not a
string. My suggested patch is to move the check for gae properties
ahead of the string check.

Patch 2. is also pretty serious. Maybe this has been addressed
somewhere, but I am seeing that html.py tries
to return XML() which causes an Exception:
#   File "C:\Program Files (x86)\Google\google_appengine\google
\appengine\api\datastore_types.py", line 1323, in ValidateProperty
#'Unsupported type for property %s: %s' % (name, v.__class__))
#   BadValueError: Unsupported type for property success_path:

I'll see what I can do about creating (Mercurial (?)) patch files.
That is new to me but I suppose a blessing to learn...


On Feb 6, 12:35 am, Massimo Di Pierro 
wrote:
> Can you please send me all the changes as a patch file to the latest
> dal.py? I am lost because of google groups breaks indentation.
>
> On Feb 5, 9:40 pm, dlypka  wrote:
>
>
>
>
>
>
>
> > 6. in dal.py class Table around line 5900:
>
> >     def _drop(self, mode = ''):
> >         return self._db._adapter._drop(self, mode)
>
> >     def drop(self, mode = ''):
> >         return self._db._adapter._drop(self, mode) # dlypka patch.
> > was: self._db._adapter.drop(self,mode)
>
> > On Feb 5, 10:36 pm, dlypka  wrote:
>
> > > 5. In dal.py:
>
> > > class NoSQLAdapter(BaseAdapter):
>
> > >     def represent(self, obj, fieldtype):
> > >         if type(obj) in (types.LambdaType, types.FunctionType):
> > >             obj = obj()
> > >         if isinstance(fieldtype, SQLCustomType):
> > >             return fieldtype.encoder(obj)
> > >         if isinstance(obj, (Expression, Field)):
> > >             raise SyntaxError, "non supported on GAE"
>
> > >         if 'gae' in globals():
> > >             if isinstance(fieldtype, gae.Property):
> > >                 return obj
>
> > >         if fieldtype.startswith('list:'):  # dlypka patch to move this
> > > to be AFTER the if 'gae' clause because fieldtype may not necessarily
> > > be a string
> > >             if not obj:
> > >                 obj = []
> > >             if not isinstance(obj, (list, tuple)):
> > >                 obj = [obj]
>
> > > On Feb 5, 11:21 am, dlypka  wrote:
>
> > > > More issues
> > > > 1. # dlypka Mod in dal.py: had to move this try .. except up here in
> > > > front of class NoSQLAdapter because gae is needed in class
> > > > NoSQLAdapter
> > > > try:
> > > >     from new import classobj
> > > >     from google.appengine.ext import db as gae
> > > >     from google.appengine.api import namespace_manager
> > > >     # from google.appengine.api.datastore_types import Key  ### why
> > > > was this needed
> > > >     from google.appengine.ext.db.polymodel import PolyModel
> > > >     drivers.append('gae')
> > > > except ImportError:
> > > >     pass
>
> > > > class NoSQLAdapter(BaseAdapter):
>
> > > > 2. html.py line 265
> > > >     return rewrite.filter_out(url, env) # dlypka patch. Was
> > > > XML(rewrite.filter_out(url, env))
> > > > # XML() causes Exception:
> > > > #   File "C:\Program Files (x86)\Google\google_appengine\google
> > > > \appengine\api\datastore_types.py", line 1323, in ValidateProperty
> > > > #    'Unsupported type for property %s: %s' % (name, v.__class__))
> > > > #       BadValueError: Unsupported type for property success_path:
> > > > 
>
> > > > 3. class GAENoSQLAdapter(NoSQLAdapter):
> > > >     uploads_in_blob = True
> > > >     types = {}
>
> > > >     def file_exists(self, filename): pass
> > > >     def file_open(self, filename, mode='rb', lock=True): pass
> > > >     def file_close(self, fileobj, unlock=True): pass
>
> > > >     def __init__(self,db,uri,pool_size=0,folder=None,db_codec
> > > > ='UTF-8',
> > > >                  credential_decoder=(lambda x:x)):  # dlypka patch:
> > > > added brackets around lambda - syntax error
> > > >         self.types.update({
>
> > > > 4.     def insert(self,table,fields):
> > > >         dfields=dict((f.name,self.represent(v,f.type)) for f,v in
> > > > fields)
> > > >         # table._db['_lastsql'] = self._insert(table,fields)
> > > >         tmp = table._tableobj(**dfields)
> > > >         tmp.put()
> > > >         table._db['_last_reference'] = tmp # dlypka patched based on
> > > > June 27/2010 mod in the trunk
> > > >         rid = Reference(tmp.key().id())
> > > >         (rid._table, rid._record) = (table, None)
> > > >         return rid


Re: [web2py] Re: Getting started

2011-02-06 Thread Richard Arts
I had a quick look at http://web2py.com/examples/static/cookbook.pdf
the other day. Seems to be a nice guide as well.

Regards,
Richard


Re: [web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-06 Thread Tom Atkins
Thanks for looking into this Massimo.  I just pulled the most recent version
and still get the same error as originally described.  I added a comment
here:

http://code.google.com/p/web2py/issues/detail?id=173&can=1&sort=-id

Let me
know if you need any more info.  I definitely have the latest version.

On 4 February 2011 19:49, Massimo Di Pierro wrote:

> This is a trunk bug. The problem does should be there in stable. I
> will fix this tonight.
>
> On Feb 4, 12:50 pm, Tom Atkins  wrote:
> > On 4 February 2011 14:33, Massimo Di Pierro  >wrote:
> >
> > > You are using web2py trunk right?
> >
> > Yes - just a clean version of web2py pulled by Hg from Google code.
> >
> > > Did you set a sequence_name
> > > manually?
> >
> > No (not even sure what sequence_name is!) -  I tried another app of my
> own
> > and get the same result.
>


Re: [web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-06 Thread Ovidio Marinho
here I also have this same problem. I also still have problems with the ID
in version 191.6.
Ouvir
Ler foneticamente
Dicionário - Ver dicionário
detalhado
Traduza qualquer site

   - Yomuiri 
Online
   -Japão
   - 
Telegraph.co.uk
   -Reino Unido
   - BBC 
News
   -Reino Unido
   - 
News.de
   -Alemanha
   - 
Guardian.co.uk
   -Reino Unido
   - 
Sueddeutsche.de
   -Alemanha
   - The White 
House
   -Estados Unidos
   - Xinhua 
Net
   -China
   - 
Elle
   -França
   - Zamalek 
Fans
   -árabe
   - Machu 
Picchu
   -espanhol
   - 
Bild.de
   -Alemanha

Fazer mais com o Google Tradutor

   -
   

   *Pesquise as melhores receitas de sushi em japonês!* Descubra o
poder da Pesquisa
   
traduzidado
Google.
   -
   

   *Estabeleça sua empresa globalmente.* Anuncie em vários idiomas
usando o Google
   Global Market
Finder
   .
   -
   

   *Traduza agora.* Traduza textos direto da sua página inicial do
iGoogle
   .
   -
   

   *Mantenha contato com seus amigos virtuais de Paris.* Ative a tradução
   automática de e-mails e bate-papos no
Gmail
   .


2011/2/4 Massimo Di Pierro 

> This is a trunk bug. The problem does should be there in stable. I
> will fix this tonight.
>
> On Feb 4, 12:50 pm, Tom Atkins  wrote:
> > On 4 February 2011 14:33, Massimo Di Pierro  >wrote:
> >
> > > You are using web2py trunk right?
> >
> > Yes - just a clean version of web2py pulled by Hg from Google code.
> >
> > > Did you set a sequence_name
> > > manually?
> >
> > No (not even sure what sequence_name is!) -  I tried another app of my
> own
> > and get the same result.
>



-- 
Ovidio Marinho Falcao Neto
 ovidio...@gmail.com
 Tecnologia da Informaçao
 Casa Civil do Governador
 83 3214 7885 - 88269088
  Paraiba


Re: [web2py] Re: Getting started

2011-02-06 Thread Anthony
On Sunday, February 6, 2011 5:55:39 AM UTC-5, Richard Arts wrote: 
>
> I had a quick look at http://web2py.com/examples/static/cookbook.pdf
> the other day. Seems to be a nice guide as well.

 
Yes, that looks like a good start too. Though, keep in mind that it is 
fairly old, and there have been many additions and improvements to web2py 
since then. For example, SQLDB and SQLField have been deprecated in favor of 
DAL and Field (I think they refer to the same classes -- just different 
names, so no big deal). Of course, because web2py maintains backward 
compatibility, everything in there should still work.
 
Anthony


Re: [web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-06 Thread Tom Atkins
Oops - sorry, ignore my last message. I had an old version of dal.pyc...
removed that and restarted web2py and everything is working great.  Many
thanks.

On 6 February 2011 13:26, Tom Atkins  wrote:

> Thanks for looking into this Massimo.  I just pulled the most recent
> version and still get the same error as originally described.  I added a
> comment here:
>
> http://code.google.com/p/web2py/issues/detail?id=173&can=1&sort=-id
>
> Let
> me know if you need any more info.  I definitely have the latest version.
>
>
> On 4 February 2011 19:49, Massimo Di Pierro wrote:
>
>> This is a trunk bug. The problem does should be there in stable. I
>> will fix this tonight.
>>
>> On Feb 4, 12:50 pm, Tom Atkins  wrote:
>> > On 4 February 2011 14:33, Massimo Di Pierro > >wrote:
>> >
>> > > You are using web2py trunk right?
>> >
>> > Yes - just a clean version of web2py pulled by Hg from Google code.
>> >
>> > > Did you set a sequence_name
>> > > manually?
>> >
>> > No (not even sure what sequence_name is!) -  I tried another app of my
>> own
>> > and get the same result.
>>
>
>


[web2py] Re: GAE timeout when wsgihandler.py is missing

2011-02-06 Thread dlypka
I suggest checking the logs for any clues.
Slow running often = exceptions are happening.

On Feb 5, 6:12 pm, Charles Law  wrote:
> I am uploading an app to GAE. Through some experimentation I've found
> that if I don't include wsgihandler.py, the app loads very slowly. It
> feels like it's looking for this file and them timing out. Besides the
> slow loading, everything works perfectly without wsgihandler.py, so I
> want to know if there is a simple way to remove the references to the
> file. I searched through all the uploaded files, but it doesn't look
> like there are direct references.
>
> Also, here is a list of the files I'm including:
> web2py/app.yaml
> web2py/gaehandler.py
> web2py/VERSION
> web2py/gluon/* (and subfolders)
> web2py/applications/appname/* (and subfolders)
> Thanks


[web2py] Django vs web2py pain points

2011-02-06 Thread Luther Goh Lu Feng
Hi all,

I am about to have a constructive discussion about web2py vs django
with a team member of mine before we decide whether to implement a
project. He is an expert with django while I consider myself an
intermediate web2py user.

This is not a flamebait, but I would like to mainly hear pain points
about web2py and django, so that we can make a good decision. I am
only familiar with web2py, and only brushed the surface of django.

Thanks in advance.


[web2py] Re: pending issues?

2011-02-06 Thread Massimo Di Pierro
just do

diff -rupN original/dal.py your/dal.py > your-dal.patch



On Feb 6, 4:41 am, dlypka  wrote:
> My patch 5. is the most serious.  That bug causes an exception when
> creating a table which has
> native GAE properties such as gae.ReferenceProperty() because that is
> not a string (it is not in quotes)
> For example, this will crash:
>
>                     db.Field('seq','integer'),     # OK because
> 'integer' is a string
>                     db.Field('gaeRef', gae.ReferenceProperty()), #
> crashes here because expression gae.ReferenceProperty() is not a
> string. My suggested patch is to move the check for gae properties
> ahead of the string check.
>
> Patch 2. is also pretty serious. Maybe this has been addressed
> somewhere, but I am seeing that html.py tries
> to return XML() which causes an Exception:
> #   File "C:\Program Files (x86)\Google\google_appengine\google
> \appengine\api\datastore_types.py", line 1323, in ValidateProperty
> #    'Unsupported type for property %s: %s' % (name, v.__class__))
> #       BadValueError: Unsupported type for property success_path:
>
> I'll see what I can do about creating (Mercurial (?)) patch files.
> That is new to me but I suppose a blessing to learn...
>
> On Feb 6, 12:35 am, Massimo Di Pierro 
> wrote:
>
>
>
>
>
>
>
> > Can you please send me all the changes as a patch file to the latest
> > dal.py? I am lost because of google groups breaks indentation.
>
> > On Feb 5, 9:40 pm, dlypka  wrote:
>
> > > 6. in dal.py class Table around line 5900:
>
> > >     def _drop(self, mode = ''):
> > >         return self._db._adapter._drop(self, mode)
>
> > >     def drop(self, mode = ''):
> > >         return self._db._adapter._drop(self, mode) # dlypka patch.
> > > was: self._db._adapter.drop(self,mode)
>
> > > On Feb 5, 10:36 pm, dlypka  wrote:
>
> > > > 5. In dal.py:
>
> > > > class NoSQLAdapter(BaseAdapter):
>
> > > >     def represent(self, obj, fieldtype):
> > > >         if type(obj) in (types.LambdaType, types.FunctionType):
> > > >             obj = obj()
> > > >         if isinstance(fieldtype, SQLCustomType):
> > > >             return fieldtype.encoder(obj)
> > > >         if isinstance(obj, (Expression, Field)):
> > > >             raise SyntaxError, "non supported on GAE"
>
> > > >         if 'gae' in globals():
> > > >             if isinstance(fieldtype, gae.Property):
> > > >                 return obj
>
> > > >         if fieldtype.startswith('list:'):  # dlypka patch to move this
> > > > to be AFTER the if 'gae' clause because fieldtype may not necessarily
> > > > be a string
> > > >             if not obj:
> > > >                 obj = []
> > > >             if not isinstance(obj, (list, tuple)):
> > > >                 obj = [obj]
>
> > > > On Feb 5, 11:21 am, dlypka  wrote:
>
> > > > > More issues
> > > > > 1. # dlypka Mod in dal.py: had to move this try .. except up here in
> > > > > front of class NoSQLAdapter because gae is needed in class
> > > > > NoSQLAdapter
> > > > > try:
> > > > >     from new import classobj
> > > > >     from google.appengine.ext import db as gae
> > > > >     from google.appengine.api import namespace_manager
> > > > >     # from google.appengine.api.datastore_types import Key  ### why
> > > > > was this needed
> > > > >     from google.appengine.ext.db.polymodel import PolyModel
> > > > >     drivers.append('gae')
> > > > > except ImportError:
> > > > >     pass
>
> > > > > class NoSQLAdapter(BaseAdapter):
>
> > > > > 2. html.py line 265
> > > > >     return rewrite.filter_out(url, env) # dlypka patch. Was
> > > > > XML(rewrite.filter_out(url, env))
> > > > > # XML() causes Exception:
> > > > > #   File "C:\Program Files (x86)\Google\google_appengine\google
> > > > > \appengine\api\datastore_types.py", line 1323, in ValidateProperty
> > > > > #    'Unsupported type for property %s: %s' % (name, v.__class__))
> > > > > #       BadValueError: Unsupported type for property success_path:
> > > > > 
>
> > > > > 3. class GAENoSQLAdapter(NoSQLAdapter):
> > > > >     uploads_in_blob = True
> > > > >     types = {}
>
> > > > >     def file_exists(self, filename): pass
> > > > >     def file_open(self, filename, mode='rb', lock=True): pass
> > > > >     def file_close(self, fileobj, unlock=True): pass
>
> > > > >     def __init__(self,db,uri,pool_size=0,folder=None,db_codec
> > > > > ='UTF-8',
> > > > >                  credential_decoder=(lambda x:x)):  # dlypka patch:
> > > > > added brackets around lambda - syntax error
> > > > >         self.types.update({
>
> > > > > 4.     def insert(self,table,fields):
> > > > >         dfields=dict((f.name,self.represent(v,f.type)) for f,v in
> > > > > fields)
> > > > >         # table._db['_lastsql'] = self._insert(table,fields)
> > > > >         tmp = table._tableobj(**dfields)
> > > > >         tmp.put()
> > > > >         table._db['_last_reference'] = tmp # dlypka patched based on
> > > > > June 27/2010 mod in the trunk
> > > > >         rid = Reference(tmp.key().id())
>

[web2py] Re: postgresql error ... (relation "auth_user" already exists)

2011-02-06 Thread Massimo Di Pierro
The least comment in the issue thread says it is fixed after deleting
the pyc. Is that not correct?

On Feb 6, 7:26 am, Tom Atkins  wrote:
> Thanks for looking into this Massimo.  I just pulled the most recent version
> and still get the same error as originally described.  I added a comment
> here:
>
> http://code.google.com/p/web2py/issues/detail?id=173&can=1&sort=-id
>
> Let me
> know if you need any more info.  I definitely have the latest version.
>
> On 4 February 2011 19:49, Massimo Di Pierro wrote:
>
>
>
>
>
>
>
> > This is a trunk bug. The problem does should be there in stable. I
> > will fix this tonight.
>
> > On Feb 4, 12:50 pm, Tom Atkins  wrote:
> > > On 4 February 2011 14:33, Massimo Di Pierro  > >wrote:
>
> > > > You are using web2py trunk right?
>
> > > Yes - just a clean version of web2py pulled by Hg from Google code.
>
> > > > Did you set a sequence_name
> > > > manually?
>
> > > No (not even sure what sequence_name is!) -  I tried another app of my
> > own
> > > and get the same result.


[web2py] Next record in crud.create

2011-02-06 Thread Running Clam

Hi All,

Using CRUD methods, in a controller I have: -

def update():
crud.settings.showid = True
crud.settings.update_next = URL('view', 
args=[request.args(0),request.args(1)])

return dict(form=crud.update(db.accmgr,
request.args(1)))

...and update_next takes me to view the record updated, using the id in 
the request to identify the record.


If I try to do the equivalent with an insert, I need to access the ID of 
the inserted record, which I had understood to be accessible via 
"form.vars.id" but if I try: -


def add():
crud.settings.create_next = URL('view', args=['accmgr', 
form.vars.id])

return dict(form=crud.create(db.accmgr))

...I get an error ticket telling me that "form is not defined".

I have read that "form.vars.id" works with "onaccept", because 
"onaccept" is called with "form" as a parameter after the form is

accepted, but that does not seem to apply here.

Do I need to somehow explicitly make the "create_next" conditional on 
the form having been accepted, or is there a different syntax I can use 
to access the "id", or am I on the wrong track entirely?



--

Cheers,

Clam


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Michael Toomim
The biggest django pain points to me:
  - Templating system is a PAIN.  You have to learn a new language,
and in the end it's not as powerful as python.
  - Database ORM can be a pain.  Same reasons.  You have to learn a
big special-purpose API in addition to SQL, and learn how it
translates between the two.

In general, django tries to build too many special-purpose
abstractions for everything.  This makes it more complicated.  You
have to learn more.  And they get in your way when they aren't
powerful enough to do what you need.  Then you have to hack them.

more details on django pain I've encountered:
- template system requires learning a new language
- that new language is limited, e.g. difficult to define a variable,
makes simple things hard
- because it uses ORM instead of DAL, you need to learn new object
language for selecting and updating database, and learn how it maps to
SQL, because eventually you need to understand the raw tables too
- you have to type things at the command line more often to make
changes.  So you shut down the server, type a command, restart the
server.  some of these things are automatic in web2py.  You just edit
the code, and everything reloads automatically.
- database migrations require using "south", an external plugin system
- errors in your use of django will often crash deep within django.
you'll be looking at a stack trace to some internal django file and
not realize it's because you added a '/' to the end of a path in
settings.py
- more complicated to set up, mucking around in settings.py
- constrained in how you pass variables to views from controllers.
e.g. can't set global variables, that apply across multiple views,
like a breadcrumb path.  have to specify it manually in each
controller and view.
- have to type arcane things sometimes like "return
render_to_response(blah)" at the end of a controller instead of just
"return blah"


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Massimo Di Pierro
Django has a better administrative interface (equivalent to our
addadmin) bot nothing equivalent web2py admin. Django has no
migrations. Every time you update the models you have to alter tables
yourself. There may be third party packages that do mirations but are
not in the stable branch.

Django runs on GAE but, if you use the Django modules provided by
google, you have to rewrite queries using the google APIs because the
official Django ORM does not support GAE. There is a patch to support
GAE but it is not in stable. Anyway, it does not support it as
seamlessly as the web2py dal does.

Django is more verbose by at least a factor 2.

Django uses a different language for templates that is not python. It
is not even Turing complete therefore it limits very much what you can
do. In shops where you have designers and you want to limit how much
damage their bugs can make, that is a plus (Django users make this
point). My experience is that good designers can program and you do
not want to restrict them to much.

Certain queries in Django are easier (in particular involving  simple
many-to-many) but web2py has more flexibility (queries with
aggregates, left joins and nested selects) because web2py's DAL is
closer to SQL than Django's ORM.

I believe we have a more friendly community but that you can judge for
yourself.

On Feb 6, 9:36 am, Luther Goh Lu Feng  wrote:
> Hi all,
>
> I am about to have a constructive discussion about web2py vs django
> with a team member of mine before we decide whether to implement a
> project. He is an expert with django while I consider myself an
> intermediate web2py user.
>
> This is not a flamebait, but I would like to mainly hear pain points
> about web2py and django, so that we can make a good decision. I am
> only familiar with web2py, and only brushed the surface of django.
>
> Thanks in advance.


[web2py] Re: Next record in crud.create

2011-02-06 Thread Massimo Di Pierro
There is a shortcut for this:

def add():
 return dict(form=crud.create(db.accmgr,next='view/[id]'))

On Feb 6, 9:55 am, Running Clam  wrote:
> Hi All,
>
> Using CRUD methods, in a controller I have: -
>
> def update():
>      crud.settings.showid = True
>      crud.settings.update_next = URL('view',
> args=[request.args(0),request.args(1)])
>      return dict(form=crud.update(db.accmgr,
>          request.args(1)))
>
> ...and update_next takes me to view the record updated, using the id in
> the request to identify the record.
>
> If I try to do the equivalent with an insert, I need to access the ID of
> the inserted record, which I had understood to be accessible via
> "form.vars.id" but if I try: -
>
> def add():
>      crud.settings.create_next = URL('view', args=['accmgr',
> form.vars.id])
>      return dict(form=crud.create(db.accmgr))
>
> ...I get an error ticket telling me that "form is not defined".
>
> I have read that "form.vars.id" works with "onaccept", because
> "onaccept" is called with "form" as a parameter after the form is
> accepted, but that does not seem to apply here.
>
> Do I need to somehow explicitly make the "create_next" conditional on
> the form having been accepted, or is there a different syntax I can use
> to access the "id", or am I on the wrong track entirely?
>
> --
>
> Cheers,
>
> Clam


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Massimo Di Pierro
One more thing.

Django follows: explicit is better than implicit. That means you have
to be painfully detailed for everything you do.

web2py follows: do no repeat yourself. Every has a default. so you can
be very loose and still have code that works (models without
controllers, controllers without views, etc.). If you do not like the
default behavior you can change it later.

This is a major philosophical diference and one of the two issues they
criticize us for (and we criticize them for). The other issue is the
one with exec. Which not a bug as they want you to believe, but a well-
thought design decision, that allows hot plug and play of applications
without generating module conflicts.

Massimo

On Feb 6, 10:02 am, Massimo Di Pierro 
wrote:
> Django has a better administrative interface (equivalent to our
> addadmin) bot nothing equivalent web2py admin. Django has no
> migrations. Every time you update the models you have to alter tables
> yourself. There may be third party packages that do mirations but are
> not in the stable branch.
>
> Django runs on GAE but, if you use the Django modules provided by
> google, you have to rewrite queries using the google APIs because the
> official Django ORM does not support GAE. There is a patch to support
> GAE but it is not in stable. Anyway, it does not support it as
> seamlessly as the web2py dal does.
>
> Django is more verbose by at least a factor 2.
>
> Django uses a different language for templates that is not python. It
> is not even Turing complete therefore it limits very much what you can
> do. In shops where you have designers and you want to limit how much
> damage their bugs can make, that is a plus (Django users make this
> point). My experience is that good designers can program and you do
> not want to restrict them to much.
>
> Certain queries in Django are easier (in particular involving  simple
> many-to-many) but web2py has more flexibility (queries with
> aggregates, left joins and nested selects) because web2py's DAL is
> closer to SQL than Django's ORM.
>
> I believe we have a more friendly community but that you can judge for
> yourself.
>
> On Feb 6, 9:36 am, Luther Goh Lu Feng  wrote:
>
>
>
>
>
>
>
> > Hi all,
>
> > I am about to have a constructive discussion about web2py vs django
> > with a team member of mine before we decide whether to implement a
> > project. He is an expert with django while I consider myself an
> > intermediate web2py user.
>
> > This is not a flamebait, but I would like to mainly hear pain points
> > about web2py and django, so that we can make a good decision. I am
> > only familiar with web2py, and only brushed the surface of django.
>
> > Thanks in advance.


[web2py] Re: Rocket with urllib2 behavior [BUG?]

2011-02-06 Thread Timbo
If you've only got one thread running, then yes, this will deadlock on
any threaded server.

Rocket was certainly not made to not allow lookups back to itself.

Where are you putting this code?  If by assigning to "response" are
you masking web2py's response object?

I...
1) downloaded a fresh copy of web2py
2) created a fresh application
3) set the index(): to:
def index():
import urllib2
url = 'http://127.0.0.1:8000/welcome/default/index'
resp = urllib2.urlopen(url).read()
return resp + "blah"

I got the expected result.

I need a little more information to debug this.

-tim

On Feb 6, 12:23 am, vihang  wrote:
> Hi,
>
> Code:
>
> import urllib2
>     url = 'http://127.0.0.1/server/default/index'
>     response = urllib2.urlopen(url)
>
> Here 127.0.0.1 is the same web2py from which this code is being
> called. On doing so, the web2py hangs. I debugged the issue to Rocket,
> where it does not allocate a new thread to request (active_queue.get()
> does not return a new thread required to complete the response), as
> the current session is already using one. This is not a problem with
> other web servers.
>
> Is this a bug or just the way Rocket server was made to behave?
>
> Vihang


Re: [web2py] Re: Next record in crud.create

2011-02-06 Thread Running Clam

Hi Massimo,

On 06/02/2011 16:03, Massimo Di Pierro wrote:

There is a shortcut for this:

def add():
  return dict(form=crud.create(db.accmgr,next='view/[id]'))



Sorted - Thanks!


--

Cheers,

Clam


[web2py] Re: Rocket with urllib2 behavior [BUG?]

2011-02-06 Thread Timbo
I had one more thought, does '/server/default/index' point to this
code?  If this is the case, then you have an infinite loop that
consumes all available threads and deadlocks.  Again, this is not a
rocket-specific behavior.

On Feb 6, 10:08 am, Timbo  wrote:
> If you've only got one thread running, then yes, this will deadlock on
> any threaded server.
>
> Rocket was certainly not made to not allow lookups back to itself.
>
> Where are you putting this code?  If by assigning to "response" are
> you masking web2py's response object?
>
> I...
> 1) downloaded a fresh copy of web2py
> 2) created a fresh application
> 3) set the index(): to:
> def index():
>     import urllib2
>     url = 'http://127.0.0.1:8000/welcome/default/index'
>     resp = urllib2.urlopen(url).read()
>     return resp + "blah"
>
> I got the expected result.
>
> I need a little more information to debug this.
>
> -tim
>
> On Feb 6, 12:23 am, vihang  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Code:
>
> > import urllib2
> >     url = 'http://127.0.0.1/server/default/index'
> >     response = urllib2.urlopen(url)
>
> > Here 127.0.0.1 is the same web2py from which this code is being
> > called. On doing so, the web2py hangs. I debugged the issue to Rocket,
> > where it does not allocate a new thread to request (active_queue.get()
> > does not return a new thread required to complete the response), as
> > the current session is already using one. This is not a problem with
> > other web servers.
>
> > Is this a bug or just the way Rocket server was made to behave?
>
> > Vihang


[web2py] Why do we do what we do?

2011-02-06 Thread Massimo Di Pierro
http://www.thersa.org/events/vision/animate/rsa-animate-drive

[web2py] Re: Rocket with urllib2 behavior [BUG?]

2011-02-06 Thread Massimo Di Pierro
wait...


def index():
import urllib2
url = 'http://127.0.0.1:8000/welcome/default/index'
resp = urllib2.urlopen(url).read()
return resp + "blah"

This creates an infinite loops that spans more and more threads.

I assumed from the original post, the urllopen code was outside a
controller or at least in a function not calling itself.

On Feb 6, 10:08 am, Timbo  wrote:
> If you've only got one thread running, then yes, this will deadlock on
> any threaded server.
>
> Rocket was certainly not made to not allow lookups back to itself.
>
> Where are you putting this code?  If by assigning to "response" are
> you masking web2py's response object?
>
> I...
> 1) downloaded a fresh copy of web2py
> 2) created a fresh application
> 3) set the index(): to:
> def index():
>     import urllib2
>     url = 'http://127.0.0.1:8000/welcome/default/index'
>     resp = urllib2.urlopen(url).read()
>     return resp + "blah"
>
> I got the expected result.
>
> I need a little more information to debug this.
>
> -tim
>
> On Feb 6, 12:23 am, vihang  wrote:
>
>
>
>
>
>
>
> > Hi,
>
> > Code:
>
> > import urllib2
> >     url = 'http://127.0.0.1/server/default/index'
> >     response = urllib2.urlopen(url)
>
> > Here 127.0.0.1 is the same web2py from which this code is being
> > called. On doing so, the web2py hangs. I debugged the issue to Rocket,
> > where it does not allocate a new thread to request (active_queue.get()
> > does not return a new thread required to complete the response), as
> > the current session is already using one. This is not a problem with
> > other web servers.
>
> > Is this a bug or just the way Rocket server was made to behave?
>
> > Vihang


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread pbreit
I personally prefer Web2py but I would not feel comfortable pushing it over 
Django when the other party is significantly disposed to using Django. 
Mainly because Django is more widely used and especially is known to have 
been used in many large projects. Web2py is excellent for prototyping and 
pulling together smaller projects rapidly but it is unclear to me if it is 
the best choice for larger production projects.

[web2py] Re: Rocket with urllib2 behavior [BUG?]

2011-02-06 Thread Timbo
It only creates infinite loops if it's in the welcome
application...which it isn't (as I specified in step 2).

In either case, we still need more information.

On Feb 6, 12:04 pm, Massimo Di Pierro 
wrote:
> wait...
>
> def index():
>     import urllib2
>     url = 'http://127.0.0.1:8000/welcome/default/index'
>     resp = urllib2.urlopen(url).read()
>     return resp + "blah"
>
> This creates an infinite loops that spans more and more threads.
>
> I assumed from the original post, the urllopen code was outside a
> controller or at least in a function not calling itself.
>
> On Feb 6, 10:08 am, Timbo  wrote:
>
>
>
>
>
>
>
> > If you've only got one thread running, then yes, this will deadlock on
> > any threaded server.
>
> > Rocket was certainly not made to not allow lookups back to itself.
>
> > Where are you putting this code?  If by assigning to "response" are
> > you masking web2py's response object?
>
> > I...
> > 1) downloaded a fresh copy of web2py
> > 2) created a fresh application
> > 3) set the index(): to:
> > def index():
> >     import urllib2
> >     url = 'http://127.0.0.1:8000/welcome/default/index'
> >     resp = urllib2.urlopen(url).read()
> >     return resp + "blah"
>
> > I got the expected result.
>
> > I need a little more information to debug this.
>
> > -tim
>
> > On Feb 6, 12:23 am, vihang  wrote:
>
> > > Hi,
>
> > > Code:
>
> > > import urllib2
> > >     url = 'http://127.0.0.1/server/default/index'
> > >     response = urllib2.urlopen(url)
>
> > > Here 127.0.0.1 is the same web2py from which this code is being
> > > called. On doing so, the web2py hangs. I debugged the issue to Rocket,
> > > where it does not allocate a new thread to request (active_queue.get()
> > > does not return a new thread required to complete the response), as
> > > the current session is already using one. This is not a problem with
> > > other web servers.
>
> > > Is this a bug or just the way Rocket server was made to behave?
>
> > > Vihang


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Luther Goh Lu Feng
Is there an equivalent to 
http://docs.djangoproject.com/en/dev/ref/models/fields/#urlfield
in web2py?

If not, how does one validate an external url that is to be stored in
the database?


Re: [web2py] Re: Django vs web2py pain points

2011-02-06 Thread Jonathan Lundell
On Feb 6, 2011, at 11:40 AM, Luther Goh Lu Feng wrote:
> 
> Is there an equivalent to 
> http://docs.djangoproject.com/en/dev/ref/models/fields/#urlfield
> in web2py?
> 
> If not, how does one validate an external url that is to be stored in
> the database?

There are validators, IS_URL and IS_HTTP_URL, that check the syntax but don't 
actually do an access. Doing an access with an arbitrary user-entered URL seems 
pretty risky.



[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Luther Goh Lu Feng


On Feb 7, 3:54 am, Jonathan Lundell  wrote:
> On Feb 6, 2011, at 11:40 AM, Luther Goh Lu Feng wrote:
>
>
>
> > Is there an equivalent 
> > tohttp://docs.djangoproject.com/en/dev/ref/models/fields/#urlfield
> > in web2py?
>
> > If not, how does one validate an external url that is to be stored in
> > the database?
>
> There are validators, IS_URL and IS_HTTP_URL, that check the syntax but don't 
> actually do an access. Doing an access with an arbitrary  user-entered URL 
> seems pretty risky.

I see. Thanks! I also noticed that IS_HTTP_URL is not documented in
the book (unless I missed it). In case anyone wants to document it
http://web2py.com/examples/static/epydoc/web2py.gluon.validators.IS_HTTP_URL-class.html


[web2py] Re: Django vs web2py pain points

2011-02-06 Thread Anthony
On Sunday, February 6, 2011 1:28:58 PM UTC-5, pbreit wrote: 
>
> I personally prefer Web2py but I would not feel comfortable pushing it over 
> Django when the other party is significantly disposed to using Django. 
> Mainly because Django is more widely used and especially is known to have 
> been used in many large projects. Web2py is excellent for prototyping and 
> pulling together smaller projects rapidly but it is unclear to me if it is 
> the best choice for larger production projects.

 
Of course, it's not going to become clear unless people are willing to try 
it. Actually, I think at least a few of the sites listed on 
http://web2py.com/poweredby probably count as substantial production 
projects (and there are probably some non-public intranet sites as well).
 
Anthony


[web2py] Problem with DAL and Postgres

2011-02-06 Thread Bernardo
Dear all,

I am using web2py 1.91.6 and last version of Ubuntu. A model which
works perfectly using sqlite database, throws an error when using a
postgres database:

ProgrammingError: syntax error at or near "100"
LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100);

posible bug in new DAL?

Thanks a lot for your help,
Bernardo


Re: [web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread Vasile Ermicioi
>
> 5- At last I created '.htaccess':
> AddHandler fcgid-script .fcgi
> Options +FollowSymLinks  +ExecCGI
> RewriteEngine On
> RewriteBase /
> RewriteRule ^dispatch\.fcgi/ - [L]
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


what line should I add and where, or best of how will look entire htaccess
file if I want apache to serve my static files

RewriteRule ^(.*)/static/(.*)$ applications/$1/static/$2


[web2py] Re: Off Topic: HTML5 webapps with Google Closure, Clojure and NoSQL db's

2011-02-06 Thread Luther Goh Lu Feng
I am a bit curious why you went with Closure instead of GWT (with or
without pyjamas). Were there specific reasons you could share?

On Dec 12 2010, 5:14 am, dspiteself  wrote:
> It is not public yet, but it is in trial use by handful of offices. It
> is a commercial product so the source would not be availiable, but we
> would be interested in collaborating on any open source project to
> better integrate googleclosuresupport.
> It would be helpful for all developers to compress their long list of
> js files. Especially if the users begin to use more plugins.  We could
> implement some of the additional plovr features in a controller so I
> do not have to run a java process in the background of all my
> development boxes restart it every time you change the config. Googles
> dependancy tool is already python.
> After the functionality of plovr is all replicated you could integrate
> further and implement a python goog.require()to call in your
> controllers and views instead of adding script tags. Then you would
> only have one js well compressed file to download in compile mode and
> still have a debug mode where you could read your code.
> More importantly it will encourage users to build better libraries and
> share their javascript code.  This will help web2py attract more
> complex projects.
>
> On Dec 9, 5:21 pm, Richard  wrote:
>
> > thanks - I have been reading that book and heard of plovr
>
> > If your large app public?
>
> On Dec 9, 5:21 pm, Richard  wrote:
>
>
>
>
>
>
>
> > thanks - I have been reading that book and heard of plovr
>
> > If your large app public?


[web2py] Re: Problem with DAL and Postgres

2011-02-06 Thread Massimo Di Pierro
Do you have a custom auth_user table? Is seems to miss a length
attribute and default to a number too large. I changed the default to
32768 in trunk but I am not sure.

On Feb 6, 3:13 pm, Bernardo  wrote:
> Dear all,
>
> I am using web2py 1.91.6 and last version of Ubuntu. A model which
> works perfectly using sqlite database, throws an error when using a
> postgres database:
>
> ProgrammingError: syntax error at or near "100"
> LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100);
>
> posible bug in new DAL?
>
> Thanks a lot for your help,
> Bernardo


Re: [web2py] Re: Problem with DAL and Postgres

2011-02-06 Thread Bernardo Botella Corbí
Yes, the error is on my custom auth_user table. So, Do I reduce the leght
numbers?

Bernardo

2011/2/6 Massimo Di Pierro 

> Do you have a custom auth_user table? Is seems to miss a length
> attribute and default to a number too large. I changed the default to
> 32768 in trunk but I am not sure.
>
> On Feb 6, 3:13 pm, Bernardo  wrote:
> > Dear all,
> >
> > I am using web2py 1.91.6 and last version of Ubuntu. A model which
> > works perfectly using sqlite database, throws an error when using a
> > postgres database:
> >
> > ProgrammingError: syntax error at or near "100"
> > LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100);
> >
> > posible bug in new DAL?
> >
> > Thanks a lot for your help,
> > Bernardo
>


[web2py] SQLFORM.factory bug for field type = password

2011-02-06 Thread ionel
Hello,

In the controller I have a custom form that contains a password:

form = SQLFORM.factory(Field('afield', 'password'))
form.vars.afield = 'some initial password'

In view:

{{=form.custom.begin}}
{{=form.custom.widget.afield}}
{{=form.custom.submit}}
{{=form.custom.end}}

The problem is that the text field in the view doesn't display
'' (in fact the 'some initial password' string) when
the page is loaded. If I change the field type from 'password' to
'string', 'some initial password' is displayed inside the text field:

form = SQLFORM.factory(Field('afield', 'string'))

I think this is a bug.

Thanks.

i.a.



[web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread Massimo Di Pierro
says page not found. :-(

On Dec 20 2010, 7:56 am, GoldenTiger  wrote:
> I think a lot of users will be happy of seeing this:  web2py running
> on hostgator.
>
> Demo:  http://hostgator.web2py.es   (steps to install included)
>
> There are a lot of people using Hostgator shared hosting, It is maybe
> one of the best over the net, and their servers are very fast.
> I've seen a lot of users trying to install web2py...if you do a Google
> search, you'll can find that. A lot of users tried to install it (like
> me) without success.
>
> Some weeks ago I could successfully running web2py on hostgator shared
> hosting.
>
> Unlike Hostmonster or Dreamhost, on hostgator you can't compile custom
> python version. But you can still run web2py.
>
> STEPS for INSTALLING web2py  on Hostgator :
>
>   1 - Via SSH shell,  find  python-2.7   using 'whereis' command:
>     *       whereris python
>     * ...  something like 'usr/bin/python2.7'
>
> 2-  Hostgator has following python 2.7 modules , and are currently
> installed on almost all servers.
> However, in my case, I had to create a ticket.
> If you are missing any of these modules, open a LiveChat o create a
> ticket:
>
>     * MySQL-python
>     * flup
>     * django
>     * psutil
>     * django-registration
>     * sorl-thumbnail
>     * south
>     * django-keyedcache
>     * django-livesettings
>     * django-app-plugins
>     * django-signals-ahoy
>     * pycrypto
>     * django-threaded-multihost
>     * PIL
>     * pyCrypto
>     * paramiko
>     * ElementTree
>     * cElementTree
>     * Pyrex
>     * hashlib
>     * Mercurial
>
> 3 - I unzipped web2py_src.zip  into  folder
> 'hostgator.web2py.es'  ( web root folder)
>
> wgethttp://www.web2py.com/examples/static/web2py_src.zip
> unzip web2py_src.zip -d /home/goldentiger/public_html
> mv web2py/* hostgator.web2py.es/
>
> 4 - I created 'dispatch.fcgi'  starting with  python2.7 path
>
> #!/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()
>
> and set execution permission:  chmod +x dispatch.fcgi
>
> 5- At last I created '.htaccess':
> AddHandler fcgid-script .fcgi
> Options +FollowSymLinks  +ExecCGI
> RewriteEngine On
> RewriteBase /
> RewriteRule ^dispatch\.fcgi/ - [L]
> RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


[web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread GoldenTiger
LOL XD


-  January, Last 30 days: --> From Analitycs :  hostgator.web2py.es
===>>>  6 visits ,  0:00:05 secs average time


-  Yesterday: I removed the url for testing pourposes (temporarily)

-  Today  :   This topic is resurrected


OK, I am going to fix it then :D

I'll write a web2pyslice, ok?


On 7 feb, 02:36, Massimo Di Pierro  wrote:
> says page not found. :-(
>
> On Dec 20 2010, 7:56 am, GoldenTiger  wrote:
>
>
>
>
>
>
>
> > I think a lot of users will be happy of seeing this:  web2py running
> > on hostgator.
>
> > Demo:  http://hostgator.web2py.es  (steps to install included)
>
> > There are a lot of people using Hostgator shared hosting, It is maybe
> > one of the best over the net, and their servers are very fast.
> > I've seen a lot of users trying to install web2py...if you do a Google
> > search, you'll can find that. A lot of users tried to install it (like
> > me) without success.
>
> > Some weeks ago I could successfully running web2py on hostgator shared
> > hosting.
>
> > Unlike Hostmonster or Dreamhost, on hostgator you can't compile custom
> > python version. But you can still run web2py.
>
> > STEPS for INSTALLING web2py  on Hostgator :
>
> >   1 - Via SSH shell,  find  python-2.7   using 'whereis' command:
> >     *       whereris python
> >     * ...  something like 'usr/bin/python2.7'
>
> > 2-  Hostgator has following python 2.7 modules , and are currently
> > installed on almost all servers.
> > However, in my case, I had to create a ticket.
> > If you are missing any of these modules, open a LiveChat o create a
> > ticket:
>
> >     * MySQL-python
> >     * flup
> >     * django
> >     * psutil
> >     * django-registration
> >     * sorl-thumbnail
> >     * south
> >     * django-keyedcache
> >     * django-livesettings
> >     * django-app-plugins
> >     * django-signals-ahoy
> >     * pycrypto
> >     * django-threaded-multihost
> >     * PIL
> >     * pyCrypto
> >     * paramiko
> >     * ElementTree
> >     * cElementTree
> >     * Pyrex
> >     * hashlib
> >     * Mercurial
>
> > 3 - I unzipped web2py_src.zip  into  folder
> > 'hostgator.web2py.es'  ( web root folder)
>
> > wgethttp://www.web2py.com/examples/static/web2py_src.zip
> > unzip web2py_src.zip -d /home/goldentiger/public_html
> > mv web2py/* hostgator.web2py.es/
>
> > 4 - I created 'dispatch.fcgi'  starting with  python2.7 path
>
> > #!/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()
>
> > and set execution permission:  chmod +x dispatch.fcgi
>
> > 5- At last I created '.htaccess':
> > AddHandler fcgid-script .fcgi
> > Options +FollowSymLinks  +ExecCGI
> > RewriteEngine On
> > RewriteBase /
> > RewriteRule ^dispatch\.fcgi/ - [L]
> > RewriteRule ^(.*)$ dispatch.fcgi/$1 [L]


Re: [web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread Franzé Jr
I have a similar problem.

I'm using dreamhost.

I've used this : http://wiki.dreamhost.com/Web2py

But:

The requested URL /dispatch.fcgi/ was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an
ErrorDocument to handle the request.


Some idea ?




-- 
Franzé Jr


[web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread GoldenTiger
I haven't any problem with hostgator, I renamed the dispatch.fcgi
intentionally

I also I have a Dreamhost VPS, and a shared plan.  Web2py is working
OK using WSGI.

Why do you want fcgi?







On 7 feb, 03:31, Franzé Jr  wrote:
> I have a similar problem.
>
> I'm using dreamhost.
>
> I've used this :http://wiki.dreamhost.com/Web2py
>
> But:
>
> The requested URL /dispatch.fcgi/ was not found on this server.
>
> Additionally, a 404 Not Found error was encountered while trying to use an
> ErrorDocument to handle the request.
>
> Some idea ?
>
> --
> Franzé Jr


[web2py] Re: IS_MATCH() changing a valid value ?

2011-02-06 Thread Ken
Thank you! I am pleased with this resolution.

On Feb 6, 1:22 am, Massimo Di Pierro 
wrote:
> In trunk
>
> IS_MATCH(...,strict=True)  # true is default now and it does append
> the '$' is missing.
>
> On Feb 4, 8:17 pm, Ken  wrote:
>
> > That change would have prevented my problem. However, would it
> > guaranty that the returned (accepted) match.group() value would never
> > differ from the input value? I am worried about more complex queries
> > now. I still think that if IS_MATCH() finds that it has accepted
> > something that is not the input value, it should return an error.
>
> > Ken
>
> > On Feb 3, 6:35 pm, Jonathan Lundell  wrote:
>
> > > On Feb 3, 2011, at 3:03 PM, Ken wrote:
>
> > > > You are right. Having (re)read the documentation for re, I find that
> > > > it is working as advertised. My original regex was wrong. However, I
> > > > would argue that if the match found by regex.match() is different from
> > > > the input value, IS_MATCH should return an error. That is, in the
> > > > IS_MATCH.__call__ definition, "if match:" should be "if match and
> > > > (value == match.group():". That change would raise an error that would
> > > > force a user like me to correct a regex that was matching in an
> > > > unexpected way. I would never want IS_MATCH to silently change data
> > > > between a form and insertion into a database.
>
> > > IS_MATCH is already implicitly anchored at the beginning of the field, 
> > > since it uses re.match. I think it'd make sense to implicitly anchor at 
> > > the end as well.
>
> > > We could change this:
>
> > >         self.regex = re.compile(expression)
>
> > > to this:
>
> > >         self.regex = re.compile('(%s)$' % expression)
>
> > > > Ken
>
> > > > On Feb 2, 9:13 pm, Massimo Di Pierro 
> > > > wrote:
> > > >> This is the correct behavio of regular expressions. Anyway, good that
> > > >> you are pointing this out since others may find it counter intuitive.
>
> > > >> Massimo
>
> > > >> On Feb 2, 6:33 pm, Ken  wrote:> I have been having 
> > > >> trouble with truncation of data from one field of a
> > > >>> form. The culprit turned out to be the IS_MATCH() validator, which was
> > > >>> truncating a valid value to return a shorter valid value. I'm not sure
> > > >>> whether to call this a bug or just unexpected behavior, but if I had
> > > >>> trouble with it, someone else may.
>
> > > >>> The data in question were spreadsheet-style coordinate values with
> > > >>> letters for rows and numbers for columns, in the range A1 to J10.
> > > >>> Initially, I used a validator like IS_MATCH('^[A-J][1-9]|[A-J]10$').
> > > >>> This checks first for the two-character combinations A1 to J9, then
> > > >>> checks for A10 to J10. If I test this in a web2py shell, it accepts
> > > >>> and returns the two-character combinations, but it accepts and
> > > >>> truncates any values ending in 10.
>
> > > >>> In [1] : vdtr = IS_MATCH('^[A-J][1-9]|[A-J]10$')
>
> > > >>> In [2] : vdtr('A1')
> > > >>> ('A1', None)
>
> > > >>> In [3] : vdtr('J1')
> > > >>> ('J1', None)
>
> > > >>> In [4] : vdtr('A10')
> > > >>> ('A1', None)
>
> > > >>> In [5] : vdtr('J10')
> > > >>> ('J1', None)
>
> > > >>> It seems to me that A1 and J1 are not proper matches because the '1'
> > > >>> does not appear at the end of the validated string. In any case, I am
> > > >>> surprised that IS_MATCH() would modify a value under any
> > > >>> circumstances.
>
> > > >>> If I turn the regex around, so that it tests for the three-character
> > > >>> combinations first, like IS_MATCH('^[A-J]10|[A-J][1-9]$'), then things
> > > >>> work better.
>
> > > >>> In [6] : vdtr = IS_MATCH('^[A-J]10|[A-J][1-9]$')
>
> > > >>> In [7] : vdtr('A1')
> > > >>> ('A1', None)
>
> > > >>> In [8] : vdtr('J1')
> > > >>> ('J1', None)
>
> > > >>> In [9] : vdtr('A10')
> > > >>> ('A10', None)
>
> > > >>> In [10] : vdtr('J10')
> > > >>> ('J10', None)
>
>


[web2py] Re: Problem with DAL and Postgres

2011-02-06 Thread Massimo Di Pierro
Can you show your custom auth_user. I am still puzzled by the error.

On Feb 6, 4:21 pm, Bernardo Botella Corbí  wrote:
> Yes, the error is on my custom auth_user table. So, Do I reduce the leght
> numbers?
>
> Bernardo
>
> 2011/2/6 Massimo Di Pierro 
>
>
>
>
>
>
>
> > Do you have a custom auth_user table? Is seems to miss a length
> > attribute and default to a number too large. I changed the default to
> > 32768 in trunk but I am not sure.
>
> > On Feb 6, 3:13 pm, Bernardo  wrote:
> > > Dear all,
>
> > > I am using web2py 1.91.6 and last version of Ubuntu. A model which
> > > works perfectly using sqlite database, throws an error when using a
> > > postgres database:
>
> > > ProgrammingError: syntax error at or near "100"
> > > LINE 1: ALTER TABLE auth_user ADD password VARCHAR(100);
>
> > > posible bug in new DAL?
>
> > > Thanks a lot for your help,
> > > Bernardo


[web2py] Re: SQLFORM.factory bug for field type = password

2011-02-06 Thread Massimo Di Pierro
can you please open an issue in googlecode?

On Feb 6, 7:06 pm, ionel  wrote:
> Hello,
>
> In the controller I have a custom form that contains a password:
>
> form = SQLFORM.factory(Field('afield', 'password'))
> form.vars.afield = 'some initial password'
>
> In view:
>
> {{=form.custom.begin}}
> {{=form.custom.widget.afield}}
> {{=form.custom.submit}}
> {{=form.custom.end}}
>
> The problem is that the text field in the view doesn't display
> '' (in fact the 'some initial password' string) when
> the page is loaded. If I change the field type from 'password' to
> 'string', 'some initial password' is displayed inside the text field:
>
> form = SQLFORM.factory(Field('afield', 'string'))
>
> I think this is a bug.
>
> Thanks.
>
> i.a.


Re: [web2py] web2py working on my iPad! :vD

2011-02-06 Thread Jason Brower
It is always fun to get web2py running on a small environment like a 
phone or tablet.

Congrats,
Jason Brower

On 02/05/2011 07:39 AM, kgingeri wrote:

I have renewed interest in using web2py for simple Google gadgets and
CRUD updates to a web database, and in exploring it, wondered if I
could load and use it on my iPad.  Well, sure enough, I got it going!
Very impressive!!

Procedure is:
a) jailbreak your iPad&  install Cydia (a bit involved, but there's
lots of howto's on the web)
b) set your type as "developer" in Cydia (your prompted initially, -
or you may not be able to find Python, to install it
c) install unix commands - OpenSSH, wget, unzip, (vim) - via Cydia
d) install iphone/python (2.5)
e) install pTerm via iPad appstore
f) using pTerm, login to root@localhost (default pswd is "alpine" -
change it using "passwd"!!)
g) at sys prompt, use "wget http:/web2py/examples/static/
web2py_src.zip"
h) then "unzip web2py_src.zip"
i) then "cd web2py"
j) then "./web2py" ... enter a password (no gui but not prob)
k) use pTerm browser (via tapping the [...] button at upper right) to
browse to localhost:8000
l) your there, with sqlite and all!  Even the editor works with the
iPad (most don't)!!

So just in case anyone else out there is a little crazy like me, this
is how it is done:

Notes:
1) Jailbreaking your iPad:
 At the moment, it's still a Mac only, 'tethered' jailbreak,
 meaning; to enable the jailbreak mode you have to boot
 the device connected to your Mac, using redsn0w utility,
 and selecting the "just boot tethered' mode - otherwise the
 it will boot with jailbreaking disabled

2) pTerm does not go into background properly, so it will
 kill web2py if you try to use an iPad browser instead
 of the built in one - hopefully this is updated soon.

Here's some screenshots on picasa ->  
https://picasaweb.google.com/kgingeri/Wep2pyOnIpad?feat=directlink




[web2py] Re: Rocket with urllib2 behavior [BUG?]

2011-02-06 Thread vihang
As Tim rightly put it, the issue was only when called from the same 
controller. The chances of that happening are very bleak and in our case a 
mere coincidence. Nevertheless we wanted it cleared just to understand the 
server better. We have remodeled our code. 



[web2py] Can anyone recommend a good python forum in google groups or elsewhere?

2011-02-06 Thread Rupesh Pradhan
Can anyone recommend a good python forum in google groups or elsewhere?

Re: [web2py] Why do we do what we do?

2011-02-06 Thread Jason Brower
Very good.  I hope to think about these things with my business and 
rebuild the way we are working.


On 02/06/2011 07:02 PM, Massimo Di Pierro wrote:

http://www.thersa.org/events/vision/animate/rsa-animate-drive




[web2py] Re: Running web2py on Hostgator Shared hosting!

2011-02-06 Thread GoldenTiger
I put Web2Py Demo running fast on Hostgator again at http://hostgator.web2py.es


You can try examples http://hostgator.web2py.es/examples



On 7 feb, 03:46, GoldenTiger  wrote:
> I haven't any problem with hostgator, I renamed the dispatch.fcgi
> intentionally
>
> I also I have a Dreamhost VPS, and a shared plan.  Web2py is working
> OK using WSGI.
>
> Why do you want fcgi?
>
> On 7 feb, 03:31, Franzé Jr  wrote:
>
>
>
>
>
>
>
> > I have a similar problem.
>
> > I'm using dreamhost.
>
> > I've used this :http://wiki.dreamhost.com/Web2py
>
> > But:
>
> > The requested URL /dispatch.fcgi/ was not found on this server.
>
> > Additionally, a 404 Not Found error was encountered while trying to use an
> > ErrorDocument to handle the request.
>
> > Some idea ?
>
> > --
> > Franzé Jr


Re: [web2py] Re: plugin_wiki suggestions

2011-02-06 Thread Plumo
I also made this change to set the page title.

How can I access the page title from within a wiki page?
response.title is empty


[web2py] Web2py on Windows Server with IIS and URL Rewrite?

2011-02-06 Thread Panupat Chongstitwattana
Following the early chapters of the online book. I got web2py working
under 127.0.0.1:8000 but still confused with a couple things.

I'm learning web2py on a virtual server which mimics my company's set
up. The spec is as follow.
Windows Server 2008 R2
IIS7.5.
Python 2.7
MySQL 5.5

- Can I run web2py with the already running IIS7 service instead of
its own server? IIS already set up to recognize python scripts and
Django.

- The IIS needs to point the base of the website to a directory. For a
web2py site, which directory should this point to?

- I found a blog explaining how to set up ISAP_Rewrite 3, but IIS 7.5
now comes with its own URL Rewrite thing. Are there any tutorials
online about how to set this up?

best regards.


Re: [web2py] Re: Getting started

2011-02-06 Thread mikech
http://web2pyslices.com/main/default/index


[web2py] Deleting a cookie

2011-02-06 Thread Dane
Hello,

I've got my own user system (not using Auth), and I'm trying to
implement a Remember Me option with cookies. It's working fine when
the user selects 'Yes' for remember me. Setting and detecting the
cookie is no problem, but I can't find a way to delete the cookie when
the user logs out or selects 'No'. Here's my code which attempts
everything I can think of.

if request.cookies.has_key('user'):
request.cookies['user'].clear()
del request.cookies['user']
print 'remove request user cookie'
if response.cookies.has_key('user'):
response.cookies['user'].clear()
del response.cookies['user']
print 'remove response user cookie'

After running this, request.cookies.has_key('user') is still returning
true and the cookie's data is still present.

Ideas? Thanks.


[web2py] Re: Getting started

2011-02-06 Thread Dane
I advise beginning with the book as it's pretty easy to follow and has
the most up-to-date documentation you'll find.

You can do some fairly cool stuff just following the patterns in the
book, but before attempting anything serious you should spend some
time studying and getting comfortable with python. It pays off very
quickly.

Ask lots of questions here. I think the main 'weakness' of web2py is
that it improves and gets new features too fast for documentation to
keep up, so stuff that you'll find through google, while it will
always work because web2py never breaks backward compatibility, has
often been deprecated by a better technique. Asking here, you almost
always get a quick and up-to-date response.

Also, once you learn the ropes, reading the source code of web2py
itself is often the best form of documentation you can find, and it's
also great to learn how such a powerful piece of software was
written.

On Feb 5, 11:05 pm, stargate  wrote:
> i was wondering if there a step by step tutorial that will show me how
> to build a web2py website.  Coming from php I am use to using includes
> how would I get started.