[web2py] cPickle with protocol 2 on a storage object fails

2012-07-18 Thread marius.v.niekerk
When using pickle with protocol 2 pickling a Storage object fails

This is caused by the __getattr__ getting called to find the 
__getinitargs__ and __getnewargs__ methods.  They dont exist in the 
dictionary so consequently they return None.  Pickle then calls the None 
and consequently dies.

Implementing these methods in gluon.storage.Storage makes things all better

def __getinitargs__(self):
return ()

def __getnewargs__(self):
return ()

-- 





[web2py] Change in behaviour of cache

2012-07-17 Thread marius.v.niekerk
I have some code that works as follows

@cache('key', 60, cache_model=cache.ram)
@cache('key', 60, cache_model=cache.disk)
def f()
   do stuff
  return dict()

I do the dual cache thing since the ram cache is not shared between 
processes that get spawned by Apache.

The recent changes to gluon/cache.py involving 

particularly 

File C:\src\web2py\gluon\cache.py, line 477, in tmp
action.__name___ = func.__name__
AttributeError: 'CacheAction' object has no attribute '__name__'

causes this to fail since the first @cache is a cache of a CacheAction 
which by this stage does not yet have a __name__

I've added a __name__ = 'dummy' to the CacheAction __init__ but that feels 
like a bad solution.

So
Suggestions?

regards
Marius

-- 





[web2py] Cython and gluon/html.py

2012-07-13 Thread marius.v.niekerk
At present a cython compiled version of html.py is not possible due to  
http://trac.cython.org/cython_trac/ticket/639

This means that you can't have functions with attributes.

in html.py the after the  function definition for URL()

is closely followed by

URL.verify = verifyURL

This leads to a runtime error when trying to use Cython with it.


[web2py] Re: Easy question, inserting user input fields into an email message

2012-05-25 Thread marius.v.niekerk

Or even better

message=Sender's name: %(your_name)s\nSender's e-mail: 
%(your_email)s\n\nHello World!... % request.vars


Marius


[web2py] _id for tables without id field

2012-04-05 Thread marius.v.niekerk
Would there be merit in defining _id for a table schema where the 
_primarykey list contains a single field

Doing this seems to allow SQLFORM.grid to behave as desired

I have a simple patch that seems to do this.  I am not sure how this 
affects insert performance etc


[web2py] Re: Change in URL args handling

2011-01-28 Thread marius.v.niekerk
I had another problem with url argument handling that came in was

/app/controller/function/arg1\r.

The default regex matching ( regex_args.match(request.raw_args( )) for
the arguments would return false and then the application would
respond with an invalid request error.  It is not obvious from the
error what the reason for failure is.

Obviously this doesn't happen when visiting sites in a browsers, but
it can be more of an issue for a json-rpc style application.

Should the url be sanitized beforehand?

On Jan 28, 12:58 am, Jonathan Lundell jlund...@pobox.com wrote:
 On Jan 27, 2011, at 12:48 PM, DenesL wrote:



  Now, trailing slashes are stripped, so the first two examples about give 
  ['arg1'], as does /a/c/f/arg1/

  Maybe that should be parsed as ['arg1', '', '', '', '']

  Maybe, but it seems to me that it's confusing unless we also recognize a 
  single trailing slash as an empty arg. I don't have a strong opinion.

  Note that the number of empty strings ('') is one less than the number
  of slashes:

  /arg1/
  /arg1/empty/empty/empty/empty/nothing_here

 Yes.

 Still, it bothers me that arg1 == arg1/ != arg1//; ignore exactly one 
 (optional) trailing slash seems like an odd rule.

 Notice also that '/'.join(['arg1', '']) is 'arg1/', not 'arg1//'.

 I'm open to changing it if you (or someone else) feels strongly about it--I'd 
 just have to change a call to rstrip to a conditional trim-one-character if 
 the string endswith('/'), so it's not a big deal. The important thing is for 
 it to be well defined.


[web2py] Re: Unknown Ticket

2011-01-06 Thread marius.v.niekerk
Shouldn't we detect that? Possibly display a message like 'error
cannot write to filesystem'? I have been bitten by this one before on
a poorly configured shared hosting setup.

On Jan 6, 1:28 am, Massimo Di Pierro massimo.dipie...@gmail.com
wrote:
 You will not finding anything at tha apache log error. This is a
 web2py error and it is indeed its failure to write to the filesystem.

 On Jan 5, 3:30 pm, Magnitus eric_vallee2...@yahoo.ca wrote:







  So I guess it would be indicative of a lower level issue at a layer
  below the framework?

  I guess its time to dust off those Apache logs then.

  On Jan 5, 3:42 pm, Kenneth Lundström kenneth.t.lundst...@gmail.com
  wrote:

   If I remember right Unknown ticket is displayed when web2py/webserver is
   not able to write a ticket into ticket directory.

   Kenneth

Hi,

some of my users have encountered a weird error on my mock production
server.

They get the following ticket when the first page (login) tries to
load:

Internal error

Ticket issued: unknown

Rebooting the server fixed the problem, but I'd still like to get some
insight into what could have gone wrong.

When I look in the ticket directory, I don't see any recent ticket.

The web2py version I use on the server isn't the most up-to-date
(1.88.2).

With that in mind, would someone have any insight on the type of
circumstances that would make Web2py behave in the above manner (not
write an actual ticket and display it to the viewer as unknown)?