!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache/2.2.16 (Debian). PHP/5.3.3-7+squeeze19 

uname -a: Linux mail.tri-specialutilitydistrict.com 2.6.32-5-amd64 #1 SMP Tue May 13 16:34:35 UTC
2014 x86_64
 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/share/doc/python-nevow/examples/formpost/   drwxr-xr-x
Free 129.81 GB of 142.11 GB (91.34%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     formpost2.py (2.87 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
# -*- python -*-

from zope.interface import implements

from nevow import loaders
from nevow import rend
from nevow import tags
from nevow import inevow
from nevow import url

from formless import annotate
from formless import webform

from twisted.internet import defer


#oldChoicesWay = annotate.Choice(choicesAttribute='theChoices') # Doing this gives you a DeprecationWarning now

# If you still want to use an attribute or method of some other object, you should use a function as shown below,
# but look up IResource(ctx) or IConfigurable(ctx), whichever is more appropriate.
newChoicesWay = annotate.Choice(lambda c, d: range(30))
deferChoicesWay = annotate.Choice(lambda c, d: defer.succeed(['abcd', 'efgh', 'ijkl']))
radioChoices = annotate.Radio(["Old", "Tyme", "Radio"])

## An example of using custom valueToKey and keyToValue functions to serialize/deserialize items
values = {0: dict(name="Zero", stuff=1234), 1: dict(name="One", stuff=1234), 2: dict(name="Two", stuff=2345435)}
customValueToKey = annotate.Choice(
    [0, 1, 2], # Perhaps these are primary keys in a database
    stringify=lambda x: values[x]['name'], # Do a database lookup to render a nice label in the ui
    valueToKey=str,                                  # Convert the primary key to a value suitable for sending across the web
    keyToValue=lambda x: values[int(x)]) # Do a database lookup to get the actual value to pass to the binding


class IMyForm(annotate.TypedInterface):
    foo = annotate.Integer()

    def bar(baz=annotate.Integer(), 
        slam=newChoicesWay, ham=deferChoicesWay, radio=radioChoices, custom=customValueToKey):
        pass
    bar = annotate.autocallable(bar)


class Implementation(object):
    implements(IMyForm)

    foo = 5

    def bar(self, baz, slam, ham, radio, custom):
        return "You called bar! %s %s %s %s %r" % (baz, slam, ham, radio, custom)

    theChoices = [1, 2, 3]


class FormPage(rend.Page):

    addSlash = True

    child_webform_css = webform.defaultCSS

    def render_hand(self, ctx, data):
        hand = inevow.IHand(ctx, None)
        if hand is not None:
            return ctx.tag[hand]
        return ''

    docFactory = loaders.stan(
        tags.html[
            tags.head[
                tags.link(rel='stylesheet', type='text/css', href=url.here.child('webform_css')),
                ],
            tags.body[
                tags.h3(render=render_hand, style="color: red; font-size: xx-large"),
                "Hello! Here is a form:",

                # We want to render forms defined by the Implementation instance.
                # When we pass the Implementation instance to FormPage below,
                # rend.Page sets it as the .original attribute. To tell webform to render
                # forms described by this object, we use the configurable name "original".
                webform.renderForms('original'),
                ],
            ],
        )


:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.0113 ]--