You are not logged in.

Change Language:

Freelancer? Consultant? Check out: WorkTrail - Time Tracking made easy
Profile for ajt111

Name ajt111
Email Address n/a
Posts2
  • Unit Testing Session Data
    Board » General Category » General Discussion
    I am trying to write a unit test that sets a session variable, calls a view and then checks the response.
    My major problem is that It does not look like the session data is being passed to the view. Here is what I have so far.

    session = SessionStore()
    session['test'] = 'test text'
    session.save()

    response = self.client.get(url)
    session = self.client.session
    X = session.get('test', None)


    self.assertTrue(X) # this returns false.
  • Runserver and Apache + WSGI giving different results
    Board » Getting Started » Setup and Configuration
    This project uses a customized version of the built-in Admin site feature.
    When I run my project through run server everything seems to work fine.

    When I user Apache + WSGI I get some weird results.
    At first everything looks like it is working fine, but when I try to create or edit certain models I get the error:

    ValidationError at /admin/pid/pid/add/

    Request Method: POST
    Request URL: http://localhost/persis/admin/pid/pid/add/
    Exception Type: ValidationError
    Exception Value:

    Exception Location: /usr/lib/pymodules/python2.6/django/forms/formsets.py in _management_form, line 54
    Python Executable: /usr/bin/python
    Python Version: 2.6.4


    I also notice that when I use run server the Add form has an addition section which is missing when I use WSGI.
    I think this section is being added with the function:

    def add_view(self, request, form_url='', extra_context=None):
    self.inline_instances0 = PurlTargetInline(self.model, self.admin_site)
    self.fieldsets = (self.fieldset_pidtype, self.fieldset_pidinfo)
    return super(PidAdmin, self).add_view(request, form_url, extra_context)

    I still do not understand why I am gettng the error and why the section of the form is missing using WSGI.


Powered by Sphene Community Tools