[web2py] Re: An enhanced BEAUTIFY class

2010-02-18 Thread John Heenan
This is a better keyfilter for the new BEAUTIFY than the one I
provided as it allows a key to be an empty string.

keyfilter=lambda key=' '.join([x.capitalize() for x in
key[2:].split('_')]) if key[1:2]=='_' else key

I have updated a web2py slice with information about using the new
BEAUTIFY at http://www.web2pyslices.com/main/slices/take_slice/58

John Heenan


On Feb 18, 5:27 pm, John Heenan johnmhee...@gmail.com wrote:
 Thanks Massimo

 The keyfilter example you provided does not work but this one does
 with the current BEAUTIFY in the trunk
 keyfilter=lambda key=' '.join([x.capitalize() for x in
 key[2:].split('_')]) if key[1]=='_' else key

 A typical view file is now
 {{extend 'layout.html'}}
 br /
 {{=BEAUTIFY(response._vars, keyfilter=lambda key: '
 '.join([x.capitalize() for x in key[2:].split('_')]) if key[1]=='_'
 else key)}}

 John Heenan

 On Feb 18, 6:47 am, mdipierro mdipie...@cs.depaul.edu wrote:



  I looked again.

  You try to achieve two things:
  1) As you say if the key starts with a_, this is removed. This is a
  trick to make sure elements are sorted as you like them.

  2) You capitalize the words and replace _ with spaces.

  I think these are wrong solution to the problem. Look into trunk. The
  new BEAUTIFY now takes two optional named arguments: sorted,
  keyfilter.

  You can do what you want with

  BEAUTIFY(dict(),keyfilter=lambda key: ' '.join([x.capitalize() for
  x in key.split('_')[1:]) if key[1:2]=='_' else key)

  On Feb 17, 5:49 am, John Heenan johnmhee...@gmail.com wrote:

   The code I posted does not replace the normal behaviour of BEAUTIFY.
   There is choice. In the four line example code I posted (which is from
   a web2py slice) the keys are only changed if the second character is
   an underscore.

   I accept there is little enthusiasm. It is ironic because I think
   there is potential to generalise an approach (such as with functional
   hooks as mentioned) and show  the framework working in a way that
   would generate more interest from the Python community (no web2py at
   PyCon). If there was a suitable hook then there would be no need to
   modify the BEAUTIFY class in  the web2py core.

   John Heenan

   On Feb 17, 2:55 pm, mdipierro mdipie...@cs.depaul.edu wrote:

Sorry I did not comment. I think this this can be very useful but it
should not be a replacement for the current beautify. I think it is
important to leave the keys unchanged for debugging purposes. That is
what most people use BEAUTIFY for.

You should post a slice about the improved function and I am sure it
will be useful.

On Feb 16, 9:20 pm, John Heenan johnmhee...@gmail.com wrote:

 True. But surely better organised or prettier prototypes are
 preferable when prototyping, as they gives a more realistic idea of a
 final desired layout before the prettifiers get called in!

 You can see the effect using just BEAUTIFY 
 athttp://www.zgus.com/zgus/products/category_item/1

 I don't have the skills or time to make the site pretty. If I start to
 make money using the site then I will be happy to pay someone to give
 my drab functional site a really pretty look!

 What I would really prefer in web2py is a hook in BEAUTIFY and other
 helpers so I could bypass them and not have my changes overridden
 every time I do an upgrade. Even a hook in a low level inherited base
 class would be enough, if using the hook would enable the name of the
 helper to be determined and to override the helper. However I reckon
 this is too much to ask!

 John Heenan

 On Feb 17, 11:57 am, villas villa...@gmail.com wrote:

  On Feb 17, 12:07 am, John Heenan johnmhee...@gmail.com wrote:

   No reaction to including a four line big productivity booster into
   web2py!

  Hi John,
  Sorry no one commented!  At least I looked at it, and liked it.  But
  Beautify is only a prototyping  testing thing for most so it's 
  making
  something prettier that no one will see. But it's still better, so 
  why
  not? +1
  David


-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-18 Thread ecall
I use your photon_torpedo/target sample in welcome application.

The request is http://127.0.0.1:8080/welcome/default/launch (GAE
1.3.1)

ERROR2010-02-18 09:04:36,200 restricted.py:53] In FILE: C:
\Python25\eclipse\workspace\web2py_1.75.3\applications\welcome/
controllers/default.py

Traceback (most recent call last):
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon
\restricted.py, line 173, in restricted
exec ccode in environment
  File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
\welcome/controllers/default.py:launch, line 62, in module
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\globals.py,
line 96, in lambda
self._caller = lambda f: f()
  File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
\welcome/controllers/default.py:launch, line 59, in launch
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
line 2395, in create
deletable=False,
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
line 2333, in update
upload=self.settings.download_url,
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
line 675, in __init__
inp = field.widget(field, default)
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
line 434, in __call__
record =
self.db(self.fields[1]==value).select(self.fields[0]).first()
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
\gql.py, line 673, in select
(items, tablename, fields) = self._select(*fields, **attributes)
  File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
\gql.py, line 636, in _select
item = self._db[tablename]._tableobj.get_by_id(filter.right)
  File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
\appengine\ext\db\__init__.py, line 1010, in get_by_id
return get(keys[0], rpc=rpc)
  File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
\appengine\ext\db\__init__.py, line 1203, in get
keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
  File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
\appengine\api\datastore.py, line 141, in NormalizeAndTypeCheckKeys
keys = [_GetCompleteKeyOrError(key) for key in keys]
  File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
\appengine\api\datastore.py, line 2354, in _GetCompleteKeyOrError
raise datastore_errors.BadKeyError('Key %r is not complete.' %
key)
BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
_app=u'web2py') is not complete.


INFO 2010-02-18 09:04:36,200 gaehandler.py:55]  Request:
109.00ms/109.00ms (real time/cpu time)
INFO 2010-02-18 09:04:36,246 dev_appserver.py:3246] GET /welcome/
default/launch HTTP/1.1 200 -

Says 200, but the browser send this:
  Status: 500 INTERNAL SERVER ERROR
  Content-Type: text/html; charset=UTF-8
  web2py_error: ticket welcome/
127.0.0.1.2010-02-18.08-16-43.e1b0f638-417c-4108-a75b-f809cb1de3ec
  Content-Length: 841

Thx



On 18 fév, 00:26, mdipierro mdipie...@cs.depaul.edu wrote:
 I have never seen this error. Can you show the relavant code and the
 complete traceback?

 On Feb 17, 3:58 pm, ecall edouard.call...@gmail.com wrote:

  Thanks for this nice feature.

  How can I make it run with ./dev_appserver.py (development for gae)?

  So far, I have this:
    File /workspace/google_appengine/src/google/appengine/api/
  datastore.py, line 2172, in _GetCompleteKeyOrError
      raise datastore_errors.BadKeyError('Key %r is not complete.' %
  key)
  BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
  _app_id_namespace=u'web2py') is not complete.

  Regards,
  Edouard

  On 6 fév, 21:30, mdipierro mdipie...@cs.depaul.edu wrote:

   People say there is some magic in web2py.
   Here is some real magic now in trunk that I am sure you have never
   seen.

   Caveats:
   0) requires latest trunk (bzr 1603, hg 175:e42b559254f6)
   1) this is an experiment, not sure it is a good idea
   2) this is the first function in web2py that REQUIRES jQuery
   3) works but I am not yet convinced it should stay there
   4) even if it stays, I am sure the API should stay

   Example:

   ### assume this model
   db.define_table('target',Field('name'))
   if not db(db.target.id0).count():
       db.target.insert(name=Klingon)
       db.target.insert(name=Romulans)
       db.target.insert(name=Borg)
       db.target.insert(name=Borg2)
   db.define_table('photon_torpedo',Field('target',db.target))

   ### assume this action in controller default.py
   def launch():
       db.photon_torpedo.target.represent=lambda target: target.name
       return dict(new_torpedo=crud.create(db.photon_torpedo),
                   launched_torpedos=db().select(db.photon_torpedo.ALL))

   So far nothing new.

   Now append to the model or insert at top of controller the following:

   from gluon.sqlhtml importAutocompleteWidget
   db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id)

   No need to define any callback action 

[web2py] session.flash not displayed anymore

2010-02-18 Thread aure
Hi everyone,

Does someone have an idea about why session.flash might stop to work
(is not displayed) for my controllers but keeps on working for login,
logout,...

Thank you,
Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Combining LEFT OUTER JOIN with COUNTING

2010-02-18 Thread aure
Hi,

I have used the methods given in the web2py manual, in the One to
Many Relation part, to try and combine a left outer join with
grouping and counting.  But I did not manage.

The examples given are:

 rows=db().select(db.person.ALL, db.dog.ALL, 
 left=db.dog.on(db.person.id==db.dog.owner))
 for row in rows:
print row.person.name, 'has', row.dog.name
Alex has Skipper
Alex has Snoopy
Bob has Puppy
Carl has None

 count = db.person.id.count()
 for row in db(db.person.id==db.dog.owner).select(db.person.name, count, 
 groupby=db.person.id):
print row.person.name, row._extra[count]
Alex 2
Bob 1

What should the query be to get such a result:
Alex 2
Bob 1
Carl 0

Thank you,
Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: session.flash not displayed anymore

2010-02-18 Thread aure
I just figured out that it only happens if I do a redirect to the page
from which the controller was called.

It happens like this:
- A link on a page home is clicked to access a page book but in
the book controller because some conditions are not met, I set a
message using session.flash('message') and do a redirect to home. It
goes to home but no message is displayed.

On the other hand, if the redirect is set to a page different from
home, then the message is displayed.

What should I do? Is the redirect not appropriate in the case we go
back to the calling page?

Aurelien

On Feb 18, 1:54 pm, aure aureliengir...@googlemail.com wrote:
 Hi everyone,

 Does someone have an idea about why session.flash might stop to work
 (is not displayed) for my controllers but keeps on working for login,
 logout,...

 Thank you,
 Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: how to display date and time nicely?

2010-02-18 Thread Iceberg
IMHO, the example's code is good, but not cool enough to be put in the
book. Every programmer saw those ordinary if...elif...elif...else
cliche in their first program language book before. People can
probably write their own if...elif...else in less time, than STFW or
RTFM to find our prettydate().

So, we need some extra flavor to compensate the time a guy spent to
find our prettydate(). How about making it i18n-friendly? Something
like this.

  class PrettyDate(object):
def __init__(self,T):
  self.T=T #
def __call__(self, d):
  dt = datetime.now() - d
  if dt.days = 2*365:
return self.T('%d years ago') % int(dt.days / 365)
  elif ...:
..

Then, in the model we can initialize an instance by:
  prettydate = PrettyDate(T)
In controller we can do:
  prettydate(d)
Of course developers need to localize their own language strings in
their own environment.

Just my $0.02

On Feb16, 1:21pm, Jason Brower encomp...@gmail.com wrote:
 These examples would be a very good edition to the book
 --
 J



 On Mon, 2010-02-15 at 16:19 -0800, mdipierro wrote:
  for lack of a better option I put it in tools for now.

  On Feb 15, 5:56 pm, Richard richar...@gmail.com wrote:
   added a few more cases:

   def prettydate(d):
       try:
           dt = datetime.now() - d
       except:
           return ''
       if dt.days = 2*365:
           return '%d years ago' % int(dt.days / 365)
       elif dt.days = 365:
           return '1 year ago'
       elif dt.days = 60:
           return '%d months ago' % int(dt.days / 30)
       elif dt.days  21:
           return '1 month ago'
       elif dt.days = 14:
           return '%d weeks ago' % int(dt.days / 7)
       elif dt.days = 7:
           return '1 week ago'
       elif dt.days  1:
           return '%d days ago' % dt.days
       elif dt.days == 1:
           return '1 day ago'
       elif dt.seconds = 2*60*60:
           return '%d hours ago' % int(dt.seconds / 3600)
       elif dt.seconds = 60*60:
           return '1 hour ago'
       elif dt.seconds = 2*60:
           return '%d minutes ago' % int(dt.seconds / 60)
       elif dt.seconds = 60:
           return '1 minute ago'
       elif dt.seconds  1:
           return '%d seconds ago' % dt.seconds
       elif dt.seconds == 1:
           return '1 second ago'
       else:
           return 'now'


On Feb 14, 3:13 pm, selecta gr...@delarue-berlin.de wrote:

 This is not 100% web2py related but I am sure if this will be answered
 many of you will profit at some point from it.

 Is there a python module that helps you to display dates and times
 nice e.g.

 just now (for within the last 5 minutes)
 2 hours ago
 2 days ago
 15th February 2009
 ...

 I guess somebody must have done that already, right?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Health Record demo app - source code available?

2010-02-18 Thread BrendanC
Just started looking at web2py and it looks quite impressive. I'm
always interested in finding existing code to review/modify when
learning a new technology. The video of the Electronic Health Record
app looks great and is something I might be interested in extending (I
have a lot of experience with health care apps). Is this a production
or demo app and is the source code available?

http://www.vimeo.com/8078872

TIA
Brendan

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: An enhanced BEAUTIFY class

2010-02-18 Thread mdipierro
Thank you John.

