def process_internal(self, flowdata):

        contents = {"one": 1, "two": 2}

        data = ElementDataDictionary(self, contents)

        flowdata.set_element_data(data)
Exemplo n.º 2
0
    def process_internal(self, flowdata):

        self.properties = {"integer": {"type": "int"}}

        data = ElementDataDictionary(self, {"integer": 5})

        flowdata.set_element_data(data)
Exemplo n.º 3
0
    def process_internal(self, flowdata):

        yes = AspectPropertyValue(value="yes")
        no = AspectPropertyValue(no_value_message="no")

        data = ElementDataDictionary(self, {"yes": yes, "no": no})

        flowdata.set_element_data(data)
    def process_internal(self, flowdata):

        contents = {}

        contents["javascript"] = "console.log('hello world')"
        contents["normal"] = True

        contents["apvGood"] = AspectPropertyValue(None, "Value")
        contents["apvBad"] = AspectPropertyValue("No value")

        data = ElementDataDictionary(self, contents)

        flowdata.set_element_data(data)
    def process_internal(self, flowdata):

        result = {}
        
        # Get the date of birth from the query string (submitted through 
        # a form on the client side)
        dateOfBirth = flowdata.evidence.get("query.dateOfBirth")
        
        if dateOfBirth:

            dateOfBirth = dateOfBirth.split('-') 

            month = int(dateOfBirth[1]) 
            day = int(dateOfBirth[2])

            result["starSign"] = getStarSign(month, day)

      
        # Serve some JavaScript to the user that will be used to save 
        # a cookie with the user's latitude in it
        result["getLatitude"] = """
        navigator.geolocation.getCurrentPosition(function(position) {
            document.cookie = \"latitude=\" + position.coords.latitude;
            console.log(document.cookie)
            loadHemisphere();
        });
        """

        # Get the latitude from the above cookie
        latitude = flowdata.evidence.get("cookie.latitude")

        # Calculate the hemisphere
        if latitude:

            result["hemisphere"] = "Northern" if float(latitude) > 0 else "Southern"
          
        data = ElementDataDictionary(self, result)

        flowdata.set_element_data(data)
Exemplo n.º 6
0
    def process_internal(self, flowdata):

        data = ElementDataDictionary(self, {"integer": 7})

        flowdata.set_element_data(data)