예제 #1
0
    def test_iterable_render(self):
        tmpl = BLANK % """
        <xsl:copy-of select="xdjango:foo%d()"/>
        """ % self.time
        transformer = xslt.Transformer(tmpl)
        
        dictlist = [
            {"a": 10, "b": 20, "c": 40},
            {"a": 11, "b": 21, "c": 41},
            {"a": 12, "b": 22, "c": 42},
            ]

        xmlobj = xsltmanagers.xmlifyiter(
            dictlist,
            "Simple",
            attriba="a",
            otherattrib="c"
            )

        # Use objects and NOT values
        context_key = 'foo%d' % self.time
        c = Context({ 
                context_key: xmlobj,
                })

        res = transformer(context=c)
        assertXpath(
            res, 
            '//simples/simple[@attriba="%s"]' % 10
            )
예제 #2
0
            #        ]

            importer_contacts = tools.import_contacts(
                request.user, form.cleaned_data["email"],
                form.cleaned_data["password"])
        except LoginException, e:
            return HttpResponseServerError("bad login")
        except Exception, e:
            # FIXME
            logger.exception(e)
            return HttpResponse("no contacts")
        else:
            # FIXME - use the new xmlify stuff
            contacts = xmlifyiter(
                importer_contacts,
                "{http://djangoproject.com/template/xslt}contact",
                id="id",
                contact_name="name",
                email="email")

            # Where should the POST go?
            action_url = url_reverse("contactstore.views.create_invites")

            ctx = RequestContext(request, {
                "contacts": contacts,
                "action_url": action_url
            })

            response = render_to_response("share-result.xslt", ctx)
            print response.content
            return response
예제 #3
0
                request.user,
                form.cleaned_data["email"],
                form.cleaned_data["password"]
                )
        except LoginException, e:
            return HttpResponseServerError("bad login")
        except Exception, e:
            # FIXME
            logger.exception(e)
            return HttpResponse("no contacts")
        else:
            # FIXME - use the new xmlify stuff
            contacts = xmlifyiter(
                importer_contacts, 
                "{http://djangoproject.com/template/xslt}contact",
                id="id",
                contact_name="name",
                email="email"
                )

            # Where should the POST go?
            action_url = url_reverse("contactstore.views.create_invites")

            ctx = RequestContext(request, {
                    "contacts": contacts,
                    "action_url": action_url
                    })

            response = render_to_response("share-result.xslt", ctx)
            print response.content
            return response