On Feb 18, 2:12 am, John Heenan johnmhee...@gmail.com wrote:
 This is a better keyfilter for the new BEAUTIFY than the one I
 provided as it allows a key to be an empty string.

 keyfilter=lambda key=' '.join([x.capitalize() for x in
 key[2:].split('_')]) if key[1:2]=='_' else key

 I have updated a web2py slice with information about using the new
 BEAUTIFY athttp://www.web2pyslices.com/main/slices/take_slice/58

 John Heenan

 On Feb 18, 5:27 pm, John Heenan johnmhee...@gmail.com wrote:

  Thanks Massimo

  The keyfilter example you provided does not work but this one does
  with the current BEAUTIFY in the trunk
  keyfilter=lambda key=' '.join([x.capitalize() for x in
  key[2:].split('_')]) if key[1]=='_' else key

  A typical view file is now
  {{extend 'layout.html'}}
  br /
  {{=BEAUTIFY(response._vars, keyfilter=lambda key: '
  '.join([x.capitalize() for x in key[2:].split('_')]) if key[1]=='_'
  else key)}}

  John Heenan

  On Feb 18, 6:47 am, mdipierro mdipie...@cs.depaul.edu wrote:

   I looked again.

   You try to achieve two things:
   1) As you say if the key starts with a_, this is removed. This is a
   trick to make sure elements are sorted as you like them.

   2) You capitalize the words and replace _ with spaces.

   I think these are wrong solution to the problem. Look into trunk. The
   new BEAUTIFY now takes two optional named arguments: sorted,
   keyfilter.

   You can do what you want with

   BEAUTIFY(dict(),keyfilter=lambda key: ' '.join([x.capitalize() for
   x in key.split('_')[1:]) if key[1:2]=='_' else key)

   On Feb 17, 5:49 am, John Heenan johnmhee...@gmail.com wrote:

The code I posted does not replace the normal behaviour of BEAUTIFY.
There is choice. In the four line example code I posted (which is from
a web2py slice) the keys are only changed if the second character is
an underscore.

I accept there is little enthusiasm. It is ironic because I think
there is potential to generalise an approach (such as with functional
hooks as mentioned) and show  the framework working in a way that
would generate more interest from the Python community (no web2py at
PyCon). If there was a suitable hook then there would be no need to
modify the BEAUTIFY class in  the web2py core.

John Heenan

On Feb 17, 2:55 pm, mdipierro mdipie...@cs.depaul.edu wrote:

 Sorry I did not comment. I think this this can be very useful but it
 should not be a replacement for the current beautify. I think it is
 important to leave the keys unchanged for debugging purposes. That is
 what most people use BEAUTIFY for.

 You should post a slice about the improved function and I am sure it
 will be useful.

 On Feb 16, 9:20 pm, John Heenan johnmhee...@gmail.com wrote:

  True. But surely better organised or prettier prototypes are
  preferable when prototyping, as they gives a more realistic idea of 
  a
  final desired layout before the prettifiers get called in!

  You can see the effect using just BEAUTIFY 
  athttp://www.zgus.com/zgus/products/category_item/1

  I don't have the skills or time to make the site pretty. If I start 
  to
  make money using the site then I will be happy to pay someone to 
  give
  my drab functional site a really pretty look!

  What I would really prefer in web2py is a hook in BEAUTIFY and other
  helpers so I could bypass them and not have my changes overridden
  every time I do an upgrade. Even a hook in a low level inherited 
  base
  class would be enough, if using the hook would enable the name of 
  the
  helper to be determined and to override the helper. However I reckon
  this is too much to ask!

  John Heenan

  On Feb 17, 11:57 am, villas villa...@gmail.com wrote:

   On Feb 17, 12:07 am, John Heenan johnmhee...@gmail.com wrote:

No reaction to including a four line big productivity booster 
into
web2py!

   Hi John,
   Sorry no one commented!  At least I looked at it, and liked it.  
   But
   Beautify is only a prototyping  testing thing for most so it's 
   making
   something prettier that no one will see. But it's still better, 
   so why
   not? +1
   David

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Combining LEFT OUTER JOIN with COUNTING

2010-02-18 Thread mdipierro
Now sure  try

count = db.dog.id.count()
rows=db().select(db.person.id,db.person.name, count,
left=db.dog.on(db.person.id==db.dog.owner),groupby=db.person.id)
print row.person.name, row[count]

On Feb 18, 7:03 am, aure aureliengir...@googlemail.com wrote:
 Hi,

 I have used the methods given in the web2py manual, in the One to
 Many Relation part, to try and combine a left outer join with
 grouping and counting.  But I did not manage.

 The examples given are:

  rows=db().select(db.person.ALL, db.dog.ALL, 
  left=db.dog.on(db.person.id==db.dog.owner))
  for row in rows:

         print row.person.name, 'has', row.dog.name
 Alex has Skipper
 Alex has Snoopy
 Bob has Puppy
 Carl has None

  count = db.person.id.count()
  for row in db(db.person.id==db.dog.owner).select(db.person.name, count, 
  groupby=db.person.id):

         print row.person.name, row._extra[count]
 Alex 2
 Bob 1

 What should the query be to get such a result:
 Alex 2
 Bob 1
 Carl 0

 Thank you,
 Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: session.flash not displayed anymore

2010-02-18 Thread mdipierro
Usually this problem is caused by double redirect. Try add

session.flash=response.flash

at the top of your controller. This will carry forward the flash. You
do not want this in production but will help you identify the problem.

On Feb 18, 7:20 am, aure aureliengir...@googlemail.com wrote:
 I just figured out that it only happens if I do a redirect to the page
 from which the controller was called.

 It happens like this:
 - A link on a page home is clicked to access a page book but in
 the book controller because some conditions are not met, I set a
 message using session.flash('message') and do a redirect to home. It
 goes to home but no message is displayed.

 On the other hand, if the redirect is set to a page different from
 home, then the message is displayed.

 What should I do? Is the redirect not appropriate in the case we go
 back to the calling page?

 Aurelien

 On Feb 18, 1:54 pm, aure aureliengir...@googlemail.com wrote:

  Hi everyone,

  Does someone have an idea about why session.flash might stop to work
  (is not displayed) for my controllers but keeps on working for login,
  logout,...

  Thank you,
  Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: how to display date and time nicely?

2010-02-18 Thread mdipierro
the one in gluon tools does

prettydate(request.now,T)

On Feb 18, 7:49 am, Iceberg iceb...@21cn.com wrote:
 IMHO, the example's code is good, but not cool enough to be put in the
 book. Every programmer saw those ordinary if...elif...elif...else
 cliche in their first program language book before. People can
 probably write their own if...elif...else in less time, than STFW or
 RTFM to find our prettydate().

 So, we need some extra flavor to compensate the time a guy spent to
 find our prettydate(). How about making it i18n-friendly? Something
 like this.

   class PrettyDate(object):
     def __init__(self,T):
       self.T=T #
     def __call__(self, d):
       dt = datetime.now() - d
       if dt.days = 2*365:
         return self.T('%d years ago') % int(dt.days / 365)
       elif ...:
         ..

 Then, in the model we can initialize an instance by:
   prettydate = PrettyDate(T)
 In controller we can do:
   prettydate(d)
 Of course developers need to localize their own language strings in
 their own environment.

 Just my $0.02

 On Feb16, 1:21pm, Jason Brower encomp...@gmail.com wrote:

  These examples would be a very good edition to the book
  --
  J

  On Mon, 2010-02-15 at 16:19 -0800, mdipierro wrote:
   for lack of a better option I put it in tools for now.

   On Feb 15, 5:56 pm, Richard richar...@gmail.com wrote:
added a few more cases:

def prettydate(d):
    try:
        dt = datetime.now() - d
    except:
        return ''
    if dt.days = 2*365:
        return '%d years ago' % int(dt.days / 365)
    elif dt.days = 365:
        return '1 year ago'
    elif dt.days = 60:
        return '%d months ago' % int(dt.days / 30)
    elif dt.days  21:
        return '1 month ago'
    elif dt.days = 14:
        return '%d weeks ago' % int(dt.days / 7)
    elif dt.days = 7:
        return '1 week ago'
    elif dt.days  1:
        return '%d days ago' % dt.days
    elif dt.days == 1:
        return '1 day ago'
    elif dt.seconds = 2*60*60:
        return '%d hours ago' % int(dt.seconds / 3600)
    elif dt.seconds = 60*60:
        return '1 hour ago'
    elif dt.seconds = 2*60:
        return '%d minutes ago' % int(dt.seconds / 60)
    elif dt.seconds = 60:
        return '1 minute ago'
    elif dt.seconds  1:
        return '%d seconds ago' % dt.seconds
    elif dt.seconds == 1:
        return '1 second ago'
    else:
        return 'now'

 On Feb 14, 3:13 pm, selecta gr...@delarue-berlin.de wrote:

  This is not 100% web2py related but I am sure if this will be 
  answered
  many of you will profit at some point from it.

  Is there a python module that helps you to display dates and times
  nice e.g.

  just now (for within the last 5 minutes)
  2 hours ago
  2 days ago
  15th February 2009
  ...

  I guess somebody must have done that already, right?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Health Record demo app - source code available?

2010-02-18 Thread mdipierro
That is something I made on request of a friend. It is not open source
but contact me privately and I will put you in contact with other
people interested in working on it.

On Feb 18, 2:28 am, BrendanC bren...@gmail.com wrote:
 Just started looking at web2py and it looks quite impressive. I'm
 always interested in finding existing code to review/modify when
 learning a new technology. The video of the Electronic Health Record
 app looks great and is something I might be interested in extending (I
 have a lot of experience with health care apps). Is this a production
 or demo app and is the source code available?

 http://www.vimeo.com/8078872

 TIA
 Brendan

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-18 Thread mdipierro
Can you post your code? Are you doing autocomplete for a reference
field? If so, do you have the validator?

On Feb 18, 2:19 am, ecall edouard.call...@gmail.com wrote:
 I use your photon_torpedo/target sample in welcome application.

 The request ishttp://127.0.0.1:8080/welcome/default/launch(GAE
 1.3.1)

 ERROR    2010-02-18 09:04:36,200 restricted.py:53] In FILE: C:
 \Python25\eclipse\workspace\web2py_1.75.3\applications\welcome/
 controllers/default.py

 Traceback (most recent call last):
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon
 \restricted.py, line 173, in restricted
     exec ccode in environment
   File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
 \welcome/controllers/default.py:launch, line 62, in module
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\globals.py,
 line 96, in lambda
     self._caller = lambda f: f()
   File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
 \welcome/controllers/default.py:launch, line 59, in launch
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
 line 2395, in create
     deletable=False,
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
 line 2333, in update
     upload=self.settings.download_url,
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
 line 675, in __init__
     inp = field.widget(field, default)
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
 line 434, in __call__
     record =
 self.db(self.fields[1]==value).select(self.fields[0]).first()
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
 \gql.py, line 673, in select
     (items, tablename, fields) = self._select(*fields, **attributes)
   File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
 \gql.py, line 636, in _select
     item = self._db[tablename]._tableobj.get_by_id(filter.right)
   File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
 \appengine\ext\db\__init__.py, line 1010, in get_by_id
     return get(keys[0], rpc=rpc)
   File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
 \appengine\ext\db\__init__.py, line 1203, in get
     keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
   File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
 \appengine\api\datastore.py, line 141, in NormalizeAndTypeCheckKeys
     keys = [_GetCompleteKeyOrError(key) for key in keys]
   File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
 \appengine\api\datastore.py, line 2354, in _GetCompleteKeyOrError
     raise datastore_errors.BadKeyError('Key %r is not complete.' %
 key)
 BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
 _app=u'web2py') is not complete.

 INFO     2010-02-18 09:04:36,200 gaehandler.py:55]  Request:
 109.00ms/109.00ms (real time/cpu time)
 INFO     2010-02-18 09:04:36,246 dev_appserver.py:3246] GET /welcome/
 default/launch HTTP/1.1 200 -

 Says 200, but the browser send this:
   Status: 500 INTERNAL SERVER ERROR
   Content-Type: text/html; charset=UTF-8
   web2py_error: ticket welcome/
 127.0.0.1.2010-02-18.08-16-43.e1b0f638-417c-4108-a75b-f809cb1de3ec
   Content-Length: 841

 Thx

 On 18 fév, 00:26, mdipierro mdipie...@cs.depaul.edu wrote:

  I have never seen this error. Can you show the relavant code and the
  complete traceback?

  On Feb 17, 3:58 pm, ecall edouard.call...@gmail.com wrote:

   Thanks for this nice feature.

   How can I make it run with ./dev_appserver.py (development for gae)?

   So far, I have this:
     File /workspace/google_appengine/src/google/appengine/api/
   datastore.py, line 2172, in _GetCompleteKeyOrError
       raise datastore_errors.BadKeyError('Key %r is not complete.' %
   key)
   BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
   _app_id_namespace=u'web2py') is not complete.

   Regards,
   Edouard

   On 6 fév, 21:30, mdipierro mdipie...@cs.depaul.edu wrote:

People say there is some magic in web2py.
Here is some real magic now in trunk that I am sure you have never
seen.

Caveats:
0) requires latest trunk (bzr 1603, hg 175:e42b559254f6)
1) this is an experiment, not sure it is a good idea
2) this is the first function in web2py that REQUIRES jQuery
3) works but I am not yet convinced it should stay there
4) even if it stays, I am sure the API should stay

Example:

### assume this model
db.define_table('target',Field('name'))
if not db(db.target.id0).count():
    db.target.insert(name=Klingon)
    db.target.insert(name=Romulans)
    db.target.insert(name=Borg)
    db.target.insert(name=Borg2)
db.define_table('photon_torpedo',Field('target',db.target))

### assume this action in controller default.py
def launch():
    db.photon_torpedo.target.represent=lambda target: target.name
    return dict(new_torpedo=crud.create(db.photon_torpedo),
                launched_torpedos=db().select(db.photon_torpedo.ALL))

So far 

[web2py] apache prefork

2010-02-18 Thread mdipierro
I have been having memory issues with apache+mod_wsgi+web2py on the
new hosting (256MB). I followed somebody instructions online and and I
did:

apt-get install apache2-mpm-prefork

Any body has any positive or negative experience with this?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: AutocompleteWidget: experimental, magic, RFC

2010-02-18 Thread ecall
The trace come from a fresh (web2py 1.75.3) install. I just add the
magic.

welcome/controllers/default.py :
--
### assume this action in controller default.py
def launch():
db.photon_torpedo.target.represent=lambda target: target.name
return dict(new_torpedo=crud.create(db.photon_torpedo),
launched_torpedos=db().select(db.photon_torpedo.ALL))

welcome/models/db.py :

### assume this model
db.define_table('target',Field('name'))
if not db(db.target.id0).count():
db.target.insert(name=Klingon)
db.target.insert(name=Romulans)
db.target.insert(name=Borg)
db.target.insert(name=Borg2)
db.define_table('photon_torpedo',Field('target',db.target))

from gluon.sqlhtml import AutocompleteWidget
db.photon_torpedo.target.widget=AutocompleteWidget(request,db.target.name,db.target.id)



On 18 fév, 15:29, mdipierro mdipie...@cs.depaul.edu wrote:
 Can you post your code? Are you doing autocomplete for a reference
 field? If so, do you have the validator?

 On Feb 18, 2:19 am, ecall edouard.call...@gmail.com wrote:

  I use your photon_torpedo/target sample in welcome application.

  The request ishttp://127.0.0.1:8080/welcome/default/launch(GAE
  1.3.1)

  ERROR    2010-02-18 09:04:36,200 restricted.py:53] In FILE: C:
  \Python25\eclipse\workspace\web2py_1.75.3\applications\welcome/
  controllers/default.py

  Traceback (most recent call last):
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon
  \restricted.py, line 173, in restricted
      exec ccode in environment
    File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
  \welcome/controllers/default.py:launch, line 62, in module
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\globals.py,
  line 96, in lambda
      self._caller = lambda f: f()
    File C:\Python25\eclipse\workspace\web2py_1.75.3\applications
  \welcome/controllers/default.py:launch, line 59, in launch
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
  line 2395, in create
      deletable=False,
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\tools.py,
  line 2333, in update
      upload=self.settings.download_url,
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
  line 675, in __init__
      inp = field.widget(field, default)
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\sqlhtml.py,
  line 434, in __call__
      record =
  self.db(self.fields[1]==value).select(self.fields[0]).first()
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
  \gql.py, line 673, in select
      (items, tablename, fields) = self._select(*fields, **attributes)
    File C:\Python25\eclipse\workspace\web2py_1.75.3\gluon\contrib
  \gql.py, line 636, in _select
      item = self._db[tablename]._tableobj.get_by_id(filter.right)
    File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
  \appengine\ext\db\__init__.py, line 1010, in get_by_id
      return get(keys[0], rpc=rpc)
    File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
  \appengine\ext\db\__init__.py, line 1203, in get
      keys, multiple = datastore.NormalizeAndTypeCheckKeys(keys)
    File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
  \appengine\api\datastore.py, line 141, in NormalizeAndTypeCheckKeys
      keys = [_GetCompleteKeyOrError(key) for key in keys]
    File C:\Python25\eclipse\workspace\google_appengine_1.3.1\google
  \appengine\api\datastore.py, line 2354, in _GetCompleteKeyOrError
      raise datastore_errors.BadKeyError('Key %r is not complete.' %
  key)
  BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
  _app=u'web2py') is not complete.

  INFO     2010-02-18 09:04:36,200 gaehandler.py:55]  Request:
  109.00ms/109.00ms (real time/cpu time)
  INFO     2010-02-18 09:04:36,246 dev_appserver.py:3246] GET /welcome/
  default/launch HTTP/1.1 200 -

  Says 200, but the browser send this:
    Status: 500 INTERNAL SERVER ERROR
    Content-Type: text/html; charset=UTF-8
    web2py_error: ticket welcome/
  127.0.0.1.2010-02-18.08-16-43.e1b0f638-417c-4108-a75b-f809cb1de3ec
    Content-Length: 841

  Thx

  On 18 fév, 00:26, mdipierro mdipie...@cs.depaul.edu wrote:

   I have never seen this error. Can you show the relavant code and the
   complete traceback?

   On Feb 17, 3:58 pm, ecall edouard.call...@gmail.com wrote:

Thanks for this nice feature.

How can I make it run with ./dev_appserver.py (development for gae)?

So far, I have this:
  File /workspace/google_appengine/src/google/appengine/api/
datastore.py, line 2172, in _GetCompleteKeyOrError
    raise datastore_errors.BadKeyError('Key %r is not complete.' %
key)
BadKeyError: Key datastore_types.Key.from_path(u'target', 0L,
_app_id_namespace=u'web2py') is not complete.

Regards,
Edouard

On 6 fév, 21:30, mdipierro mdipie...@cs.depaul.edu wrote:

 People say there is some magic in web2py.
 Here 

Re: [web2py] Re: they are copying us....

2010-02-18 Thread Timothy Farrell

kodingen uses Bespin at its core.  Try using it in IE and you get this:

http://kodingen.com/_browsehappy.html

On 2/17/2010 1:07 AM, mdipierro wrote:

This is a cool layout and editor. It uses jquery. no syntax
highlighting.

On Feb 17, 12:49 am, Thadeus Burgessthade...@thadeusb.com  wrote:
   

http://kodingen.com/

?? this seems more along the lines.

-Thadeus

On Tue, Feb 16, 2010 at 12:29 PM, mikechmp.ch...@gmail.com  wrote:
 

To quote a saying:
Imitation is the sincerest form of flattery.
   
 

On Feb 16, 6:48 am, mdipierromdipie...@cs.depaul.edu  wrote:
   

sorry was a joke and I did not mean it in a negative ways. I meant to
indicate that if before we were taking inspirations from them now thay
are taking inspirations from us. I think that is a nice project and
perhaps we can learn from it too.
 
 

On Feb 16, 3:25 am, pistacchiopistacc...@gmail.com  wrote:
 
 

hi massimo,
i really appreciate your work on web2py. the product is excellent,
i've just launched my first site using it and other two are on the
work. i like the new documentation (how it's shaping up) and the way
you rule the community around web2py prove that your way is right. i
mean, you do a lot of work and coordinate inputs.
   
 

one thing i really don't understand is your approach to the opensource
philosophy. i already pointed it out weeks ago about the non free, pdf
documentation that is something really sick in a opensource
environment. fortunately i was not the only one thinking this way and,
in the end, the online book is now there and shining.
   
 

now, i think this copying us is utterly out of place. as you stated
somewhere, your sources of inspiration were initially django and
rails. are you copying them? did you make the idea of web framework
by yourself? were you the first one to come out with the mvc pattern?
i don't think so, and this is perfect.
   
 

the opensource community, seen as a whole, not as a series of rival
smaller communities that gather around isolated projects, drains its
power from the openness of the ideas, from making them circulate and
the word copy, with the negative connotation of plagiarize hidden
within it, has nothing to do with this.
the guy may or may be not been inspired by web2py, but if he was, it
is a good thing that web2py did something so valid that other people
want to take inspiration from it. if he ends up writing a piece of
software that is better than the current web2py's online editor, we
can replace it with the new, better one and the circle will be
completed as opening an idea would lead to end up with a better
product. that's the whole point of opensource.
   
 

On Feb 16, 5:57 am, mdipierromdipie...@cs.depaul.edu  wrote:
   
 

http://haineault.com/blog/125/
 
 

P.S. Of course we have 3 years of head start and the web2py
architecture was designed for this, theirs isn't.
 
 

--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group 
athttp://groups.google.com/group/web2py?hl=en.
   
   


--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] apache prefork

