Пример #1
0
    def get(self, request, *args, **kwargs):
        try:
            context = self.get_context_data(**kwargs)
        except Exception as e:
            logger.exception(e)
            raise

        post_id = view_helpers.check_invoice(memo=context.get("memo"), node_id=context.get("node_id"))
        if post_id:
            return view_helpers.post_redirect(pid=post_id, request=request, permanent=False)

        return super(PostPublishView, self).get(request, *args, **kwargs)
Пример #2
0
    def get(self, request, *args, **kwargs):
        try:
            context = self.get_context_data(**kwargs)
        except Exception as e:
            logger.exception(e)
            raise

        if "node_name" not in context:
            return render(request, self.template_name, context)  # Prints a firendy No Nodes found error

        post_id = view_helpers.check_invoice(memo=context.get("memo"), node_id=context.get("node_id"))
        if post_id:
            return view_helpers.post_redirect(pid=post_id, request=request, permanent=False)

        return super(VotePublishView, self).get(request, *args, **kwargs)
Пример #3
0
    def get(self, request, *args, **kwargs):
        try:
            context = self.get_context_data(**kwargs)
        except ln.LNUtilError as msg:
            logger.exception(msg)
            # empty context will trigger "Sorry, no LN Nodes are currently available"
            context = {}
            return render(request, self.template_name, context)

        except Exception as e:
            logger.exception(e)
            raise

        post_id = view_helpers.check_invoice(memo=context.get("memo"),
                                             node_id=context.get("node_id"))
        if post_id:
            return view_helpers.post_redirect(pid=post_id,
                                              request=request,
                                              permanent=False)

        return render(request, self.template_name, context)