예제 #1
0
    def root(self, request: IRequest, tag: Tag) -> KleinRenderable:
        """
        Root element.
        """
        user = getattr(request, "user", None)
        if user is None:
            username = "******"
        else:
            try:
                username = user.shortNames[0]
            except IndexError:
                username = "******"

        slots = dict(user=username)

        tag.fillSlots(**slots)

        return tag
예제 #2
0
 def destination(self, request: IRequest, tag: Tag) -> str:
     """
     JSON string: URL for the redirect destination.
     """
     return cast(str, tag.fillSlots(destination_url=self.location.asText()))
예제 #3
0
 def renderMethod(
     self, request: Optional[IRequest], tag: Tag
 ) -> Flattenable:
     return tag.fillSlots(test2="world.")
예제 #4
0
 def fillSlot(tag: Tag) -> Tag:
     return tag.fillSlots(stuff=toss.pop())
예제 #5
0
 def sourceLink(self, request: object, tag: Tag) -> "Flattenable":
     if self.ob.sourceHref:
         return tag.fillSlots(sourceHref=self.ob.sourceHref)
     else:
         return ()
예제 #6
0
 def destination(self, request: IRequest, tag: Tag) -> str:
     """
     JSON string: URL for the redirect destination.
     """
     return tag.fillSlots(destination_url=self.location.asText())