2010-02-18 Thread Alexandre Andrade
Well,

I use prefork (non-thread) to allow use php in the same server. Sometimes my
apache stop, I'm not sure why, yet.

While I used only apache2-mpm-worker (and not php), it don't happens

If you will use only web2py,

I recomend use apache2-mpm-worker (multi-thread)



2010/2/18 mdipierro mdipie...@cs.depaul.edu

 I have been having memory issues with apache+mod_wsgi+web2py on the
 new hosting (256MB). I followed somebody instructions online and and I
 did:

 apt-get install apache2-mpm-prefork

 Any body has any positive or negative experience with this?

 --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.




-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: apache prefork

2010-02-18 Thread mdipierro
I am having a problem with apache running out of memory. Not sure if
this is a problem with web2py caching or web2py. Can you provide an
example of how to use ONLY

apache2-mpm-worker

Massimo

On Feb 18, 8:59 am, Alexandre Andrade alexandrema...@gmail.com
wrote:
 Well,

 I use prefork (non-thread) to allow use php in the same server. Sometimes my
 apache stop, I'm not sure why, yet.

 While I used only apache2-mpm-worker (and not php), it don't happens

 If you will use only web2py,

 I recomend use apache2-mpm-worker (multi-thread)

 2010/2/18 mdipierro mdipie...@cs.depaul.edu



  I have been having memory issues with apache+mod_wsgi+web2py on the
  new hosting (256MB). I followed somebody instructions online and and I
  did:

  apt-get install apache2-mpm-prefork

  Any body has any positive or negative experience with this?

  --
  You received this message because you are subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] KPAX documentation

2010-02-18 Thread davidjensen
Please put KPAX documentation on web2py.com. I think a generic CMS is
important for non-technical users.

It would be useful to have one, rather than many (mediawiki, drupal,
plone, etc.). Many complaints on the web about the administrative
problems of these.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How to deploy my first app

2010-02-18 Thread Al
Brian,

Thank you for your detailed instructions. I managed to get stunnel
working, though it is a lot more complicated than I thought
originally. On the windows server, the stunnel.conf file is setup as
server mode and redirect port 8443 to 8000. On the client side, I also
have to set up another stunnel as client mode and redirect
127.0.0.1:80 to 192.168.1.11 - server's IP address. As this server
will be facing public, I cannot expect people to set up stunnel in
their machine in order to access my website. I was expecting a tool
which runs on the server side to do port redirection, and then when I
type in http://server_ip:8443 from another machine, it will route me
to my target app. (note: I did NOT set up any SSL certificate to get
stunnel working)

Also with stunnel, I still cannot access the target app without
entering the admin password, I cannot find any response.menu_auth to
remove.

I also have another mac which I tried to set up stunnel, but when I
run sudo stunnel3 I got the following error:
anyone familiar with mac can give some tips on how to solve this:

inetd mode must define a remote host or an executable



Cheers
Al
On Feb 12, 8:09 am, Brian M bmere...@gmail.com wrote:
 Al,

 You'd want to get rid of the edit  menu when you Go Live that's
 just there as a convenience while you're creating things.  Just use
 this (or remove response.menu_edit from menu.py which does it once 
 for all):
     response.menu_edit = None
 If you don't want auth menu either do
     response.menu_auth = None

 If you want to use the built-in server and be able to access on both
 port 80 and port 443 (SSL) without running two web2py server instances
 you could perhaps use a tunnel program likestunnel(www.stunnel.org).
 Set it up to listen on port 443 (or really any port) and re-direct to
 localhost:80. This way you should be able to get at admin and tickets
 - as far as web2py is concerned you're accessing from the local
 machine so tickets should work, but because it's tunneled it's also
 secured as it goes to your remote computer.

 To get the general user to automatically go tohttp://myserver/myfirstapp
 when they type inhttp://myserver/you can either work with routes or
 just take the lazy route and replace the welcome app's default/index
 with a redirect to whatever the home page of myfirstapp is. Of course
 this will break the welcome app, but do you really want/need it when
 deployed anyway?

 #in the Welcome application's default.py controller
 def index():
     redirect(URL(a='myfirstapp', c='default', f='index'))

 Setting up web2py as a Windows Service is easy 
 enough:http://www.web2py.com/AlterEgo/default/show/77

 ~Brian

 On Feb 11, 9:54 am, Al albertsec...@gmail.com wrote:

  Thank you for your input. I am using Windows server so I cannot use
  the ubuntu scripts you mentioned. How about my second part of the
  question? I understand why web2py is designed in such a secure
  fashion. I am just trying to find a way around it so that I can deploy
  my first app. I theory I should be able to type from any 
  machinehttp://myserver/myfirstapp, but it gives me an internal error - 
  Ticket
  issues. When I click the ticket link, it gives Admin is disabled
  because insecure channel. I have two instances of web2py running. I
  can runhttp://myserver/exampleorhttps://myserver/myfirstappwithout
  any issues. What's so special about the built-in examples app? Do I
  have to cut out some code from my app to get rid of all the admin menu
  and authentication for a general users?

  On Feb 10, 11:38 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   It depends. For development if you use the built in web server you
   need to start it twice for http and https. This is in general a
   security measure. You do not want the same process to listen to two
   sockets else if something happens (like a memory leak) you may get
   locked out.

   In deployment you should be using apache+mod_wsgi

   just download and run 
   this:http://web2py.googlecode.com/hg/scripts/setup-web2py-ubuntu.sh

   It will setup everything for you behind a single apache server.
   I think this easier than rails actually.

   Massimo

   On Feb 10, 9:27 am, Al albertsec...@gmail.com wrote:

Hi,

Now that I get my secure channel (using self-signed certificate)
working, I can remotely login from another computer to access the
admin interface thru https. Todeploythis app for general users for
http access, do I have to run another instance of web2py on another
port - say port 80? Also how do I make these 2  instances to run as a
service in windows 2003 server? Also do I have to change the code so
that the general user just get directly to that single app? This whole
thing seems a lot more complicated than ruby on rails. I would
appreciate if people can explain this in more detail to me or point me
to the right documentations. Thanks.

Cheers
Al

-- 
You received this message because you are 

[web2py] generic views broken?

2010-02-18 Thread mr.freeze
I just downloaded the latest source and now any action in my
controller that doesn't have an explicit view is broken. The request
just hangs and the python process goes to 100% processor usage. If I
define a view for the action, then it works. I am using Windows 7 and
python 2.5 with web2py_src.zip.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: generic views broken?

2010-02-18 Thread mr.freeze
This line in generic.html seems to be causing the problem:

div class=hidden id=responseh2response/
h2{{=BEAUTIFY(response)}}/div

It doesn't look like beautify can handle it properly.

On Feb 18, 11:16 am, mr.freeze nat...@freezable.com wrote:
 I just downloaded the latest source and now any action in my
 controller that doesn't have an explicit view is broken. The request
 just hangs and the python process goes to 100% processor usage. If I
 define a view for the action, then it works. I am using Windows 7 and
 python 2.5 with web2py_src.zip.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] website not working

2010-02-18 Thread Geo
Hi guys!

I've been trying to access the web2py website for the last couple of
days, with very little success. Most of the time I get a The
connection was reset message, and if somehow I get a connection, the
navigation is very slow.

Is there some problem on the server side?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread raven
Well, I gave this a try, and ended up with 404 errors.

fcgihandler.py suggests adding to lighttpd.conf

server.error-handler-404 = '/test.fcgi'

This does not help, nor does

server.error-handler-404 = /error-handler.fcgi

( There no files on my system named *.fcgi, so I do not see how this
could help )

I suspect my problem might be with this line

$HTTP[host] =~ (^|\.)example\.com$ {

Since I am running on a VPS I only have an IP address.

I tried

$HTTP[host] == 100.101.102.103 {

and

$HTTP[remoteip] == 100.101.102.103 {

and

#SERVER[socket] == 100.101.102.103 {

and some other variations on this, but nothing helps.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Long running tasks queue

2010-02-18 Thread Kevin Bowling
Hello,

I have a screen scraper that I would like to call from web2py.  I
currently have a controller method that calls it and updates data in
the DAL.  The problem is, the number of users of this app is growing
quickly.  I need to queue the updates so I don't overwhelm the server
that it is scraping.

I would like a cron script to fire off daily and set the queue in
motion.  I would like to limit the queue to update 5 users or so per
minute.

Any recommendations on attacking this problem?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread mdipierro
Yes.

I am running apache2 and I see this:

www-data  6215  0.0  0.0 130400   164 ?S16:52   0:00 /usr/
sbin/apache2 -k start
www-data  6250  0.0  0.2 130296   608 ?S16:52   0:00 /usr/
sbin/apache2 -k start
www-data  6312  0.0  0.0 130296   128 ?S16:53   0:00 /usr/
sbin/apache2 -k start
www-data  6320 23.7 57.5 695308 151028 ?   Sl   16:54   0:21 /usr/
sbin/apache2 -k start
www-data  6663  0.0  0.2 130296   756 ?S16:55   0:00 /usr/
sbin/apache2 -k start
www-data  6665  0.0  0.2 130296   664 ?S16:55   0:00 /usr/
sbin/apache2 -k start
www-data    0.0  0.2 130296   672 ?S16:55   0:00 /usr/
sbin/apache2 -k start
1000  7070  0.0  0.3   5164   828 pts/0R+   16:55   0:00 grep
apache
root 13264  0.0  0.0 130160   156 ?Ss   15:50   0:00 /usr/
sbin/apache2 -k start

Look at process 6320. It is using way more memory than any other one.
Eventually it will fill the ram. Seems like a memory leak. Only one
process does it. I will it and another process takes his place.
What is going on?

I have never seen this problem before. Looks like a memory leak and
seems related to this:

http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

For now I am following their suggestions and we'll see.

Massimo

On Feb 18, 12:22 pm, Geo ssscript...@gmail.com wrote:
 Hi guys!

 I've been trying to access the web2py website for the last couple of
 days, with very little success. Most of the time I get a The
 connection was reset message, and if somehow I get a connection, the
 navigation is very slow.

 Is there some problem on the server side?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread Kevin Bowling
What OS?  I'm running the old trusty prefork MPM with mod_php+mod_wsgi
without trouble on a 512MB Linode Gentoo VPS and my site is getting
beat up by ycombinator at the moment.  Please post MPM httpd.conf data
as well.

Kevin

On Feb 18, 12:40 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Yes.

 I am running apache2 and I see this:

 www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
 sbin/apache2 -k start
 www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
 sbin/apache2 -k start
 www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data    0.0  0.2 130296   672 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 1000      7070  0.0  0.3   5164   828 pts/0    R+   16:55   0:00 grep
 apache
 root     13264  0.0  0.0 130160   156 ?        Ss   15:50   0:00 /usr/
 sbin/apache2 -k start

 Look at process 6320. It is using way more memory than any other one.
 Eventually it will fill the ram. Seems like a memory leak. Only one
 process does it. I will it and another process takes his place.
 What is going on?

 I have never seen this problem before. Looks like a memory leak and
 seems related to this:

 http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

 For now I am following their suggestions and we'll see.

 Massimo

 On Feb 18, 12:22 pm, Geo ssscript...@gmail.com wrote:

  Hi guys!

  I've been trying to access the web2py website for the last couple of
  days, with very little success. Most of the time I get a The
  connection was reset message, and if somehow I get a connection, the
  navigation is very slow.

  Is there some problem on the server side?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: session.flash not displayed anymore

2010-02-18 Thread aure
Thank you Massimo,

I have tried it but nothing seems to have changed.

Here is what I have:

-
def firstpage():
return dict()

def secondpage():
session.flash=response.flash
session.flash=T('You cannot view the secondpage, you are back to
the firstpage!')
redirect(URL(r=request,f='firstpage'))
return dict()

and in firstpage.html:

{{=A('Link to secondpage',_href=URL(r=request,f='secondpage'))}}

-

The flash message is not displeayed though.
But if I change the redirect to another page, let us say 'pagethree',
then the flash message is displayed when 'pagethree' is displayed..

Aurelien

On Feb 18, 3:21 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 Usually this problem is caused by double redirect. Try add

 session.flash=response.flash

 at the top of your controller. This will carry forward the flash. You
 do not want this in production but will help you identify the problem.

 On Feb 18, 7:20 am, aure aureliengir...@googlemail.com wrote:

  I just figured out that it only happens if I do a redirect to the page
  from which the controller was called.

  It happens like this:
  - A link on a page home is clicked to access a page book but in
  the book controller because some conditions are not met, I set a
  message using session.flash('message') and do a redirect to home. It
  goes to home but no message is displayed.

  On the other hand, if the redirect is set to a page different from
  home, then the message is displayed.

  What should I do? Is the redirect not appropriate in the case we go
  back to the calling page?

  Aurelien

  On Feb 18, 1:54 pm, aure aureliengir...@googlemail.com wrote:

   Hi everyone,

   Does someone have an idea about why session.flash might stop to work
   (is not displayed) for my controllers but keeps on working for login,
   logout,...

   Thank you,
   Aurelien

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: KPAX documentation

2010-02-18 Thread mdipierro
kpax is soo old, it should die. There will be a replacement soon.

On Feb 18, 10:50 am, davidjensen davidjensen...@gmail.com wrote:
 Please put KPAX documentation on web2py.com. I think a generic CMS is
 important for non-technical users.

 It would be useful to have one, rather than many (mediawiki, drupal,
 plone, etc.). Many complaints on the web about the administrative
 problems of these.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread Geo
I'm not very knowledgeable about apache ... so I don't know how to
help on that topic.
But, what do you think about a script which will monitor the
processes's ram consumption and kill them once they go past a certain
limit ( say 150mb ) ?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: KPAX documentation

2010-02-18 Thread JorgeRpo


On Feb 18, 2:57 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 kpax is soo old, it should die. There will be a replacement soon.

 On Feb 18, 10:50 am, davidjensen davidjensen...@gmail.com wrote:

  Please put KPAX documentation on web2py.com. I think a generic CMS is
  important for non-technical users.

  It would be useful to have one, rather than many (mediawiki, drupal,
  plone, etc.). Many complaints on the web about the administrative
  problems of these.

replacement soon?

great news!

can you share some details?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: generic views broken?

2010-02-18 Thread mdipierro
aha this may be the problem of my memory leak! Fixing it in trunk.

Massimo

On Feb 18, 12:04 pm, mr.freeze nat...@freezable.com wrote:
 This line in generic.html seems to be causing the problem:

 div class=hidden id=responseh2response/
 h2{{=BEAUTIFY(response)}}/div

 It doesn't look like beautify can handle it properly.

 On Feb 18, 11:16 am, mr.freeze nat...@freezable.com wrote:

  I just downloaded the latest source and now any action in my
  controller that doesn't have an explicit view is broken. The request
  just hangs and the python process goes to 100% processor usage. If I
  define a view for the action, then it works. I am using Windows 7 and
  python 2.5 with web2py_src.zip.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Long running tasks queue

2010-02-18 Thread mdipierro
I would run a separate process

web2py.py -S yourapp -M -R yourscript.py

On Feb 18, 1:31 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:
 Hello,

 I have a screen scraper that I would like to call from web2py.  I
 currently have a controller method that calls it and updates data in
 the DAL.  The problem is, the number of users of this app is growing
 quickly.  I need to queue the updates so I don't overwhelm the server
 that it is scraping.

 I would like a cron script to fire off daily and set the queue in
 motion.  I would like to limit the queue to update 5 users or so per
 minute.

 Any recommendations on attacking this problem?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Long running tasks queue

2010-02-18 Thread Kevin Bowling
I like this, I can simply insert sleep statements to keep it from
being to aggressive with this approach.

Would this be best in system cron?

On Feb 18, 1:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I would run a separate process

 web2py.py -S yourapp -M -R yourscript.py

 On Feb 18, 1:31 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:

  Hello,

  I have a screen scraper that I would like to call from web2py.  I
  currently have a controller method that calls it and updates data in
  the DAL.  The problem is, the number of users of this app is growing
  quickly.  I need to queue the updates so I don't overwhelm the server
  that it is scraping.

  I would like a cron script to fire off daily and set the queue in
  motion.  I would like to limit the queue to update 5 users or so per
  minute.

  Any recommendations on attacking this problem?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: generic views broken?

2010-02-18 Thread mr.freeze
Is it still called trunk with hg? :) Let me know when to test.

On Feb 18, 2:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 aha this may be the problem of my memory leak! Fixing it in trunk.

 Massimo

 On Feb 18, 12:04 pm, mr.freeze nat...@freezable.com wrote:

  This line in generic.html seems to be causing the problem:

  div class=hidden id=responseh2response/
  h2{{=BEAUTIFY(response)}}/div

  It doesn't look like beautify can handle it properly.

  On Feb 18, 11:16 am, mr.freeze nat...@freezable.com wrote:

   I just downloaded the latest source and now any action in my
   controller that doesn't have an explicit view is broken. The request
   just hangs and the python process goes to 100% processor usage. If I
   define a view for the action, then it works. I am using Windows 7 and
   python 2.5 with web2py_src.zip.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: generic views broken?

2010-02-18 Thread mdipierro
You should find 1.75.4 in trunk.

On Feb 18, 2:52 pm, mr.freeze nat...@freezable.com wrote:
 Is it still called trunk with hg? :) Let me know when to test.

 On Feb 18, 2:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  aha this may be the problem of my memory leak! Fixing it in trunk.

  Massimo

  On Feb 18, 12:04 pm, mr.freeze nat...@freezable.com wrote:

   This line in generic.html seems to be causing the problem:

   div class=hidden id=responseh2response/
   h2{{=BEAUTIFY(response)}}/div

   It doesn't look like beautify can handle it properly.

   On Feb 18, 11:16 am, mr.freeze nat...@freezable.com wrote:

I just downloaded the latest source and now any action in my
controller that doesn't have an explicit view is broken. The request
just hangs and the python process goes to 100% processor usage. If I
define a view for the action, then it works. I am using Windows 7 and
python 2.5 with web2py_src.zip.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
Where does this go:

Model.all().filter('ngrams =', word).filter('ngrams ', word +
 u'\ufffd')

in the call.  Where inside:

rows=db(here??).select(here??)

I've tried several things.  gae keeps giving me filter or all KeyError.

-wes

On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com wrote:
 sounds like this will be useful.

 StringListProperty is a native gae type now supported by web2py:
 http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringListProperty
 http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa488e855

 To get around the like problem you can do something like this:
 Model.all().filter('ngrams =', word).filter('ngrams ', word +
 u'\ufffd')

 Check out Thadeus's code for a full example.

 There's also info how to do this in the docs:
 http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Introducing_Indexes

 Richard


 On Feb 14, 1:52 pm, Wes James compte...@gmail.com wrote:
 Richard,

 Do you have a python example of this?  I'll check on
 StringListProperty also and see how it works. (would this work on
 gae?) I was trying somthing else since like is not supported, but this
 might work.  I would like this site to provide quick search on
 anything that would be helpful in building a web2py app.  There are a
 lot of things in tools.py that could go here for instance, and maybe
 another page with docstrings?  Whatever anyone thinks would be
 helpful.

 -wes



 On Sat, Feb 13, 2010 at 4:26 PM, Richard richar...@gmail.com wrote:
  hi wes,

  something like this could be really nice for browsing the function
  docstrings. Do you intend to take it further?

  If you use a StringListProperty to store all the ngrams (eg: web2py,
  web2p, web2, web, we, w) then it could match partial words.

  Richard

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: generic views broken?

2010-02-18 Thread mr.freeze
Money. Works now.

On Feb 18, 2:58 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 You should find 1.75.4 in trunk.

 On Feb 18, 2:52 pm, mr.freeze nat...@freezable.com wrote:

  Is it still called trunk with hg? :) Let me know when to test.

  On Feb 18, 2:30 pm, mdipierro mdipie...@cs.depaul.edu wrote:

   aha this may be the problem of my memory leak! Fixing it in trunk.

   Massimo

   On Feb 18, 12:04 pm, mr.freeze nat...@freezable.com wrote:

This line in generic.html seems to be causing the problem:

div class=hidden id=responseh2response/
h2{{=BEAUTIFY(response)}}/div

It doesn't look like beautify can handle it properly.

On Feb 18, 11:16 am, mr.freeze nat...@freezable.com wrote:

 I just downloaded the latest source and now any action in my
 controller that doesn't have an explicit view is broken. The request
 just hangs and the python process goes to 100% processor usage. If I
 define a view for the action, then it works. I am using Windows 7 and
 python 2.5 with web2py_src.zip.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Long running tasks queue

2010-02-18 Thread mdipierro
I would not use cron for this. cron starts a job at reguar intervals
but in background processing you do know that the previous task was
completed. I would just make a loop that extract a todo task from
database queue and sleeps if not task.

You can use  cron @reboot to make sure this one task starts with the
app.

On Feb 18, 2:35 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:
 I like this, I can simply insert sleep statements to keep it from
 being to aggressive with this approach.

 Would this be best in system cron?

 On Feb 18, 1:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I would run a separate process

  web2py.py -S yourapp -M -R yourscript.py

  On Feb 18, 1:31 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:

   Hello,

   I have a screen scraper that I would like to call from web2py.  I
   currently have a controller method that calls it and updates data in
   the DAL.  The problem is, the number of users of this app is growing
   quickly.  I need to queue the updates so I don't overwhelm the server
   that it is scraping.

   I would like a cron script to fire off daily and set the queue in
   motion.  I would like to limit the queue to update 5 users or so per
   minute.

   Any recommendations on attacking this problem?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] 1.75.3 BADLY BORKEN - MUST UPGRADE TO 1.75.4

