I'm testing using Classes within my Modules to handle a lot of the heavy 
lifting.  I can't figure out what i'm doing wrong here.  I need an adult.


#No Model

#Controller: devices.py
from general import Engine

def upload():
    page = Engine()
    form = page.form()
    return dict(form=form)

#Module: general.py
from gluon import *
import os

class Engine(object):
    def __init__(self):
        self.request = current.request
def form(self):
filedir = os.path.join(self.request.folder, 'data', 'configs/')
return SQLFORM.factory(Field('config', 'upload', uploadfolder=filedir), 
table_name='raw_config').process()


#View: upload.html
{{extend 'layout.html'}}
<h1>This is a form</h1>
{{=form)}}




traceback
Error ticket for "classtest"Ticket ID

127.0.0.1.2014-01-01.00-47-28.74c7a12f-c68d-4641-8807-ab14a7c8cc01
<type 'exceptions.AttributeError'> 'Engine' object has no attribute 'form'
Versionweb2py™Version 2.8.2-stable+timestamp.2013.11.28.13.54.07PythonPython 
2.7.3: /Applications/web2py.app/Contents/MacOS/python (prefix: 
/Applications/web2py.app/Contents/Resources)Traceback

1.
2.
3.
4.
5.
6.
7.

Traceback (most recent call last):
  File "/Applications/web2py.app/Contents/Resources/gluon/restricted.py", line 
217, in restricted
  File 
"/Applications/web2py.app/Contents/Resources/applications/classtest/controllers/devices.py"
 <http://127.0.0.1:8000/admin/default/edit/classtest/controllers/devices.py>, 
line 8, in <module>
  File "/Applications/web2py.app/Contents/Resources/gluon/globals.py", line 
372, in <lambda>
  File 
"/Applications/web2py.app/Contents/Resources/applications/classtest/controllers/devices.py"
 <http://127.0.0.1:8000/admin/default/edit/classtest/controllers/devices.py>, 
line 5, in upload
AttributeError: 'Engine' object has no attribute 'form'

Error snapshot [image: 
help]<http://127.0.0.1:8000/admin/default/ticket/classtest/127.0.0.1.2014-01-01.00-47-28.74c7a12f-c68d-4641-8807-ab14a7c8cc01#>

<type 'exceptions.AttributeError'>('Engine' object has no attribute 'form')



-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to