function attributes not accessible in restricted mode

by Bill Fenner last modified Dec 30, 2008 03:08 PM
The error "function attributes not accessible in restricted mode" means you're operating on a function when you think you're operating on the result of calling that function.

The error function attributes not accessible in restricted mode usually means that you're missing a set of parenthesis, and so are accessing a function itself instead of the result of calling the function.

For example:

 def foo():
     return 'hi'

If you write foo.title(), hoping to call the title attribute on a string (the result of calling foo), you will get this error, because you're trying to attached a title attribute to the function foo. The proper thing to write is foo().title().

Common places you'll make this mistake are in things like PageTemplates, DTML, and PythonScripts:

  <dtml-var "foo.title()">  -->  <dtml-var "foo().title()">

  tal:content="python:foo.title()" --> tal:content="python:foo().title()"