2010-02-18 Thread mdipierro
I posted 1.75.3 yesterday but I introduced a major but in BEAUTIFY
(only in 1.75.3). It caused an infinite loop that consumes memory.
This happens in all pages that call beautify, i.e. welcome index page
and pages without an explicit view.

You must upgrade to 1.75.4.

Massimo

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: apache prefork

2010-02-18 Thread Thadeus Burgess
look at my slice on web2pyslices about this. It uses mpm-worker only.

-Thadeus





On Thu, Feb 18, 2010 at 10:01 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 I am having a problem with apache running out of memory. Not sure if
 this is a problem with web2py caching or web2py. Can you provide an
 example of how to use ONLY

 apache2-mpm-worker

 Massimo

 On Feb 18, 8:59 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
 Well,

 I use prefork (non-thread) to allow use php in the same server. Sometimes my
 apache stop, I'm not sure why, yet.

 While I used only apache2-mpm-worker (and not php), it don't happens

 If you will use only web2py,

 I recomend use apache2-mpm-worker (multi-thread)

 2010/2/18 mdipierro mdipie...@cs.depaul.edu



  I have been having memory issues with apache+mod_wsgi+web2py on the
  new hosting (256MB). I followed somebody instructions online and and I
  did:

  apt-get install apache2-mpm-prefork

  Any body has any positive or negative experience with this?

  --
  You received this message because you are subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread Graham Dumpleton


On Feb 19, 6:40 am, mdipierro mdipie...@cs.depaul.edu wrote:
 Yes.

 I am running apache2 and I see this:

 www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
 sbin/apache2 -k start
 www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
 sbin/apache2 -k start
 www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data    0.0  0.2 130296   672 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 1000      7070  0.0  0.3   5164   828 pts/0    R+   16:55   0:00 grep
 apache
 root     13264  0.0  0.0 130160   156 ?        Ss   15:50   0:00 /usr/
 sbin/apache2 -k start

 Look at process 6320. It is using way more memory than any other one.
 Eventually it will fill the ram. Seems like a memory leak. Only one
 process does it. I will it and another process takes his place.
 What is going on?

 I have never seen this problem before. Looks like a memory leak and
 seems related to this:

 http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

Likely unrelated because for you it is affecting only one process.

 For now I am following their suggestions and we'll see.

Presuming you are now running mod_wsgi, post your Apache configuration
snippet for how you set mod_wsgi up.

Specifically, confirm that you are using daemon mode? Also indicate
which version of mod_wsgi you are using.

If you have an incremental memory growth problem because of web2py,
there are various things one can do in mod_wsgi daemon mode
configuration to combat the issue until you work out the real cause.

So long as you are using daemon mode, that you are using prefork MPM
is not a big deal.

Graham

 Massimo

 On Feb 18, 12:22 pm, Geo ssscript...@gmail.com wrote:



  Hi guys!

  I've been trying to access the web2py website for the last couple of
  days, with very little success. Most of the time I get a The
  connection was reset message, and if somehow I get a connection, the
  navigation is very slow.

  Is there some problem on the server side?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: apache prefork

2010-02-18 Thread Thadeus Burgess
actually, i am wrong, it is using mpm-prefork

-Thadeus





On Thu, Feb 18, 2010 at 3:55 PM, Thadeus Burgess thade...@thadeusb.com wrote:
 look at my slice on web2pyslices about this. It uses mpm-worker only.

 -Thadeus





 On Thu, Feb 18, 2010 at 10:01 AM, mdipierro mdipie...@cs.depaul.edu wrote:
 I am having a problem with apache running out of memory. Not sure if
 this is a problem with web2py caching or web2py. Can you provide an
 example of how to use ONLY

 apache2-mpm-worker

 Massimo

 On Feb 18, 8:59 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
 Well,

 I use prefork (non-thread) to allow use php in the same server. Sometimes my
 apache stop, I'm not sure why, yet.

 While I used only apache2-mpm-worker (and not php), it don't happens

 If you will use only web2py,

 I recomend use apache2-mpm-worker (multi-thread)

 2010/2/18 mdipierro mdipie...@cs.depaul.edu



  I have been having memory issues with apache+mod_wsgi+web2py on the
  new hosting (256MB). I followed somebody instructions online and and I
  did:

  apt-get install apache2-mpm-prefork

  Any body has any positive or negative experience with this?

  --
  You received this message because you are subscribed to the Google Groups
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to
  web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
  .
  For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.

 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: routes for subdomain

2010-02-18 Thread Wikus van de Merwe
Jon, you right. If the example.com and all *.example.com prefixed
domains are mapped to the same web2py app it shouldn't really matter
if the host is rewritten. But then you have to be careful and don't
use relative urls when linking between the prefixed and non-
prefixed parts.

The rules I proposed are still a bit incorrect, as the case of not
default/public and not prefixed controllers is not handled correctly.
And the proper out routing is only possible when all prefixes are
explicitly enlisted. Here is the doctest with extended rules:
http://pastebin.com/f3969be47.

PREFIXES = [dashboard, forum, tracker]

routes_in = (('.*:https?://([a-z]+)\.example\.com:.* /(.*)', r'/init/
\1/\2'),
 ('/([a-z]+)/(.*)', r'/init/\1/\2'),
 ('/(.*)', r'/init/public/\1'))

routes_out = (('/init/public/(.*)', r'/\1'),
  ('/init/('+'|'.join(PREFIXES)+')/(.*)', r'/\2'),
  ('/init/(.*)', r'/\1'))

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Limiting to a single process

2010-02-18 Thread Michael Toomim
I'm running a background database processing task, and I only want to
have ONE task running so I don't have to worry about race conditions.
What is the best way to do this?

I run this task from a cron @reboot. It runs this script:

while True:
time.sleep(10)
process_queue()

I'm worried that I might accidentally run two web2py processes at the
same time, each starting a cron job, and then I'd have two running and
mess up my data. So I want this script to check to see if another one
is currently running, and if so, to give up.

I considered making an entry in a database like
background_task_running = true, but how can I guarantee that it gets
set to false if my web2py crashes? I don't want to have to manually
reset that field all the time.

Is it best to see if this process is currently running on the machine,
with os.system('ps aux | grep background_work.py'), but this isn't
cross-platform, and won't work if the process is running on another
machine. Is there a way to check if another of these processes is
connected to the postgresql database?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
I can't find any examples of web2py and gae select with
StringListProperty.  Where did you find the example below?  I've
looked in the web2py list emails, but I can't see any other working
examples.

How do you do this with web2py

pseudo code:

form(_query)

def aview
query=request.vars._query

#how do you do this part with stringlistproperty/gae
rows=db(??).select(??)

thx,

-wes

On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com wrote:
 sounds like this will be useful.

 StringListProperty is a native gae type now supported by web2py:
 http://code.google.com/appengine/docs/python/datastore/typesandpropertyclasses.html#StringListProperty
 http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa488e855

 To get around the like problem you can do something like this:
 Model.all().filter('ngrams =', word).filter('ngrams ', word +
 u'\ufffd')

 Check out Thadeus's code for a full example.

 There's also info how to do this in the docs:
 http://code.google.com/appengine/docs/python/datastore/queriesandindexes.html#Introducing_Indexes

 Richard


 On Feb 14, 1:52 pm, Wes James compte...@gmail.com wrote:
 Richard,

 Do you have a python example of this?  I'll check on
 StringListProperty also and see how it works. (would this work on
 gae?) I was trying somthing else since like is not supported, but this
 might work.  I would like this site to provide quick search on
 anything that would be helpful in building a web2py app.  There are a
 lot of things in tools.py that could go here for instance, and maybe
 another page with docstrings?  Whatever anyone thinks would be
 helpful.

 -wes



 On Sat, Feb 13, 2010 at 4:26 PM, Richard richar...@gmail.com wrote:
  hi wes,

  something like this could be really nice for browsing the function
  docstrings. Do you intend to take it further?

  If you use a StringListProperty to store all the ngrams (eg: web2py,
  web2p, web2, web, we, w) then it could match partial words.

  Richard

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] gae.StringListProperty

2010-02-18 Thread Wes James
I was looking in gql.py too see how StringListProperty is used. I
didn't see it there.  Where is it in web2py code?

-wes

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: apache prefork

2010-02-18 Thread Alexandre Andrade
really, your script setup-web2py-ubuntu.sh install apache2-mpm-worker.

if you want change, just

# apt-get install apache2-mpm-worker

it will replace apache2-mpm-prefork.



2010/2/18 mdipierro mdipie...@cs.depaul.edu

 I am having a problem with apache running out of memory. Not sure if
 this is a problem with web2py caching or web2py. Can you provide an
 example of how to use ONLY

 apache2-mpm-worker

 Massimo

 On Feb 18, 8:59 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  Well,
 
  I use prefork (non-thread) to allow use php in the same server. Sometimes
 my
  apache stop, I'm not sure why, yet.
 
  While I used only apache2-mpm-worker (and not php), it don't happens
 
  If you will use only web2py,
 
  I recomend use apache2-mpm-worker (multi-thread)
 
  2010/2/18 mdipierro mdipie...@cs.depaul.edu
 
 
 
   I have been having memory issues with apache+mod_wsgi+web2py on the
   new hosting (256MB). I followed somebody instructions online and and I
   did:
 
   apt-get install apache2-mpm-prefork
 
   Any body has any positive or negative experience with this?
 
   --
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
  --
  Atenciosamente
 
  --
  =
  Alexandre Andrade
  Hipercenter.com

 --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.




-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread mdipierro
My setup is exactly the one generated by this file

http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ubuntu.sh

I did apt-get install mod-mpm-prefork

I do not know which mod_wsgi I have. How how I check? Id just did apt-
get install mod_wsgi on ubuntu 8.04.

Now that fixed the BEAUTIFY but the problem is no longer as severe as
before but I do see one process (the multi-threaded one) consume more
memory than everything else.

Massimo

On Feb 18, 4:11 pm, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 On Feb 19, 6:40 am, mdipierro mdipie...@cs.depaul.edu wrote:



  Yes.

  I am running apache2 and I see this:

  www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
  sbin/apache2 -k start
  www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
  sbin/apache2 -k start
  www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
  sbin/apache2 -k start
  www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
  sbin/apache2 -k start
  www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
  sbin/apache2 -k start
  www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
  sbin/apache2 -k start
  www-data    0.0  0.2 130296   672 ?        S    16:55   0:00 /usr/
  sbin/apache2 -k start
  1000      7070  0.0  0.3   5164   828 pts/0    R+   16:55   0:00 grep
  apache
  root     13264  0.0  0.0 130160   156 ?        Ss   15:50   0:00 /usr/
  sbin/apache2 -k start

  Look at process 6320. It is using way more memory than any other one.
  Eventually it will fill the ram. Seems like a memory leak. Only one
  process does it. I will it and another process takes his place.
  What is going on?

  I have never seen this problem before. Looks like a memory leak and
  seems related to this:

 http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

 Likely unrelated because for you it is affecting only one process.

  For now I am following their suggestions and we'll see.

 Presuming you are now running mod_wsgi, post your Apache configuration
 snippet for how you set mod_wsgi up.

 Specifically, confirm that you are using daemon mode? Also indicate
 which version of mod_wsgi you are using.

 If you have an incremental memory growth problem because of web2py,
 there are various things one can do in mod_wsgi daemon mode
 configuration to combat the issue until you work out the real cause.

 So long as you are using daemon mode, that you are using prefork MPM
 is not a big deal.

 Graham

  Massimo

  On Feb 18, 12:22 pm, Geo ssscript...@gmail.com wrote:

   Hi guys!

   I've been trying to access the web2py website for the last couple of
   days, with very little success. Most of the time I get a The
   connection was reset message, and if somehow I get a connection, the
   navigation is very slow.

   Is there some problem on the server side?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: apache prefork

2010-02-18 Thread Alexandre Andrade
from description of apache2-mpm-worker package:

The worker MPM provides the default threaded implementation. It is
recommended especially for high-traffic sites because it is faster
and has a smaller memory footprint than the traditional prefork MPM.


2010/2/18 Alexandre Andrade alexandrema...@gmail.com

 really, your script setup-web2py-ubuntu.sh install apache2-mpm-worker.

 if you want change, just

 # apt-get install apache2-mpm-worker

 it will replace apache2-mpm-prefork.



 2010/2/18 mdipierro mdipie...@cs.depaul.edu

 I am having a problem with apache running out of memory. Not sure if

 this is a problem with web2py caching or web2py. Can you provide an
 example of how to use ONLY

 apache2-mpm-worker

 Massimo

 On Feb 18, 8:59 am, Alexandre Andrade alexandrema...@gmail.com
 wrote:
  Well,
 
  I use prefork (non-thread) to allow use php in the same server.
 Sometimes my
  apache stop, I'm not sure why, yet.
 
  While I used only apache2-mpm-worker (and not php), it don't happens
 
  If you will use only web2py,
 
  I recomend use apache2-mpm-worker (multi-thread)
 
  2010/2/18 mdipierro mdipie...@cs.depaul.edu
 
 
 
   I have been having memory issues with apache+mod_wsgi+web2py on the
   new hosting (256MB). I followed somebody instructions online and and I
   did:
 
   apt-get install apache2-mpm-prefork
 
   Any body has any positive or negative experience with this?
 
   --
   You received this message because you are subscribed to the Google
 Groups
   web2py-users group.
   To post to this group, send email to web...@googlegroups.com.
   To unsubscribe from this group, send email to
   web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 web2py%2bunsubscr...@googlegroups.comweb2py%252bunsubscr...@googlegroups.com
 
   .
   For more options, visit this group at
  http://groups.google.com/group/web2py?hl=en.
 
  --
  Atenciosamente
 
  --
  =
  Alexandre Andrade
  Hipercenter.com

 --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.comweb2py%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.




 --
 Atenciosamente

 --
 =
 Alexandre Andrade
 Hipercenter.com




-- 
Atenciosamente

-- 
=
Alexandre Andrade
Hipercenter.com

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Limiting to a single process

2010-02-18 Thread mdipierro


On Feb 18, 5:13 pm, Michael Toomim too...@gmail.com wrote:
 I'm running a background database processing task, and I only want to
 have ONE task running so I don't have to worry about race conditions.
 What is the best way to do this?

 I run this task from a cron @reboot. It runs this script:

 while True:
     time.sleep(10)
     process_queue()

 I'm worried that I might accidentally run two web2py processes at the
 same time, each starting a cron job, and then I'd have two running and
 mess up my data. So I want this script to check to see if another one
 is currently running, and if so, to give up.

 I considered making an entry in a database like
 background_task_running = true, but how can I guarantee that it gets
 set to false if my web2py crashes? I don't want to have to manually
 reset that field all the time.

 Is it best to see if this process is currently running on the machine,
 with os.system('ps aux | grep background_work.py'), but this isn't
 cross-platform, and won't work if the process is running on another
 machine. Is there a way to check if another of these processes is
 connected to the postgresql database?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Limiting to a single process

2010-02-18 Thread mdipierro
I would use a file and lock the file when the process is running. You
can check if the file is locked. When the process ends the file will
be automatically unlocked.

On Feb 18, 5:13 pm, Michael Toomim too...@gmail.com wrote:
 I'm running a background database processing task, and I only want to
 have ONE task running so I don't have to worry about race conditions.
 What is the best way to do this?

 I run this task from a cron @reboot. It runs this script:

 while True:
     time.sleep(10)
     process_queue()

 I'm worried that I might accidentally run two web2py processes at the
 same time, each starting a cron job, and then I'd have two running and
 mess up my data. So I want this script to check to see if another one
 is currently running, and if so, to give up.

 I considered making an entry in a database like
 background_task_running = true, but how can I guarantee that it gets
 set to false if my web2py crashes? I don't want to have to manually
 reset that field all the time.

 Is it best to see if this process is currently running on the machine,
 with os.system('ps aux | grep background_work.py'), but this isn't
 cross-platform, and won't work if the process is running on another
 machine. Is there a way to check if another of these processes is
 connected to the postgresql database?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: first gae app

2010-02-18 Thread mdipierro
db(db.table.slp=='value').select() checks that 'value' is in the slp

db(db.table.slp'value').select() checks that at least one element is
less than 'value'

db(db.table.slp'value').select() checks that at least one element if
greater then 'value'

slp is the name of your field of type StringListProperty. The selected
field will be a list.


On Feb 18, 5:23 pm, Wes James compte...@gmail.com wrote:
 I can't find any examples of web2py and gae select with
 StringListProperty.  Where did you find the example below?  I've
 looked in the web2py list emails, but I can't see any other working
 examples.

 How do you do this with web2py

 pseudo code:

 form(_query)

 def aview
     query=request.vars._query

     #how do you do this part with stringlistproperty/gae
     rows=db(??).select(??)

 thx,

 -wes

 On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com wrote:
  sounds like this will be useful.

  StringListProperty is a native gae type now supported by web2py:
 http://code.google.com/appengine/docs/python/datastore/typesandproper...
 http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa4...

  To get around the like problem you can do something like this:
  Model.all().filter('ngrams =', word).filter('ngrams ', word +
  u'\ufffd')

  Check out Thadeus's code for a full example.

  There's also info how to do this in the docs:
 http://code.google.com/appengine/docs/python/datastore/queriesandinde...

  Richard

  On Feb 14, 1:52 pm, Wes James compte...@gmail.com wrote:
  Richard,

  Do you have a python example of this?  I'll check on
  StringListProperty also and see how it works. (would this work on
  gae?) I was trying somthing else since like is not supported, but this
  might work.  I would like this site to provide quick search on
  anything that would be helpful in building a web2py app.  There are a
  lot of things in tools.py that could go here for instance, and maybe
  another page with docstrings?  Whatever anyone thinks would be
  helpful.

  -wes

  On Sat, Feb 13, 2010 at 4:26 PM, Richard richar...@gmail.com wrote:
   hi wes,

   something like this could be really nice for browsing the function
   docstrings. Do you intend to take it further?

   If you use a StringListProperty to store all the ngrams (eg: web2py,
   web2p, web2, web, we, w) then it could match partial words.

   Richard

  --
  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] gae lib

2010-02-18 Thread Wes James
Hmm.  I see:

from google.appengine.ext import db as gae

in gql.py

but if I run python from the cli and do:

from google.appengine.ext import db as gae

I get Import Error.

Where is web2py getting this from?  I looked in web2py,
/System/Library (mac) and /usr/local

I'm not sure that would help with web2py gae select syntax though, would it?

-wes

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread John Heenan
Hi Raven

The name fcgihandler.py is just the name of a web2py start up file
passed to Python.

The name fcgihandler.py should not or need not appear anywhere in the
lightttpd.conf file, since there is no need to give lighttpd the
responsibility to start up web2py as an independent process.

What lighttpd needs to know is where the UNIX socket is that is
configured for use by web2py in fcgihandler.py. The name that
ligthttpd.conf uses to tell the rest of lighttpd.conf to use the UNIX
soscket is an arbitrary name. The suffix .fcgi does not need to appear
anywhere in lighttpd.conf, it is just a convention.

Maybe I should provide a link to a complete lighttpd.conf file in
http://www.web2pyslices.com/main/slices/take_slice/57

It might be difficult to escape from an attitude that web servers are
essentially used as dumb pipes by Python frameworks and as such need
to stay 'out of the way' with minimal involvement.

John Heenan


On Feb 19, 5:10 am, raven ravenspo...@yahoo.com wrote:
 Well, I gave this a try, and ended up with 404 errors.

 fcgihandler.py suggests adding to lighttpd.conf

 server.error-handler-404 = '/test.fcgi'

 This does not help, nor does

 server.error-handler-404 = /error-handler.fcgi

 ( There no files on my system named *.fcgi, so I do not see how this
 could help )

 I suspect my problem might be with this line

 $HTTP[host] =~ (^|\.)example\.com$ {

 Since I am running on a VPS I only have an IP address.

 I tried

 $HTTP[host] == 100.101.102.103 {

 and

 $HTTP[remoteip] == 100.101.102.103 {

 and

 #SERVER[socket] == 100.101.102.103 {

 and some other variations on this, but nothing helps.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Difficulty with a form

2010-02-18 Thread waTR
I have created a form using SQLForm. I am using a db query to select a
single row from a db table, and I want to make changes to it. However,
when I submit, some of the data disapears in the submit. This happens
to also prevent the form from submitting as that data that disapears
is very important.

Here is what I have:

DB table company with fields name and title
DB table user with fields name and title, and a foreign key of
company id

When I use SQLForm(db.user, session.currentUserID) and submit this
form, the company_id field is null, even though before I submitted the
field in the DB has a 2 in it.  Note that I have not actually
generated the field in a view. So I imagine that any field that is not
in the view is submitted as NULL. Is this a bug?  I believe any field
that you don't use in a view should just be re-submitted with the same
data that was in the field before. Whats going on here? Why does the
field go empty?

Is there a way to manually set a value to the field before it submits?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] apache prefork

2010-02-18 Thread Alex Fanjul
It comes to my mind, the Graham vs John discussion about: How much 
memory does web2py need on Unix.
By the way, I saw a Slice 2 days agou about using just 34MB memory for 
web2py in linux.


Alex F

El 18/02/2010 15:39, mdipierro escribió:

I have been having memory issues with apache+mod_wsgi+web2py on the
new hosting (256MB). I followed somebody instructions online and and I
did:

apt-get install apache2-mpm-prefork

Any body has any positive or negative experience with this?

   


--
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread Alex Fanjul
I was reviewing this threadand wow! very nice explanation and 
presentation of playing video streaming via web2py.

Many thanks John, your thoughts looks like very interesting.
Alex

El 14/02/2010 3:12, John Heenan escribió:

Thanks for your comments also.

Yes .flv and other video files will play with Lightttpd using normal
media players, for example, using JW Player in kpax/static/
mediaplayer.swf . It is even possible to use players while the actual
video file is hosted on another server to where the main site and
player is hosted. It is really more of a browser issue unless seek
based streaming is desired.

The video files I host on http://www.zgus.com are on Amazon S3 servers
because the traffic costs are lower this way and because VPS disk
space usage is kept lower. In fact, as mentioned in
http://groups.google.com/group/web2py/msg/e273fa31c779c44c ,  I think
it would be a good idea to allow large uploaded files to automatically
transferred across to other servers. Keeping large files on otherg
severs is the 'enterprise way'. There is mature python infrastructure,
s3cmd, to allow file transfer to Amazon S3 servers, as indicated in
the link.

There is another meaning for streaming which basically means being
able to seek anywhere into the video file without downloading the
entire file into the browser cache. Lighttpd supports this type of
streaming 'out of the box'. Apache does not. YouTube uses Lighttpd and
supports this type of streaming (provided the video file has the
necessary meta data).

Having a web server that supports seek based streaming is not enough.
For this type of streaming a compliant media player is required and
video files need to have meta data installed. There is a coherent
presentation on this type of streaming, on what needs to be done to
video files and a video example at 
http://flowplayer.org/plugins/streaming/pseudostreaming.html

John Heenan

On Feb 14, 1:44 am, mdipierromdipie...@cs.depaul.edu  wrote:
   

Very well done.

Did you ever try streaming files with lighttpd? For example serving
via download a large video file, larger than ram? (kpax comes with an
example of streaming). Does it work well?

Massimo

On Feb 13, 1:42 am, John Heenanjohnmhee...@gmail.com  wrote:

 

As requested I have placed a howto on web2pysplices 
athttp://www.web2pyslices.com/main/slices/take_slice/57
   
 

I have written a considerable preface to clarify issues and to
indicate why we should pay attention to issues concerned with keeping
memory use low.
   
 

John Heenan
   
 

On Feb 13, 2:41 am, mdipierromdipie...@cs.depaul.edu  wrote:
   
 

I think this is an excellent point.
 
 

My data demonstrated a 40MB memory solution is feasible.
   
 

I am absolutely amazed and disappointed I cannot get such simple
points gracefully acknowledged by a self styled 'expert' and by the
moderator.
   
 

The reason I suggested opening a new thread was to eliminate the
digression.
Would you write a short howto on web2pyslices on how to achieve this
small memory footprint?
Eventually it could become a section in the book.
 
 

Massimo
 
   


--
Alejandro Fanjul Fdez.
alex.fan...@gmail.com
www.mhproject.org

--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Difficulty with a form

2010-02-18 Thread waTR
Also, I couldn't find a link to the epydocs ?  Where did that go?  It
was really great!



On Feb 18, 3:49 pm, waTR r...@devshell.org wrote:
 I have created a form using SQLForm. I am using a db query to select a
 single row from a db table, and I want to make changes to it. However,
 when I submit, some of the data disapears in the submit. This happens
 to also prevent the form from submitting as that data that disapears
 is very important.

 Here is what I have:

 DB table company with fields name and title
 DB table user with fields name and title, and a foreign key of
 company id

 When I use SQLForm(db.user, session.currentUserID) and submit this
 form, the company_id field is null, even though before I submitted the
 field in the DB has a 2 in it.  Note that I have not actually
 generated the field in a view. So I imagine that any field that is not
 in the view is submitted as NULL. Is this a bug?  I believe any field
 that you don't use in a view should just be re-submitted with the same
 data that was in the field before. Whats going on here? Why does the
 field go empty?

 Is there a way to manually set a value to the field before it submits?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread Graham Dumpleton


On Feb 19, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote:
 My setup is exactly the one generated by this file

 http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ub...

 I did apt-get install mod-mpm-prefork

 I do not know which mod_wsgi I have. How how I check? Id just did apt-
 get install mod_wsgi on ubuntu 8.04.

Ubuntu still has a quite old mod_wsgi version in the main repository,
possibly even on mod_wsgi 1.X given you are using ancient ubuntu 8.04.
The latest mod_wsgi version is 3.1 and if can you should use that.

If you weren't using an ancient version of mod_wsgi I would have
suggested you change the configuration line:

  WSGIDaemonProcess web2py user=www-data group=www-data

to:

  WSGIDaemonProcess web2py user=www-data group=www-data display-name=%
{GROUP} maximum-requests=5000 inactivity-timeout=60

The 'display-name' option with that value will cause the process to be
listed in 'ps' output as '(wsgi:web2py)'. That way is easier to
identify separately from core Apache server processes. This option was
only added in mod_wsgi 2.0.

The 'maxiumum-requests' option would cause daemon process to be
shutdown and restarted after 5000 requests. That way if you do have a
problem with cache cleaning or Python object reference counting cycles
which cant be broken by the Python garbage collector, then you at
least throw everything away and start over again every so often.

The 'inactivity-timeout' option is another way of forcing a process
shutdown and restart to reclaim memory and start over. In this case if
no requests are received in 60 seconds since the last request and so
application is idle, it will shutdown and restart the process. This
option was only added in mod_wsgi 2.0.

To check which version of mod_wsgi is running you can look at the
startup messages for Apache, presuming ubuntu hasn't hacked the
startup message to disable display of Apache module information. The
message will be of the form:

  Apache/2.2.2 (Unix) mod_wsgi/1.0 Python/2.3.5 configured

If you can't find that in main Apache error log from time when Apache
last restarted, then you will need to work out which version is
installed from the ubuntu packaging system.

 Now that fixed the BEAUTIFY but the problem is no longer as severe as
 before but I do see one process (the multi-threaded one) consume more
 memory than everything else.

Which is the mod_wsgi daemon process which holds the web2py instance.
It will obviously be bigger, but if it keeps growing then you likely
have an issue with the application. There has never been any issue
with mod_wsgi which would see such memory growth.

If you were using mod_wsgi 2.X (preferably 2.5 or later), then those
options to WSGIDaemonProcess would at least allow it to recover itself
whil you sort out what the real problem is.

Graham

 Massimo

 On Feb 18, 4:11 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:



  On Feb 19, 6:40 am, mdipierro mdipie...@cs.depaul.edu wrote:

   Yes.

   I am running apache2 and I see this:

   www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
   sbin/apache2 -k start
   www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
   sbin/apache2 -k start
   www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
   sbin/apache2 -k start
   www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
   sbin/apache2 -k start
   www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
   sbin/apache2 -k start
   www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
   sbin/apache2 -k start
   www-data    0.0  0.2 130296   672 ?        S    16:55   0:00 /usr/
   sbin/apache2 -k start
   1000      7070  0.0  0.3   5164   828 pts/0    R+   16:55   0:00 grep
   apache
   root     13264  0.0  0.0 130160   156 ?        Ss   15:50   0:00 /usr/
   sbin/apache2 -k start

   Look at process 6320. It is using way more memory than any other one.
   Eventually it will fill the ram. Seems like a memory leak. Only one
   process does it. I will it and another process takes his place.
   What is going on?

   I have never seen this problem before. Looks like a memory leak and
   seems related to this:

  http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

  Likely unrelated because for you it is affecting only one process.

   For now I am following their suggestions and we'll see.

  Presuming you are now running mod_wsgi, post your Apache configuration
  snippet for how you set mod_wsgi up.

  Specifically, confirm that you are using daemon mode? Also indicate
  which version of mod_wsgi you are using.

  If you have an incremental memory growth problem because of web2py,
  there are various things one can do in mod_wsgi daemon mode
  configuration to combat the issue until you work out the real cause.

  So long as you are using daemon mode, that you are using prefork MPM
  is not a big deal.

  Graham

   Massimo

   On Feb 18, 

Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
Thank you Massimo.

http://web2pyapi.appspot.com/ide/default/models

is working now!

It only has one record right now, but I'm trying to figure out how to
parse lines like:

l=if request.env.web2py_runtime_gae:
l=l.replace('.',' ')
l=l.replace('_',' ')
l=l.replace(':',' ')
l=l.split(' ')

then write a

for w in l
   get all combinations - like i if r re req requ reque
reques request e, etc. for searches

thx again for your help!

-wes

On Thu, Feb 18, 2010 at 4:43 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 db(db.table.slp=='value').select() checks that 'value' is in the slp

 db(db.table.slp'value').select() checks that at least one element is
 less than 'value'

 db(db.table.slp'value').select() checks that at least one element if
 greater then 'value'

 slp is the name of your field of type StringListProperty. The selected
 field will be a list.


 On Feb 18, 5:23 pm, Wes James compte...@gmail.com wrote:
 I can't find any examples of web2py and gae select with
 StringListProperty.  Where did you find the example below?  I've
 looked in the web2py list emails, but I can't see any other working
 examples.

 How do you do this with web2py

 pseudo code:

 form(_query)

 def aview
     query=request.vars._query

     #how do you do this part with stringlistproperty/gae
     rows=db(??).select(??)

 thx,

 -wes

 On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com wrote:
  sounds like this will be useful.

  StringListProperty is a native gae type now supported by web2py:
 http://code.google.com/appengine/docs/python/datastore/typesandproper...
 http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa4...

  To get around the like problem you can do something like this:
  Model.all().filter('ngrams =', word).filter('ngrams ', word +
  u'\ufffd')

  Check out Thadeus's code for a full example.

  There's also info how to do this in the docs:
 http://code.google.com/appengine/docs/python/datastore/queriesandinde...

  Richard

  On Feb 14, 1:52 pm, Wes James compte...@gmail.com wrote:
  Richard,

  Do you have a python example of this?  I'll check on
  StringListProperty also and see how it works. (would this work on
  gae?) I was trying somthing else since like is not supported, but this
  might work.  I would like this site to provide quick search on
  anything that would be helpful in building a web2py app.  There are a
  lot of things in tools.py that could go here for instance, and maybe
  another page with docstrings?  Whatever anyone thinks would be
  helpful.

  -wes

  On Sat, Feb 13, 2010 at 4:26 PM, Richard richar...@gmail.com wrote:
   hi wes,

   something like this could be really nice for browsing the function
   docstrings. Do you intend to take it further?

   If you use a StringListProperty to store all the ngrams (eg: web2py,
   web2p, web2, web, we, w) then it could match partial words.

   Richard

  --
  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Long running tasks queue

2010-02-18 Thread Wayne Pierce
I have done something like this in the past with cron where the script
first checked whether another instance is already running.  If an
instance was found to be running the new instance was halted.  It may
not be the cleanest way but it allowed me to use what was available on
that system at the time.

Wayne

On Thu, Feb 18, 2010 at 3:06 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 I would not use cron for this. cron starts a job at reguar intervals
 but in background processing you do know that the previous task was
 completed. I would just make a loop that extract a todo task from
 database queue and sleeps if not task.

 You can use  cron @reboot to make sure this one task starts with the
 app.

 On Feb 18, 2:35 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:
 I like this, I can simply insert sleep statements to keep it from
 being to aggressive with this approach.

 Would this be best in system cron?

 On Feb 18, 1:31 pm, mdipierro mdipie...@cs.depaul.edu wrote:

  I would run a separate process

  web2py.py -S yourapp -M -R yourscript.py

  On Feb 18, 1:31 pm, Kevin Bowling kevin.bowl...@gmail.com wrote:

   Hello,

   I have a screen scraper that I would like to call from web2py.  I
   currently have a controller method that calls it and updates data in
   the DAL.  The problem is, the number of users of this app is growing
   quickly.  I need to queue the updates so I don't overwhelm the server
   that it is scraping.

   I would like a cron script to fire off daily and set the queue in
   motion.  I would like to limit the queue to update 5 users or so per
   minute.

   Any recommendations on attacking this problem?

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.





-- 
Wayne Pierce
Phone: 414.208.0808
Blog: http://xri.net/=Pierce/(+blog)

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Problems with changing admin password in 1.75.4

2010-02-18 Thread Rowdy

Greetings,

Since upgrading 1.75.2 to 1.75.4, I have noticed some oddness with
changing the admin password.

When I try to change the admin password, I get:

Traceback (most recent call last):
  File /home/rowdy/web2py/gluon/restricted.py, line 173, in restricted
exec ccode in environment
  File /home/rowdy/web2py/applications/admin/controllers/default.py, 
line 1046, in module

  File /home/rowdy/web2py/gluon/globals.py, line 96, in lambda
self._caller = lambda f: f()
  File /home/rowdy/web2py/applications/admin/controllers/default.py, 
line 72, in change_password

if verify_password(request.vars.current_admin_password):
  File /home/rowdy/web2py/applications/admin/models/access.py, line 
54, in verify_password

return _config['password'] == CRYPT()(request.vars.password)[0]
  File /home/rowdy/web2py/gluon/validators.py, line 2267, in __call__
return (hash(value, self.digest_alg), None)
  File /home/rowdy/web2py/gluon/utils.py, line 32, in hash
h.update(text)
TypeError: update() argument 1 must be string or read-only buffer, not None

There might be a typo in admin/models/access.py in function
verify_password().  The line near the end (line 54 from the above stack
trace):

return _config['password'] == CRYPT()(request.vars.password)[0]

should probably be:

return _config['password'] == CRYPT()(password)[0]

as password is passed as a parameter to this function.

However, after changing this line, when I try to change the admin
password it does not matter what I type as the old password, even a
random string of characters.  As long as the new passwords match and are
strong, the admin password is changed.

Rowdy

--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread raven
John,

Here is what I have placed in the file /etc/lighttpd/lighttpd.conf

$

fastcgi.server = (
   /handler_web2py.fcgi = (
  handler_web2py = ( #name for logs
check-local = disable,
socket = /tmp/fcgi.sock,
  )
   )
)



$HTTP[host] == 100.101.102.103 {
 server.document-root=/home/james/web2py
url.rewrite-once = (
  ^(/.+?/static/.+)$ = /applications$1,
  (^|/.*)$ = /handler_web2py.fcgi$1,
)
}


Can you tell me what I am doing wrong?


On Feb 18, 6:46 pm, John Heenan johnmhee...@gmail.com wrote:
 Hi Raven

 The name fcgihandler.py is just the name of a web2py start up file
 passed to Python.

 The name fcgihandler.py should not or need not appear anywhere in the
 lightttpd.conf file, since there is no need to give lighttpd the
 responsibility to start up web2py as an independent process.

 What lighttpd needs to know is where the UNIX socket is that is
 configured for use by web2py in fcgihandler.py. The name that
 ligthttpd.conf uses to tell the rest of lighttpd.conf to use the UNIX
 soscket is an arbitrary name. The suffix .fcgi does not need to appear
 anywhere in lighttpd.conf, it is just a convention.

 Maybe I should provide a link to a complete lighttpd.conf file 
 inhttp://www.web2pyslices.com/main/slices/take_slice/57

 It might be difficult to escape from an attitude that web servers are
 essentially used as dumb pipes by Python frameworks and as such need
 to stay 'out of the way' with minimal involvement.

 John Heenan

 On Feb 19, 5:10 am, raven ravenspo...@yahoo.com wrote:

  Well, I gave this a try, and ended up with 404 errors.

  fcgihandler.py suggests adding to lighttpd.conf

  server.error-handler-404 = '/test.fcgi'

  This does not help, nor does

  server.error-handler-404 = /error-handler.fcgi

  ( There no files on my system named *.fcgi, so I do not see how this
  could help )

  I suspect my problem might be with this line

  $HTTP[host] =~ (^|\.)example\.com$ {

  Since I am running on a VPS I only have an IP address.

  I tried

  $HTTP[host] == 100.101.102.103 {

  and

  $HTTP[remoteip] == 100.101.102.103 {

  and

  #SERVER[socket] == 100.101.102.103 {

  and some other variations on this, but nothing helps.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread mdipierro
You are right. I had

Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g mod_wsgi/1.3 Python/
2.5.2 configured

Now I upgraded:

Apache/2.2.8 (Ubuntu) mod_wsgi/4.0-TRUNK Python/2.5.2 mod_ssl/2.2.8
OpenSSL/0.9.8g configured

and now I see that the process using most of the ram is

www-data 30743  1.9 10.1 449980 26732 ?Sl   00:37   0:00
(wsgi:web2py) -k start

Yes since the BEAUTIFY bug was fixed I cannot say there is a problem
anymore.

Thanks for your help.

Massimo





On Feb 18, 6:04 pm, Graham Dumpleton graham.dumple...@gmail.com
wrote:
 On Feb 19, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote:

  My setup is exactly the one generated by this file

 http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ub...

  I did apt-get install mod-mpm-prefork

  I do not know which mod_wsgi I have. How how I check? Id just did apt-
  get install mod_wsgi on ubuntu 8.04.

 Ubuntu still has a quite old mod_wsgi version in the main repository,
 possibly even on mod_wsgi 1.X given you are using ancient ubuntu 8.04.
 The latest mod_wsgi version is 3.1 and if can you should use that.

 If you weren't using an ancient version of mod_wsgi I would have
 suggested you change the configuration line:

   WSGIDaemonProcess web2py user=www-data group=www-data

 to:

   WSGIDaemonProcess web2py user=www-data group=www-data display-name=%
 {GROUP} maximum-requests=5000 inactivity-timeout=60

 The 'display-name' option with that value will cause the process to be
 listed in 'ps' output as '(wsgi:web2py)'. That way is easier to
 identify separately from core Apache server processes. This option was
 only added in mod_wsgi 2.0.

 The 'maxiumum-requests' option would cause daemon process to be
 shutdown and restarted after 5000 requests. That way if you do have a
 problem with cache cleaning or Python object reference counting cycles
 which cant be broken by the Python garbage collector, then you at
 least throw everything away and start over again every so often.

 The 'inactivity-timeout' option is another way of forcing a process
 shutdown and restart to reclaim memory and start over. In this case if
 no requests are received in 60 seconds since the last request and so
 application is idle, it will shutdown and restart the process. This
 option was only added in mod_wsgi 2.0.

 To check which version of mod_wsgi is running you can look at the
 startup messages for Apache, presuming ubuntu hasn't hacked the
 startup message to disable display of Apache module information. The
 message will be of the form:

   Apache/2.2.2 (Unix) mod_wsgi/1.0 Python/2.3.5 configured

 If you can't find that in main Apache error log from time when Apache
 last restarted, then you will need to work out which version is
 installed from the ubuntu packaging system.

  Now that fixed the BEAUTIFY but the problem is no longer as severe as
  before but I do see one process (the multi-threaded one) consume more
  memory than everything else.

 Which is the mod_wsgi daemon process which holds the web2py instance.
 It will obviously be bigger, but if it keeps growing then you likely
 have an issue with the application. There has never been any issue
 with mod_wsgi which would see such memory growth.

 If you were using mod_wsgi 2.X (preferably 2.5 or later), then those
 options to WSGIDaemonProcess would at least allow it to recover itself
 whil you sort out what the real problem is.

 Graham

  Massimo

  On Feb 18, 4:11 pm, Graham Dumpleton graham.dumple...@gmail.com
  wrote:

   On Feb 19, 6:40 am, mdipierro mdipie...@cs.depaul.edu wrote:

Yes.

I am running apache2 and I see this:

www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
sbin/apache2 -k start
www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
sbin/apache2 -k start
www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
sbin/apache2 -k start
www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
sbin/apache2 -k start
www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
sbin/apache2 -k start
www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
sbin/apache2 -k start
www-data    0.0  0.2 130296   672 ?        S    16:55   0:00 /usr/
sbin/apache2 -k start
1000      7070  0.0  0.3   5164   828 pts/0    R+   16:55   0:00 grep
apache
root     13264  0.0  0.0 130160   156 ?        Ss   15:50   0:00 /usr/
sbin/apache2 -k start

Look at process 6320. It is using way more memory than any other one.
Eventually it will fill the ram. Seems like a memory leak. Only one
process does it. I will it and another process takes his place.
What is going on?

I have never seen this problem before. Looks like a memory leak and
seems related to this:

   http://www.paulstimesink.com/post/2005/05/21/memory-leak-in-apache/

   Likely unrelated because for you it is affecting only 

[web2py] Re: website not working

2010-02-18 Thread Graham Dumpleton


On Feb 19, 11:39 am, mdipierro mdipie...@cs.depaul.edu wrote:
 You are right. I had

 Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g mod_wsgi/1.3 Python/
 2.5.2 configured

 Now I upgraded:

 Apache/2.2.8 (Ubuntu) mod_wsgi/4.0-TRUNK Python/2.5.2 mod_ssl/2.2.8
 OpenSSL/0.9.8g configured

You probably want to avoid mod_wsgi subversion repository trunk. Use
instead:

  http://modwsgi.googlecode.com/svn/branches/mod_wsgi-3.X

The trunk is where I develop and play with stuff for next major
version. I try not to break things, but always safer to avoid trunk.

The branch just gets the important fixes applied.

I will be releasing a mod_wsgi 3.2 tarball soon hopefully with a
couple of fixes, but the only one which is known to affect anyway is
one for FreeBSD users. Thus you could have just use the mod_wsgi 3.1
tarball release.

Graham

 and now I see that the process using most of the ram is

 www-data 30743  1.9 10.1 449980 26732 ?        Sl   00:37   0:00
 (wsgi:web2py)     -k start

 Yes since the BEAUTIFY bug was fixed I cannot say there is a problem
 anymore.

 Thanks for your help.

 Massimo

 On Feb 18, 6:04 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:



  On Feb 19, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote:

   My setup is exactly the one generated by this file

  http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ub...

   I did apt-get install mod-mpm-prefork

   I do not know which mod_wsgi I have. How how I check? Id just did apt-
   get install mod_wsgi on ubuntu 8.04.

  Ubuntu still has a quite old mod_wsgi version in the main repository,
  possibly even on mod_wsgi 1.X given you are using ancient ubuntu 8.04.
  The latest mod_wsgi version is 3.1 and if can you should use that.

  If you weren't using an ancient version of mod_wsgi I would have
  suggested you change the configuration line:

    WSGIDaemonProcess web2py user=www-data group=www-data

  to:

    WSGIDaemonProcess web2py user=www-data group=www-data display-name=%
  {GROUP} maximum-requests=5000 inactivity-timeout=60

  The 'display-name' option with that value will cause the process to be
  listed in 'ps' output as '(wsgi:web2py)'. That way is easier to
  identify separately from core Apache server processes. This option was
  only added in mod_wsgi 2.0.

  The 'maxiumum-requests' option would cause daemon process to be
  shutdown and restarted after 5000 requests. That way if you do have a
  problem with cache cleaning or Python object reference counting cycles
  which cant be broken by the Python garbage collector, then you at
  least throw everything away and start over again every so often.

  The 'inactivity-timeout' option is another way of forcing a process
  shutdown and restart to reclaim memory and start over. In this case if
  no requests are received in 60 seconds since the last request and so
  application is idle, it will shutdown and restart the process. This
  option was only added in mod_wsgi 2.0.

  To check which version of mod_wsgi is running you can look at the
  startup messages for Apache, presuming ubuntu hasn't hacked the
  startup message to disable display of Apache module information. The
  message will be of the form:

    Apache/2.2.2 (Unix) mod_wsgi/1.0 Python/2.3.5 configured

  If you can't find that in main Apache error log from time when Apache
  last restarted, then you will need to work out which version is
  installed from the ubuntu packaging system.

   Now that fixed the BEAUTIFY but the problem is no longer as severe as
   before but I do see one process (the multi-threaded one) consume more
   memory than everything else.

  Which is the mod_wsgi daemon process which holds the web2py instance.
  It will obviously be bigger, but if it keeps growing then you likely
  have an issue with the application. There has never been any issue
  with mod_wsgi which would see such memory growth.

  If you were using mod_wsgi 2.X (preferably 2.5 or later), then those
  options to WSGIDaemonProcess would at least allow it to recover itself
  whil you sort out what the real problem is.

  Graham

   Massimo

   On Feb 18, 4:11 pm, Graham Dumpleton graham.dumple...@gmail.com
   wrote:

On Feb 19, 6:40 am, mdipierro mdipie...@cs.depaul.edu wrote:

 Yes.

 I am running apache2 and I see this:

 www-data  6215  0.0  0.0 130400   164 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6250  0.0  0.2 130296   608 ?        S    16:52   0:00 /usr/
 sbin/apache2 -k start
 www-data  6312  0.0  0.0 130296   128 ?        S    16:53   0:00 /usr/
 sbin/apache2 -k start
 www-data  6320 23.7 57.5 695308 151028 ?       Sl   16:54   0:21 /usr/
 sbin/apache2 -k start
 www-data  6663  0.0  0.2 130296   756 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data  6665  0.0  0.2 130296   664 ?        S    16:55   0:00 /usr/
 sbin/apache2 -k start
 www-data    0.0  0.2 130296   672 ?        S    

Re: [web2py] Re: they are copying us....

2010-02-18 Thread Thadeus Burgess
http://www.coderun.com/

-Thadeus





On Thu, Feb 18, 2010 at 8:43 AM, Timothy Farrell tfarr...@swgen.com wrote:
 kodingen uses Bespin at its core.  Try using it in IE and you get this:

 http://kodingen.com/_browsehappy.html

 On 2/17/2010 1:07 AM, mdipierro wrote:

 This is a cool layout and editor. It uses jquery. no syntax
 highlighting.

 On Feb 17, 12:49 am, Thadeus Burgessthade...@thadeusb.com  wrote:


 http://kodingen.com/

 ?? this seems more along the lines.

 -Thadeus

 On Tue, Feb 16, 2010 at 12:29 PM, mikechmp.ch...@gmail.com  wrote:


 To quote a saying:
 Imitation is the sincerest form of flattery.




 On Feb 16, 6:48 am, mdipierromdipie...@cs.depaul.edu  wrote:


 sorry was a joke and I did not mean it in a negative ways. I meant to
 indicate that if before we were taking inspirations from them now thay
 are taking inspirations from us. I think that is a nice project and
 perhaps we can learn from it too.




 On Feb 16, 3:25 am, pistacchiopistacc...@gmail.com  wrote:




 hi massimo,
 i really appreciate your work on web2py. the product is excellent,
 i've just launched my first site using it and other two are on the
 work. i like the new documentation (how it's shaping up) and the way
 you rule the community around web2py prove that your way is right. i
 mean, you do a lot of work and coordinate inputs.




 one thing i really don't understand is your approach to the opensource
 philosophy. i already pointed it out weeks ago about the non free, pdf
 documentation that is something really sick in a opensource
 environment. fortunately i was not the only one thinking this way and,
 in the end, the online book is now there and shining.




 now, i think this copying us is utterly out of place. as you stated
 somewhere, your sources of inspiration were initially django and
 rails. are you copying them? did you make the idea of web framework
 by yourself? were you the first one to come out with the mvc pattern?
 i don't think so, and this is perfect.




 the opensource community, seen as a whole, not as a series of rival
 smaller communities that gather around isolated projects, drains its
 power from the openness of the ideas, from making them circulate and
 the word copy, with the negative connotation of plagiarize hidden
 within it, has nothing to do with this.
 the guy may or may be not been inspired by web2py, but if he was, it
 is a good thing that web2py did something so valid that other people
 want to take inspiration from it. if he ends up writing a piece of
 software that is better than the current web2py's online editor, we
 can replace it with the new, better one and the circle will be
 completed as opening an idea would lead to end up with a better
 product. that's the whole point of opensource.




 On Feb 16, 5:57 am, mdipierromdipie...@cs.depaul.edu  wrote:




 http://haineault.com/blog/125/




 P.S. Of course we have 3 years of head start and the web2py
 architecture was designed for this, theirs isn't.




 --
 You received this message because you are subscribed to the Google
 Groups web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group
 athttp://groups.google.com/group/web2py?hl=en.




 --
 You received this message because you are subscribed to the Google Groups
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Problem with example in the book.

2010-02-18 Thread Wayne
I have been working on section 3.6 of the book but cannot get past the
initial database sample.  When I enter the following into db.py and
click on 'database administration' I get an error.  The code entered
is:

*
db = DAL(sqlite://storage.db)

db.define.table('image',
Field('title'),
Field('file','upload'))

db.define.table('comment',
Field('image_id', db.image),
Field('author'),
Field('email'),
Field('body', 'text'))

db.image.title.requires = [IS_NOT_EMPTY(),
IS_NOT_IN_DB(db, db.image.title)]

db.comment.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
db.comment.author.requires = IS_NOT_EMPTY()
db.comment.email.requires = IS_EMAIL()
db.comment.body.requires = IS_NOT_EMPTY()

db.comment.image_id.writable = db.comment.image_id.readable = False

When clicking 'database administration' I get the following error:

Traceback (most recent call last):
  File gluon/restricted.py, line 173, in restricted
  File C:/Code/web2py/applications/MyApp/models/db.py, line 5, in
module
  File gluon/sql.py, line 1295, in __getattr__
KeyError: 'define'

I am running Python 2.6 on Windows 7 with version 1.75.1 of web2py.
Before I added the database code from section 3.6 I was able to access
the database administration for the initial tables.

Does anyone have suggestions on where I should be looking?  I thought
I might be missing sqlite (haven't used Python on a while), but that
is built-in now.

Wayne

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Problem with example in the book.

2010-02-18 Thread Thadeus Burgess
db.define_table not db.define.table

-Thadeus





On Thu, Feb 18, 2010 at 7:01 PM, Wayne shalo...@gmail.com wrote:
 I have been working on section 3.6 of the book but cannot get past the
 initial database sample.  When I enter the following into db.py and
 click on 'database administration' I get an error.  The code entered
 is:

 *
 db = DAL(sqlite://storage.db)

 db.define.table('image',
    Field('title'),
    Field('file','upload'))

 db.define.table('comment',
    Field('image_id', db.image),
    Field('author'),
    Field('email'),
    Field('body', 'text'))

 db.image.title.requires = [IS_NOT_EMPTY(),
                            IS_NOT_IN_DB(db, db.image.title)]

 db.comment.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
 db.comment.author.requires = IS_NOT_EMPTY()
 db.comment.email.requires = IS_EMAIL()
 db.comment.body.requires = IS_NOT_EMPTY()

 db.comment.image_id.writable = db.comment.image_id.readable = False
 
 When clicking 'database administration' I get the following error:

 Traceback (most recent call last):
  File gluon/restricted.py, line 173, in restricted
  File C:/Code/web2py/applications/MyApp/models/db.py, line 5, in
 module
  File gluon/sql.py, line 1295, in __getattr__
 KeyError: 'define'

 I am running Python 2.6 on Windows 7 with version 1.75.1 of web2py.
 Before I added the database code from section 3.6 I was able to access
 the database administration for the initial tables.

 Does anyone have suggestions on where I should be looking?  I thought
 I might be missing sqlite (haven't used Python on a while), but that
 is built-in now.

 Wayne

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread John Heenan
Raven,

1) Use
$SERVER[socket]  == 100.101.102.103 {
instead of
$HTTP[host] == 100.101.102.103 {

2) Did you restart lighttpd with
/etc/init.d/lighttpd restart
and where there any problems when restarting?

3) Is mod_fastcgi included with server.modules in lighttpd.conf?

4) Is web2py actually running such as started with
cd /var/www/web2py  sudo -u www-data nohup python fcgihandler.py  

You can see if the web2py process is alive with
ps ax | grep python
A line with fcgihandler.py should appear once. If appears more than
once then kill all fcgihandler.py python processes with
ps number
where number is the first number on each line of 'ps ax' that includes
fcgihandler.py.

Restart web2py with
python fcgihandler.py  
or similar

5) Check file nohup.out in /var/www/web2py for errors


John Heenan


On Feb 19, 10:36 am, raven ravenspo...@yahoo.com wrote:
 John,

 Here is what I have placed in the file /etc/lighttpd/lighttpd.conf

 $

 fastcgi.server = (
    /handler_web2py.fcgi = (
       handler_web2py = ( #name for logs
         check-local = disable,
         socket = /tmp/fcgi.sock,
       )
    )
 )

 $HTTP[host] == 100.101.102.103 {
  server.document-root=/home/james/web2py
     url.rewrite-once = (
       ^(/.+?/static/.+)$ = /applications$1,
       (^|/.*)$ = /handler_web2py.fcgi$1,
     )

 }

 Can you tell me what I am doing wrong?

 On Feb 18, 6:46 pm, John Heenan johnmhee...@gmail.com wrote:

  Hi Raven

  The name fcgihandler.py is just the name of a web2py start up file
  passed to Python.

  The name fcgihandler.py should not or need not appear anywhere in the
  lightttpd.conf file, since there is no need to give lighttpd the
  responsibility to start up web2py as an independent process.

  What lighttpd needs to know is where the UNIX socket is that is
  configured for use by web2py in fcgihandler.py. The name that
  ligthttpd.conf uses to tell the rest of lighttpd.conf to use the UNIX
  soscket is an arbitrary name. The suffix .fcgi does not need to appear
  anywhere in lighttpd.conf, it is just a convention.

  Maybe I should provide a link to a complete lighttpd.conf file 
  inhttp://www.web2pyslices.com/main/slices/take_slice/57

  It might be difficult to escape from an attitude that web servers are
  essentially used as dumb pipes by Python frameworks and as such need
  to stay 'out of the way' with minimal involvement.

  John Heenan

  On Feb 19, 5:10 am, raven ravenspo...@yahoo.com wrote:

   Well, I gave this a try, and ended up with 404 errors.

   fcgihandler.py suggests adding to lighttpd.conf

   server.error-handler-404 = '/test.fcgi'

   This does not help, nor does

   server.error-handler-404 = /error-handler.fcgi

   ( There no files on my system named *.fcgi, so I do not see how this
   could help )

   I suspect my problem might be with this line

   $HTTP[host] =~ (^|\.)example\.com$ {

   Since I am running on a VPS I only have an IP address.

   I tried

   $HTTP[host] == 100.101.102.103 {

   and

   $HTTP[remoteip] == 100.101.102.103 {

   and

   #SERVER[socket] == 100.101.102.103 {

   and some other variations on this, but nothing helps.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Problem with example in the book.

2010-02-18 Thread Wayne
Dang it.  I re-read that so many times I don't know how it was
missed.  Thank you for the help and quick response.

Wayne

On Feb 18, 7:12 pm, Thadeus Burgess thade...@thadeusb.com wrote:
 db.define_table not db.define.table

 -Thadeus



 On Thu, Feb 18, 2010 at 7:01 PM, Wayne shalo...@gmail.com wrote:
  I have been working on section 3.6 of the book but cannot get past the
  initial database sample.  When I enter the following into db.py and
  click on 'database administration' I get an error.  The code entered
  is:

  *
  db = DAL(sqlite://storage.db)

  db.define.table('image',
     Field('title'),
     Field('file','upload'))

  db.define.table('comment',
     Field('image_id', db.image),
     Field('author'),
     Field('email'),
     Field('body', 'text'))

  db.image.title.requires = [IS_NOT_EMPTY(),
                             IS_NOT_IN_DB(db, db.image.title)]

  db.comment.image_id.requires = IS_IN_DB(db, db.image.id, '%(title)s')
  db.comment.author.requires = IS_NOT_EMPTY()
  db.comment.email.requires = IS_EMAIL()
  db.comment.body.requires = IS_NOT_EMPTY()

  db.comment.image_id.writable = db.comment.image_id.readable = False
  
  When clicking 'database administration' I get the following error:

  Traceback (most recent call last):
   File gluon/restricted.py, line 173, in restricted
   File C:/Code/web2py/applications/MyApp/models/db.py, line 5, in
  module
   File gluon/sql.py, line 1295, in __getattr__
  KeyError: 'define'

  I am running Python 2.6 on Windows 7 with version 1.75.1 of web2py.
  Before I added the database code from section 3.6 I was able to access
  the database administration for the initial tables.

  Does anyone have suggestions on where I should be looking?  I thought
  I might be missing sqlite (haven't used Python on a while), but that
  is built-in now.

  Wayne

  --
  You received this message because you are subscribed to the Google Groups 
  web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: website not working

2010-02-18 Thread Graham Dumpleton


On Feb 19, 12:44 pm, mdipierro mdipie...@cs.depaul.edu wrote:
 I did as you suggest, moved apache2-mpm-worker and run a cronjob that
 will restart processes that take more 50% CPU.
 Now it seems to be snappy, steady memory use and it is using less then
 1/2 of the memory I have (256MB).

As a fail safe for a runaway process, you can set yet another option
to WSGIDaemonProcess to trigger a process shutdown and restart. This
option is:

  cpu-time-limit=300

That is, once the process has consumed a total of 300 seconds of CPU
time it will automatically restart it. This option was added in
mod_wsgi 3.0.

Although it will curtail a blatant runaway process, normal processes
will obviously still eventually accumulate CPU time through normal
use, so it will also act as a periodic restart trigger for a process
even under normal operation. That is similar to how maximum-requests
option would also trigger a restart but based on number of requests.

Graham

 Thank you again.

 Massimo

 On Feb 18, 6:56 pm, Graham Dumpleton graham.dumple...@gmail.com
 wrote:



  On Feb 19, 11:39 am, mdipierro mdipie...@cs.depaul.edu wrote:

   You are right. I had

   Apache/2.2.8 (Ubuntu) mod_ssl/2.2.8 OpenSSL/0.9.8g mod_wsgi/1.3 Python/
   2.5.2 configured

   Now I upgraded:

   Apache/2.2.8 (Ubuntu) mod_wsgi/4.0-TRUNK Python/2.5.2 mod_ssl/2.2.8
   OpenSSL/0.9.8g configured

  You probably want to avoid mod_wsgi subversion repository trunk. Use
  instead:

   http://modwsgi.googlecode.com/svn/branches/mod_wsgi-3.X

  The trunk is where I develop and play with stuff for next major
  version. I try not to break things, but always safer to avoid trunk.

  The branch just gets the important fixes applied.

  I will be releasing a mod_wsgi 3.2 tarball soon hopefully with a
  couple of fixes, but the only one which is known to affect anyway is
  one for FreeBSD users. Thus you could have just use the mod_wsgi 3.1
  tarball release.

  Graham

   and now I see that the process using most of the ram is

   www-data 30743  1.9 10.1 449980 26732 ?        Sl   00:37   0:00
   (wsgi:web2py)     -k start

   Yes since the BEAUTIFY bug was fixed I cannot say there is a problem
   anymore.

   Thanks for your help.

   Massimo

   On Feb 18, 6:04 pm, Graham Dumpleton graham.dumple...@gmail.com
   wrote:

On Feb 19, 10:36 am, mdipierro mdipie...@cs.depaul.edu wrote:

 My setup is exactly the one generated by this file

http://code.google.com/p/web2py/source/browse/scripts/setup-web2py-ub...

 I did apt-get install mod-mpm-prefork

 I do not know which mod_wsgi I have. How how I check? Id just did apt-
 get install mod_wsgi on ubuntu 8.04.

Ubuntu still has a quite old mod_wsgi version in the main repository,
possibly even on mod_wsgi 1.X given you are using ancient ubuntu 8.04.
The latest mod_wsgi version is 3.1 and if can you should use that.

If you weren't using an ancient version of mod_wsgi I would have
suggested you change the configuration line:

  WSGIDaemonProcess web2py user=www-data group=www-data

to:

  WSGIDaemonProcess web2py user=www-data group=www-data display-name=%
{GROUP} maximum-requests=5000 inactivity-timeout=60

The 'display-name' option with that value will cause the process to be
listed in 'ps' output as '(wsgi:web2py)'. That way is easier to
identify separately from core Apache server processes. This option was
only added in mod_wsgi 2.0.

The 'maxiumum-requests' option would cause daemon process to be
shutdown and restarted after 5000 requests. That way if you do have a
problem with cache cleaning or Python object reference counting cycles
which cant be broken by the Python garbage collector, then you at
least throw everything away and start over again every so often.

The 'inactivity-timeout' option is another way of forcing a process
shutdown and restart to reclaim memory and start over. In this case if
no requests are received in 60 seconds since the last request and so
application is idle, it will shutdown and restart the process. This
option was only added in mod_wsgi 2.0.

To check which version of mod_wsgi is running you can look at the
startup messages for Apache, presuming ubuntu hasn't hacked the
startup message to disable display of Apache module information. The
message will be of the form:

  Apache/2.2.2 (Unix) mod_wsgi/1.0 Python/2.3.5 configured

If you can't find that in main Apache error log from time when Apache
last restarted, then you will need to work out which version is
installed from the ubuntu packaging system.

 Now that fixed the BEAUTIFY but the problem is no longer as severe as
 before but I do see one process (the multi-threaded one) consume more
 memory than everything else.

Which is the mod_wsgi daemon process which holds the web2py instance.
It will obviously be bigger, but if it keeps growing then you likely

Re: [web2py] Re: first gae app

2010-02-18 Thread Wes James
I think this fixes it:

in a form this gets entered

a=[u'a',u'b',u'aa',u'bbb',u'cc']

a validation rule with this in it does the trick :)

a[3:-2].split(',u')

On Thu, Feb 18, 2010 at 5:42 PM, Wes James compte...@gmail.com wrote:
 I finally think I'm getting there and I see that data after it is
 inserted - gae is doing something to the list.

 After enter a value then I go back to edit it it has a u in front of
 every list value

 ['a','b']  insert then edit

 it now looks like

 [u'a',u'b']

 now the IS_LIST doesn't work on gae when a value is updated :(

 -wes

 On Thu, Feb 18, 2010 at 5:07 PM, Wes James compte...@gmail.com wrote:
 Thank you Massimo.

 http://web2pyapi.appspot.com/ide/default/models

 is working now!

 It only has one record right now, but I'm trying to figure out how to
 parse lines like:

 l=if request.env.web2py_runtime_gae:
 l=l.replace('.',' ')
 l=l.replace('_',' ')
 l=l.replace(':',' ')
 l=l.split(' ')

 then write a

 for w in l
   get all combinations - like i if r re req requ reque
 reques request e, etc. for searches

 thx again for your help!

 -wes

 On Thu, Feb 18, 2010 at 4:43 PM, mdipierro mdipie...@cs.depaul.edu wrote:
 db(db.table.slp=='value').select() checks that 'value' is in the slp

 db(db.table.slp'value').select() checks that at least one element is
 less than 'value'

 db(db.table.slp'value').select() checks that at least one element if
 greater then 'value'

 slp is the name of your field of type StringListProperty. The selected
 field will be a list.


 On Feb 18, 5:23 pm, Wes James compte...@gmail.com wrote:
 I can't find any examples of web2py and gae select with
 StringListProperty.  Where did you find the example below?  I've
 looked in the web2py list emails, but I can't see any other working
 examples.

 How do you do this with web2py

 pseudo code:

 form(_query)

 def aview
     query=request.vars._query

     #how do you do this part with stringlistproperty/gae
     rows=db(??).select(??)

 thx,

 -wes

 On Sun, Feb 14, 2010 at 3:57 AM, Richard richar...@gmail.com wrote:
  sounds like this will be useful.

  StringListProperty is a native gae type now supported by web2py:
 http://code.google.com/appengine/docs/python/datastore/typesandproper...
 http://groups.google.com/group/web2py/browse_thread/thread/7d284c9fa4...

  To get around the like problem you can do something like this:
  Model.all().filter('ngrams =', word).filter('ngrams ', word +
  u'\ufffd')

  Check out Thadeus's code for a full example.

  There's also info how to do this in the docs:
 http://code.google.com/appengine/docs/python/datastore/queriesandinde...

  Richard

  On Feb 14, 1:52 pm, Wes James compte...@gmail.com wrote:
  Richard,

  Do you have a python example of this?  I'll check on
  StringListProperty also and see how it works. (would this work on
  gae?) I was trying somthing else since like is not supported, but this
  might work.  I would like this site to provide quick search on
  anything that would be helpful in building a web2py app.  There are a
  lot of things in tools.py that could go here for instance, and maybe
  another page with docstrings?  Whatever anyone thinks would be
  helpful.

  -wes

  On Sat, Feb 13, 2010 at 4:26 PM, Richard richar...@gmail.com wrote:
   hi wes,

   something like this could be really nice for browsing the function
   docstrings. Do you intend to take it further?

   If you use a StringListProperty to store all the ngrams (eg: web2py,
   web2p, web2, web, we, w) then it could match partial words.

   Richard

  --
  You received this message because you are subscribed to the Google 
  Groups web2py-users group.
  To post to this group, send email to web...@googlegroups.com.
  To unsubscribe from this group, send email to 
  web2py+unsubscr...@googlegroups.com.
  For more options, visit this group 
  athttp://groups.google.com/group/web2py?hl=en.

 --
 You received this message because you are subscribed to the Google Groups 
 web2py-users group.
 To post to this group, send email to web...@googlegroups.com.
 To unsubscribe from this group, send email to 
 web2py+unsubscr...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/web2py?hl=en.





-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Problems with changing admin password in 1.75.4

2010-02-18 Thread mdipierro
Fixed in trunk, thanks Rowdy and Nathan.

On Feb 18, 9:01 pm, mr.freeze nat...@freezable.com wrote:
 Yes, there are two bugs:

 1) line 72 of admin/controllers/default.py should be
 if not verify_password(request.vars.current_admin_password):
 instead of
 if verify_password(request.vars.current_admin_password):

 2) line 54 of admin/models/access.py should be
 return _config['password'] == CRYPT()(password)[0]
 instead of
 return _config['password'] == CRYPT()(request.vars.password)[0]

 On Feb 18, 6:22 pm, Rowdy da...@fielden.com.au wrote:

  Greetings,

  Since upgrading 1.75.2 to 1.75.4, I have noticed some oddness with
  changing the admin password.

  When I try to change the admin password, I get:

  Traceback (most recent call last):
     File /home/rowdy/web2py/gluon/restricted.py, line 173, in restricted
       exec ccode in environment
     File /home/rowdy/web2py/applications/admin/controllers/default.py,
  line 1046, in module
     File /home/rowdy/web2py/gluon/globals.py, line 96, in lambda
       self._caller = lambda f: f()
     File /home/rowdy/web2py/applications/admin/controllers/default.py,
  line 72, in change_password
       if verify_password(request.vars.current_admin_password):
     File /home/rowdy/web2py/applications/admin/models/access.py, line
  54, in verify_password
       return _config['password'] == CRYPT()(request.vars.password)[0]
     File /home/rowdy/web2py/gluon/validators.py, line 2267, in __call__
       return (hash(value, self.digest_alg), None)
     File /home/rowdy/web2py/gluon/utils.py, line 32, in hash
       h.update(text)
  TypeError: update() argument 1 must be string or read-only buffer, not None

  There might be a typo in admin/models/access.py in function
  verify_password().  The line near the end (line 54 from the above stack
  trace):

  return _config['password'] == CRYPT()(request.vars.password)[0]

  should probably be:

  return _config['password'] == CRYPT()(password)[0]

  as password is passed as a parameter to this function.

  However, after changing this line, when I try to change the admin
  password it does not matter what I type as the old password, even a
  random string of characters.  As long as the new passwords match and are
  strong, the admin password is changed.

  Rowdy

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: How much memory does web2py need on Unix

2010-02-18 Thread John Heenan
Raven

$SERVER[socket] == 0.0.0.0:80 {

will allow all IP interfaces.

John Heenan


On Feb 19, 11:42 am, John Heenan johnmhee...@gmail.com wrote:
 Raven,

 1) Use
 $SERVER[socket]  == 100.101.102.103 {
 instead of
 $HTTP[host] == 100.101.102.103 {

 2) Did you restart lighttpd with
 /etc/init.d/lighttpd restart
 and where there any problems when restarting?

 3) Is mod_fastcgi included with server.modules in lighttpd.conf?

 4) Is web2py actually running such as started with
 cd /var/www/web2py  sudo -u www-data nohup python fcgihandler.py  

 You can see if the web2py process is alive with
 ps ax | grep python
 A line with fcgihandler.py should appear once. If appears more than
 once then kill all fcgihandler.py python processes with
 ps number
 where number is the first number on each line of 'ps ax' that includes
 fcgihandler.py.

 Restart web2py with
 python fcgihandler.py  
 or similar

 5) Check file nohup.out in /var/www/web2py for errors

 John Heenan

 On Feb 19, 10:36 am, raven ravenspo...@yahoo.com wrote:

  John,

  Here is what I have placed in the file /etc/lighttpd/lighttpd.conf

  $

  fastcgi.server = (
     /handler_web2py.fcgi = (
        handler_web2py = ( #name for logs
          check-local = disable,
          socket = /tmp/fcgi.sock,
        )
     )
  )

  $HTTP[host] == 100.101.102.103 {
   server.document-root=/home/james/web2py
      url.rewrite-once = (
        ^(/.+?/static/.+)$ = /applications$1,
        (^|/.*)$ = /handler_web2py.fcgi$1,
      )

  }

  Can you tell me what I am doing wrong?

  On Feb 18, 6:46 pm, John Heenan johnmhee...@gmail.com wrote:

   Hi Raven

   The name fcgihandler.py is just the name of a web2py start up file
   passed to Python.

   The name fcgihandler.py should not or need not appear anywhere in the
   lightttpd.conf file, since there is no need to give lighttpd the
   responsibility to start up web2py as an independent process.

   What lighttpd needs to know is where the UNIX socket is that is
   configured for use by web2py in fcgihandler.py. The name that
   ligthttpd.conf uses to tell the rest of lighttpd.conf to use the UNIX
   soscket is an arbitrary name. The suffix .fcgi does not need to appear
   anywhere in lighttpd.conf, it is just a convention.

   Maybe I should provide a link to a complete lighttpd.conf file 
   inhttp://www.web2pyslices.com/main/slices/take_slice/57

   It might be difficult to escape from an attitude that web servers are
   essentially used as dumb pipes by Python frameworks and as such need
   to stay 'out of the way' with minimal involvement.

   John Heenan

   On Feb 19, 5:10 am, raven ravenspo...@yahoo.com wrote:

Well, I gave this a try, and ended up with 404 errors.

fcgihandler.py suggests adding to lighttpd.conf

server.error-handler-404 = '/test.fcgi'

This does not help, nor does

server.error-handler-404 = /error-handler.fcgi

( There no files on my system named *.fcgi, so I do not see how this
could help )

I suspect my problem might be with this line

$HTTP[host] =~ (^|\.)example\.com$ {

Since I am running on a VPS I only have an IP address.

I tried

$HTTP[host] == 100.101.102.103 {

and

$HTTP[remoteip] == 100.101.102.103 {

and

#SERVER[socket] == 100.101.102.103 {

and some other variations on this, but nothing helps.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Difficulty with a form

2010-02-18 Thread waTR
The only work-around I found was to mark all the required info as
hidden html, and so it now populates the request.vars with the stuff
it needs for the form to submit. This is not good for me though, as I
would really like to have only the data I want to change be passed to
the public html view. I want some of the data to stay private.



On Feb 18, 3:56 pm, waTR r...@devshell.org wrote:
 Also, I couldn't find a link to the epydocs ?  Where did that go?  It
 was really great!

 On Feb 18, 3:49 pm, waTR r...@devshell.org wrote:

  I have created a form using SQLForm. I am using a db query to select a
  single row from a db table, and I want to make changes to it. However,
  when I submit, some of the data disapears in the submit. This happens
  to also prevent the form from submitting as that data that disapears
  is very important.

  Here is what I have:

  DB table company with fields name and title
  DB table user with fields name and title, and a foreign key of
  company id

  When I use SQLForm(db.user, session.currentUserID) and submit this
  form, the company_id field is null, even though before I submitted the
  field in the DB has a 2 in it.  Note that I have not actually
  generated the field in a view. So I imagine that any field that is not
  in the view is submitted as NULL. Is this a bug?  I believe any field
  that you don't use in a view should just be re-submitted with the same
  data that was in the field before. Whats going on here? Why does the
  field go empty?

  Is there a way to manually set a value to the field before it submits?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



Re: [web2py] Re: Difficulty with a form

2010-02-18 Thread Jonathan Lundell
On Feb 18, 2010, at 8:25 PM, waTR wrote:

 The only work-around I found was to mark all the required info as
 hidden html, and so it now populates the request.vars with the stuff
 it needs for the form to submit. This is not good for me though, as I
 would really like to have only the data I want to change be passed to
 the public html view. I want some of the data to stay private.

Can you stick it in the session?

 
 
 
 On Feb 18, 3:56 pm, waTR r...@devshell.org wrote:
 Also, I couldn't find a link to the epydocs ?  Where did that go?  It
 was really great!
 
 On Feb 18, 3:49 pm, waTR r...@devshell.org wrote:
 
 I have created a form using SQLForm. I am using a db query to select a
 single row from a db table, and I want to make changes to it. However,
 when I submit, some of the data disapears in the submit. This happens
 to also prevent the form from submitting as that data that disapears
 is very important.
 
 Here is what I have:
 
 DB table company with fields name and title
 DB table user with fields name and title, and a foreign key of
 company id
 
 When I use SQLForm(db.user, session.currentUserID) and submit this
 form, the company_id field is null, even though before I submitted the
 field in the DB has a 2 in it.  Note that I have not actually
 generated the field in a view. So I imagine that any field that is not
 in the view is submitted as NULL. Is this a bug?  I believe any field
 that you don't use in a view should just be re-submitted with the same
 data that was in the field before. Whats going on here? Why does the
 field go empty?
 
 Is there a way to manually set a value to the field before it submits?


-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] StackExchange

2010-02-18 Thread minh
Just throwing this out there...

I think StackExchange.com would make a good platform for web2py help/
discussion.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] new from the slice house: request a slice!

2010-02-18 Thread mr.freeze
You can now request a slice on web2pyslices.com.  You will be notified
if someone creates a slice based on your request. There will
eventually be a hall of fame to honor those who have created the most
slices and responded to the most requests.

To view or create a request, simply click the 'Slice Requests' link in
the main menu.

Enjoy!

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: StackExchange

2010-02-18 Thread Anand Vaidya
Looks nice. Costs atleast $129 per month

Regards
Anand



On Feb 19, 1:02 pm, minh mdn0...@gmail.com wrote:
 Just throwing this out there...

 I think StackExchange.com would make a good platform for web2py help/
 discussion.

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] Re: Difficulty with a form

2010-02-18 Thread waTR
The problem is that the controller does:

if form.accepts(request.vars, session, keepvalues=True):

In my case, it throws an error saying the request.vars doesn't contain
a company_id for the SQLForm made using db.user. So I have to pass a
hidden form.custom.widget.company_id element to the view with its
_type set to hidden. Therefore, it is in the HTML source code for
everyone to see, but it is not displayed in the browser window.

What I want to do is have it NOT show up in HTML source. I need to
somehow have the above validation succeed, but to do this I need to
insert the company_id into the request.vars as it is returned from
view on submit.

...help...




On Feb 18, 8:47 pm, Jonathan Lundell jlund...@pobox.com wrote:
 On Feb 18, 2010, at 8:25 PM, waTR wrote:

  The only work-around I found was to mark all the required info as
  hidden html, and so it now populates the request.vars with the stuff
  it needs for the form to submit. This is not good for me though, as I
  would really like to have only the data I want to change be passed to
  the public html view. I want some of the data to stay private.

 Can you stick it in the session?



  On Feb 18, 3:56 pm, waTR r...@devshell.org wrote:
  Also, I couldn't find a link to the epydocs ?  Where did that go?  It
  was really great!

  On Feb 18, 3:49 pm, waTR r...@devshell.org wrote:

  I have created a form using SQLForm. I am using a db query to select a
  single row from a db table, and I want to make changes to it. However,
  when I submit, some of the data disapears in the submit. This happens
  to also prevent the form from submitting as that data that disapears
  is very important.

  Here is what I have:

  DB table company with fields name and title
  DB table user with fields name and title, and a foreign key of
  company id

  When I use SQLForm(db.user, session.currentUserID) and submit this
  form, the company_id field is null, even though before I submitted the
  field in the DB has a 2 in it.  Note that I have not actually
  generated the field in a view. So I imagine that any field that is not
  in the view is submitted as NULL. Is this a bug?  I believe any field
  that you don't use in a view should just be re-submitted with the same
  data that was in the field before. Whats going on here? Why does the
  field go empty?

  Is there a way to manually set a value to the field before it submits?

-- 
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.



[web2py] batch upload of legacy files

2010-02-18 Thread Rowdy

Greetings,

I am migrating a legacy application to web2py.

Part of the legacy data is a large ( 50,000) collection of attachments
- files of all different types, that were uploaded in various ways to
the legacy application (typically as email attachments) and need to
appear in the new web2py application.

I can copy the physical files into the uploads directory of the web2py
application, and I can insert appropriate rows into the attachment
table in the database.

Are there any special considerations that need to be addressed?

The biggest question is: do the filenames *have* to comply with the
filenames generated by web2py's upload functionality
(table.field.uuid.b16encode.ext), or can I keep the existing filenames
(e.g. image1.jpg, readme.txt, problem.bmp, sample.csv)?

If I must conform to web2py's naming convention, what is the easiest way
of constructing the uuid part of the filename (I have a separate data
migration script written in Python that already migrates most of the
other legacy data)?

Thanx

Rowdy

--
You received this message because you are subscribed to the Google Groups 
web2py-users group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.