« Return to Thread: Re: [pyamf-commits] r1155 - in examples/trunk: . google_appengine google_appengine/echo google_appengine/static google_appengine/static/swfobject google_appengine/static/swfobject/src google_appengine/templates

Re: [pyamf-commits] r1155 - in examples/trunk: . google_appengine google_appengine/echo google_appengine/static google_appengine/static/swfobject google_appengine/static/swfobject/src google_appengine/templates

by Arnar Birgisson :: Rate this Message:

Reply to Author | View in Thread

Hey,

I'm good, thanks for asking. Done with courses, next 12 months I'll be
focusing on my thesis :)

I'll stop by on irc.

cheers,
Arnar

On Thu, Apr 10, 2008 at 3:14 PM, Nick Joyce <nick@...> wrote:

> Hey Arnar,
>
> How's it going? Hope you are still enjoying the course ..
>
> Been on irc much? We moved server! irc://irc.collab.eu/collab
>
> Thanks for the tip, committed in r1156.
>
> Cheers,
>
> Nick
>
>
> On 10 Apr 2008, at 15:30, Arnar Birgisson wrote:
> Hey Nick,
>
> I think there's no need for the overhead of a script for
> crossdomain.xml. Just use "static_files" in the app.yaml:
>
> - url: /crossdomain.xml
>   static_files: crossdomain.xml
>
> Arnar
>
> On Thu, Apr 10, 2008 at 2:25 PM, SVN commit logs for PyAMF
> <commits@...> wrote:
> Author: nick
>  Date: 2008-04-10 16:25:48 +0200 (Thu, 10 Apr 2008)
>  New Revision: 1155
>
>  Added:
>    examples/trunk/google_appengine/
>    examples/trunk/google_appengine/app.yaml
>    examples/trunk/google_appengine/crossdomain.py
>    examples/trunk/google_appengine/echo/
>    examples/trunk/google_appengine/echo/__init__.py
>    examples/trunk/google_appengine/echo/__init__.pyc
>    examples/trunk/google_appengine/echo/gateway.py
>    examples/trunk/google_appengine/echo/index.py
>    examples/trunk/google_appengine/index.html
>    examples/trunk/google_appengine/index.py
>    examples/trunk/google_appengine/static/
>    examples/trunk/google_appengine/static/echo_test.swf
>    examples/trunk/google_appengine/static/swfobject/
>    examples/trunk/google_appengine/static/swfobject/expressInstall.swf
>    examples/trunk/google_appengine/static/swfobject/index.html
>    examples/trunk/google_appengine/static/swfobject/index_dynamic.html
>    examples/trunk/google_appengine/static/swfobject/src/
>    examples/trunk/google_appengine/static/swfobject/src/expressInstall.as
>    examples/trunk/google_appengine/static/swfobject/src/expressInstall.fla
>    examples/trunk/google_appengine/static/swfobject/src/swfobject.js
>    examples/trunk/google_appengine/static/swfobject/swfobject.js
>    examples/trunk/google_appengine/static/swfobject/test.swf
>    examples/trunk/google_appengine/templates/
>    examples/trunk/google_appengine/templates/base.html
>    examples/trunk/google_appengine/templates/swf.html
>  Log:
>  Adding working EchoTest Google AppEngine example
>
>
>  Property changes on: examples/trunk/google_appengine
>  ___________________________________________________________________
>  Name: svn:ignore
>    + *.pyc
>  pyamf
>
>
>  Added: examples/trunk/google_appengine/app.yaml
>  ===================================================================
>  --- examples/trunk/google_appengine/app.yaml
> (rev 0)
>  +++ examples/trunk/google_appengine/app.yaml    2008-04-10 14:25:48 UTC
> (rev 1155)
>  @@ -0,0 +1,22 @@
>  +application: pyamf
>  +version: 1
>  +runtime: python
>  +api_version: 1
>  +
>  +handlers:
>  +- url: /
>  +  script: index.py
>  +
>  +- url: /crossdomain.xml
>  +  script: crossdomain.py
>  +
>  +# Echo demo urls
>  +
>  +- url: /echo
>  +  script: echo/index.py
>  +
>  +- url: /gateway/echo
>  +  script: echo/gateway.py
>  +
>  +- url: /static
>  +  static_dir: static
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/crossdomain.py
>  ===================================================================
>  --- examples/trunk/google_appengine/crossdomain.py
> (rev 0)
>  +++ examples/trunk/google_appengine/crossdomain.py      2008-04-10 14:25:48
> UTC (rev 1155)
>  @@ -0,0 +1,7 @@
>  +print 'Content-Type: application/xml'
>  +print
>  +print """<?xml version="1.0"?>
>  +<!DOCTYPE cross-domain-policy SYSTEM
> "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
>  +<cross-domain-policy>
>  +   <allow-access-from domain="*" />
>  +</cross-domain-policy>"""
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/echo/__init__.py
>  ===================================================================
>  --- examples/trunk/google_appengine/echo/__init__.py
> (rev 0)
>  +++ examples/trunk/google_appengine/echo/__init__.py    2008-04-10 14:25:48
> UTC (rev 1155)
>  @@ -0,0 +1,111 @@
>  +# -*- encoding: utf-8 -*-
>  +#
>  +# Copyright (c) 2007-2008 The PyAMF Project.
>  +# See LICENSE for details.
>  +
>  +"""
>  +Echo test core functionality. This module sets up the class
>  +mappings related to the echo_test.swf client on the
>  +U{EchoTest<http://pyamf.org/wiki/EchoTest>} wiki page.
>  +
>  +@author: U{Nick Joyce<mailto:nick@...>}
>  +@since: 0.1.0
>  +"""
>  +
>  +from pyamf import register_class
>  +
>  +ECHO_NS = 'org.red5.server.webapp.echo'
>  +
>  +class RemoteClass(object):
>  +    """
>  +    This Python class is mapped to the clientside ActionScript class.
>  +    """
>  +    pass
>  +
>  +class ExternalizableClass(object):
>  +    """
>  +    An example of an externalizable class.
>  +    """
>  +    def __readamf__(self, input):
>  +        """
>  +        This function is invoked when the C{obj} needs to be deserialized.
>  +
>  +        @type obj: L{ExternalizableClass}
>  +        @param obj: The object in question.
>  +        @param input: The input stream to read from.
>  +        @type input L{DataInput<pyamf.amf3.DataInput>}
>  +        """
>  +        assert input.readBoolean() == True
>  +        assert input.readBoolean() == False
>  +        assert input.readByte() == 0
>  +        assert input.readByte() == -1
>  +        assert input.readByte() == 1
>  +        assert input.readByte() == 127
>  +        assert input.readByte() == -127
>  +        assert input.readDouble() == 1.0
>  +        assert input.readFloat() == 2.0
>  +        assert input.readInt() == 0
>  +        assert input.readInt() == -1
>  +        assert input.readInt() == 1
>  +        input.readMultiByte(7, 'iso-8859-1')
>  +        input.readMultiByte(14, 'utf8')
>  +        assert input.readObject() == [1, 'one', 1.0]
>  +        assert input.readShort() == 0
>  +        assert input.readShort() == -1
>  +        assert input.readShort() == 1
>  +        assert input.readUnsignedInt() == 0
>  +        assert input.readUnsignedInt() == 1
>  +        assert input.readUTF() == "Hello world!"
>  +        assert input.readUTFBytes(12) == "Hello world!"
>  +
>  +    def __writeamf__(self, output):
>  +        """
>  +        This function is invoked when the C{obj} needs to be serialized.
>  +
>  +        @type obj: L{ExternalizableClass}
>  +        @param obj: The object in question.
>  +        @param input: The output stream to write to.
>  +        @type input L{DataOutput<pyamf.amf3.DataOutput>}
>  +        """
>  +        output.writeBoolean(True)
>  +        output.writeBoolean(False)
>  +        output.writeByte(0)
>  +        output.writeByte(-1)
>  +        output.writeByte(1)
>  +        output.writeByte(127)
>  +        output.writeByte(-127)
>  +        output.writeDouble(1.0)
>  +        output.writeFloat(2.0)
>  +        output.writeInt(0)
>  +        output.writeInt(-1)
>  +        output.writeInt(1)
>  +        output.writeMultiByte(u"\xe4\xf6\xfc\xc4\xd6\xdc\xdf",
> 'iso-8859-1')
>  +        output.writeMultiByte(u"\xe4\xf6\xfc\xc4\xd6\xdc\xdf", 'utf8')
>  +        output.writeObject([1, 'one', 1])
>  +        output.writeShort(0)
>  +        output.writeShort(-1)
>  +        output.writeShort(1)
>  +        output.writeUnsignedInt(0)
>  +        output.writeUnsignedInt(1)
>  +        output.writeUTF("Hello world!")
>  +        output.writeUTFBytes("Hello world!")
>  +
>  +def echo(data):
>  +    """
>  +    Return data back to the client.
>  +
>  +    @type data: C{mixed}
>  +    @param data: Decoded AS->Python data.
>  +    """
>  +    return data
>  +
>  +# Map ActionScript class to Python class
>  +try:
>  +    register_class(RemoteClass, '%s.%s' % (ECHO_NS, 'RemoteClass'))
>  +except ValueError:
>  +    pass
>  +try:
>  +    register_class(ExternalizableClass, '%s.%s' % (ECHO_NS,
>  +        'ExternalizableClass'), metadata=['external'])
>  +except ValueError:
>  +    pass
>
>  Added: examples/trunk/google_appengine/echo/__init__.pyc
>  ===================================================================
>  (Binary files differ)
>
>
>  Property changes on: examples/trunk/google_appengine/echo/__init__.pyc
>  ___________________________________________________________________
>  Name: svn:mime-type
>    + application/octet-stream
>
>  Added: examples/trunk/google_appengine/echo/gateway.py
>  ===================================================================
>  --- examples/trunk/google_appengine/echo/gateway.py
> (rev 0)
>  +++ examples/trunk/google_appengine/echo/gateway.py     2008-04-10 14:25:48
> UTC (rev 1155)
>  @@ -0,0 +1,17 @@
>  +from pyamf.remoting.gateway.wsgi import WSGIGateway
>  +from google.appengine.ext.webapp import util
>  +
>  +from echo import echo
>  +
>  +services = {
>  +    'echo': echo,
>  +    'echo.echo': echo
>  +}
>  +
>  +def main():
>  +    gateway = WSGIGateway(services)
>  +
>  +    util.run_wsgi_app(gateway)
>  +
>  +if __name__ == "__main__":
>  +    main()
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/echo/index.py
>  ===================================================================
>  --- examples/trunk/google_appengine/echo/index.py
> (rev 0)
>  +++ examples/trunk/google_appengine/echo/index.py       2008-04-10 14:25:48
> UTC (rev 1155)
>  @@ -0,0 +1,10 @@
>  +from google.appengine.ext.webapp import template
>  +
>  +print "Content-Type: text/html"
>  +print
>  +print template.render('../templates/swf.html', {
>  +    'swf_url': '/static/echo_test.swf',
>  +    'width': '100%',
>  +    'height': '100%',
>  +    'flash_ver': '9.0.0'
>  +})
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/index.html
>  ===================================================================
>  --- examples/trunk/google_appengine/index.html
> (rev 0)
>  +++ examples/trunk/google_appengine/index.html  2008-04-10 14:25:48 UTC
> (rev 1155)
>  @@ -0,0 +1,11 @@
>  +{% extends "templates/base.html" %}
>  +
>  +{% block title %}PyAMF/Google App Engine Demo Application{% endblock %}
>  +
>  +{% block body %}
>  +<h1><a href="http://pyamf.org">PyAMF</a>/<a href="">Google App Engine</a>
> Demo Application</h1>
>  +<h2>Available demos:</h2>
>  +<ul>
>  +       <li><a href="/echo">EchoTest</a> - Tests all parts of the AMF
> specification, including AMF0, AMF3 and RemoteObject</li>
>  +</ul>
>  +{% endblock %}
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/index.py
>  ===================================================================
>  --- examples/trunk/google_appengine/index.py
> (rev 0)
>  +++ examples/trunk/google_appengine/index.py    2008-04-10 14:25:48 UTC
> (rev 1155)
>  @@ -0,0 +1,5 @@
>  +from google.appengine.ext.webapp import template
>  +
>  +print "Content-Type: text/html"
>  +print
>  +print template.render('index.html', {})
>  \ No newline at end of file
>
>  Added: examples/trunk/google_appengine/static/echo_test.swf
>  ===================================================================
>  (Binary files differ)
>
>
>  Property changes on: examples/trunk/google_appengine/static/echo_test.swf
>  ___________________________________________________________________
>  Name: svn:mime-type
>    + application/octet-stream
>
>  Added: examples/trunk/google_appengine/static/swfobject/expressInstall.swf
>  ===================================================================
>  (Binary files differ)
>
>
>  Property changes on:
> examples/trunk/google_appengine/static/swfobject/expressInstall.swf
>  ___________________________________________________________________
>  Name: svn:executable
>    + *
>  Name: svn:mime-type
>    + application/octet-stream
>
>  Added: examples/trunk/google_appengine/static/swfobject/index.html
>  ===================================================================
>  --- examples/trunk/google_appengine/static/swfobject/index.html
> (rev 0)
>  +++ examples/trunk/google_appengine/static/swfobject/index.html 2008-04-10
> 14:25:48 UTC (rev 1155)
>  @@ -0,0 +1,28 @@
>  +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>  +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
>  +       <head>
>  +               <title>SWFObject v2.0 sample page</title>
>  +               <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
>  +               <script type="text/javascript" src="swfobject.js"></script>
>  +               <script type="text/javascript">
>  +               swfobject.registerObject("myId", "9.0.0",
> "expressInstall.swf");
>  +               </script>
>  +       </head>
>  +       <body>
>  +               <div>
>  +                       <object id="myId"
> classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="300"
> height="120">
>  +                               <param name="movie" value="test.swf" />
>  +                       <!--[if !IE]>-->
>  +                               <object
> type="application/x-shockwave-flash" data="test.swf" width="300"
> height="120">
>  +                               <!--<![endif]-->
>  +                               <div>
>  +                                       <h1>Alternative content</h1>
>  +                                       <p><a
> href="http://www.adobe.com/go/getflashplayer"><img
> src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
> alt="Get Adobe Flash player" /></a></p>
>  +                               </div>
>  +                               <!--[if !IE]>-->
>  +                               </object>
>  +                               <!--<![endif]-->
>  +                       </object>
>  +               </div>
>  +       </body>
>  +</html>
>
>
>  Property changes on:
> examples/trunk/google_appengine/static/swfobject/index.html
>  ___________________________________________________________________
>  Name: svn:executable
>    + *
>
>  Added: examples/trunk/google_appengine/static/swfobject/index_dynamic.html
>  ===================================================================
>  --- examples/trunk/google_appengine/static/swfobject/index_dynamic.html
> (rev 0)
>  +++ examples/trunk/google_appengine/static/swfobject/index_dynamic.html
> 2008-04-10 14:25:48 UTC (rev 1155)
>  @@ -0,0 +1,17 @@
>  +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
>  +<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
>  +       <head>
>  +               <title>SWFObject v2.0 dynamic embed sample page</title>
>  +               <meta http-equiv="Content-Type" content="text/html;
> charset=iso-8859-1" />
>  +               <script type="text/javascript" src="swfobject.js"></script>
>  +               <script type="text/javascript">
>  +               swfobject.embedSWF("test.swf", "myContent", "300", "120",
> "9.0.0", "expressInstall.swf");
>  +               </script>
>  +       </head>
>  +       <body>
>  +               <div id="myContent">
>  +                       <h1>Alternative content</h1>
>  +                       <p><a
> href="http://www.adobe.com/go/getflashplayer"><img
> src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
> alt="Get Adobe Flash player" /></a></p>
>  +               </div>
>  +       </body>
>  +</html>
>
>
>  Property changes on:
> examples/trunk/google_appengine/static/swfobject/index_dynamic.html
>  ___________________________________________________________________
>  Name: svn:executable
>    + *
>
>  Added:
> examples/trunk/google_appengine/static/swfobject/src/expressInstall.as
>  ===================================================================
>  --- examples/trunk/google_appengine/static/swfobject/src/expressInstall.as
> (rev 0)
>  +++ examples/trunk/google_appengine/static/swfobject/src/expressInstall.as
> 2008-04-10 14:25:48 UTC (rev 1155)
>  @@ -0,0 +1,76 @@
>  +/*     =============================
>  +       SWFObject v2.0 <http://code.google.com/p/swfobject/>
>  +       Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van
> der Sluis
>  +       This software is released under the MIT License
> <http://www.opensource.org/licenses/mit-license.php>
>  +       =============================
>  +       Express Install
>  +       Copyright (c) 2005-2007 Adobe Systems Incorporated and its
> licensors. All Rights Reserved.
>  +       =============================
>  +       AS1 version
>  +       =============================
>  +*/
>  +
>  +System.security.allowDomain("fpdownload.macromedia.com");
>  +
>  +var cacheBuster        = Math.random();
>  +var updateSWF  =
> "http://fpdownload.macromedia.com/pub/flashplayer/update/current/swf/autoUpdater.swf?"+cacheBuster;
>  +var bytes              = loaderClip.getBytesTotal();
>  +loaderClip.loadMovie(updateSWF);
>  +
>  +var time               = 0;
>  +var timeOut            = 5;    // expressed in seconds
>  +var delay              = 10;   // expressed in milliseconds
>  +var id                 = setInterval(checkLoaded, delay);
>  +
>  +function checkLoaded(){
>  +       if(loaderClip.startUpdate.toString() == "[type Function]"){
>  +               // updater has loaded successfully
>  +               clearInterval(id);
>  +               loadComplete();
>  +               return;
>  +       }
>  +       else if(time > timeOut){
>  +               // updater did not load in time, abort load and force
> alternative content
>  +               clearInterval(id);
>  +               loaderClip.unloadMovie();
>  +               loadTimeOut();
>  +               return;
>  +       }
>  +       time += delay/1000;
>  +}
>  +
>  +function loadComplete(){
>  +       loaderClip.redirectURL  = _root.MMredirectURL;
>  +       loaderClip.MMplayerType = _root.MMplayerType;
>  +       loaderClip.MMdoctitle   = _root.MMdoctitle;
>  +       loaderClip.startUpdate();
>  +}
>  +
>  +function loadTimeOut(){
>  +       callbackSWFObject();
>  +}
>  +
>  +function installStatus(statusValue){
>  +       switch(statusValue){
>  +               case "Download.Complete":
>  +                       // Installation is complete.
>  +                       // In most cases the browser window that this SWF
> is hosted in will be closed by the installer or
>  +                       // otherwise it has to be closed manually by the
> end user.
>  +                       // The Adobe Flash installer will reopen the
> browser window and reload the page containing the SWF.
>  +               break;
>  +               case "Download.Cancelled":
>  +                       // The end user chose "NO" when prompted to install
> the new player.
>  +                       // By default the SWFObject callback function is
> called to force alternative content.
>  +                       callbackSWFObject();
>  +               break;
>  +               case "Download.Failed":
>  +                       // The end user failed to download the installer
> due to a network failure.
>  +                       // By default the SWFObject callback function is
> called to force alternative content.
>  +                       callbackSWFObject();
>  +               break;
>  +       }
>  +}
>  +
>  +function callbackSWFObject(){
>  +       getURL("javascript:swfobject.expressInstallCallback();");
>  +}
>  \ No newline at end of file
>
>
>  Property changes on:
> examples/trunk/google_appengine/static/swfobject/src/expressInstall.as
>  ___________________________________________________________________
>  Name: svn:executable
>    + *
>
>  Added:
> examples/trunk/google_appengine/static/swfobject/src/expressInstall.fla
>  ===================================================================
>  (Binary files differ)
>
>
>  Property changes on:
> examples/trunk/google_appengine/static/swfobject/src/expressInstall.fla
>  ___________________________________________________________________
>  Name: svn:executable
>    + *
>  Name: svn:mime-type
>    + application/octet-stream
>
>  Added: examples/trunk/google_appengine/static/swfobject/src/swfobject.js
>  ===================================================================
>  --- examples/trunk/google_appengine/static/swfobject/src/swfobject.js
> (rev 0)
>  +++ examples/trunk/google_appengine/static/swfobject/src/swfobject.js
> 2008-04-10 14:25:48 UTC (rev 1155)
>  @@ -0,0 +1,631 @@
>  +/*!    SWFObject v2.0 <http://code.google.com/p/swfobject/>
>  +       Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van
> der Sluis
>  +       This software is released under the MIT License
> <http://www.opensource.org/licenses/mit-license.php>
>  +*/
>  +
>  +var swfobject = function() {
>  +
>  +       var UNDEF = "undefined",
>  +               OBJECT = "object",
>  +               SHOCKWAVE_FLASH = "Shockwave Flash",
>  +               SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
>  +               FLASH_MIME_TYPE = "application/x-shockwave-flash",
>  +               EXPRESS_INSTALL_ID = "SWFObjectExprInst",
>  +
>  +               win = window,
>  +               doc = document,
>  +               nav = navigator,
>  +
>  +               domLoadFnArr = [],
>  +               regObjArr = [],
>  +               timer = null,
>  +               storedAltContent = null,
>  +               storedAltContentId = null,
>  +               isDomLoaded = false,
>  +               isExpressInstallActive = false;
>  +
>  +       /* Centralized function for browser feature detection
>  +               - Proprietary feature detection (conditional compiling) is
> used to detect Internet Explorer's features
>  +               - User agent string detection is only used when no
> alternative is possible
>  +               - Is executed directly for optimal performance
>  +       */
>  +       var ua = function() {
>  +               var w3cdom = typeof doc.getElementById != UNDEF && typeof
> doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF &&
> typeof doc.appendChild != UNDEF && typeof doc.replaceChild != UNDEF &&
> typeof doc.removeChild != UNDEF && typeof doc.cloneNode != UNDEF,
>  +                       playerVersion = [0,0,0],
>  +                       d = null;
>  +               if (typeof nav.plugins != UNDEF && typeof
> nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
>  +                       d = nav.plugins[SHOCKWAVE_FLASH].description;
>  +                       if (d) {
>  +                               d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
>  +                               playerVersion[0] =
> parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
>  +                               playerVersion[1] =
> parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
>  +                               playerVersion[2] = /r/.test(d) ?
> parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0;
>  +                       }
>  +               }
>  +               else if (typeof win.ActiveXObject != UNDEF) {
>  +                       var a = null, fp6Crash = false;
>  +                       try {
>  +                               a = new ActiveXObject(SHOCKWAVE_FLASH_AX +
> ".7");
>  +                       }
>  +                       catch(e) {
>  +                               try {
>  +                                       a = new
> ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
>  +                                       playerVersion = [6,0,21];
>  +                                       a.AllowScriptAccess = "always";  //
> Introduced in fp6.0.47
>  +                               }
>  +                               catch(e) {
>  +                                       if (playerVersion[0] == 6) {
>  +                                               fp6Crash = true;
>  +                                       }
>  +                               }
>  +                               if (!fp6Crash) {
>  +                                       try {
>  +                                               a = new
> ActiveXObject(SHOCKWAVE_FLASH_AX);
>  +                                       }
>  +                                       catch(e) {}
>  +                               }
>  +                       }
>  +                       if (!fp6Crash && a) { // a will return null when
> ActiveX is disabled
>  +                               try {
>  +                                       d = a.GetVariable("$version");  //
> Will crash fp6.0.21/23/29
>  +                                       if (d) {
>  +                                               d = d.split("
> ")[1].split(",");
>  +                                               playerVersion =
> [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)];
>  +                                       }
>  +                               }
>  +                               catch(e) {}
>  +                       }
>  +               }
>  +               var u = nav.userAgent.toLowerCase(),
>  +                       p = nav.platform.toLowerCase(),
>  +                       webkit = /webkit/.test(u) ?
> parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false, //
> returns either the webkit version or false if not webkit
>  +                       ie = false,
>  +                       windows = p ? /win/.test(p) : /win/.test(u),
>  +                       mac = p ? /mac/.test(p) : /mac/.test(u);
>  +               /*@cc_on
>  +                       ie = true;
>  +                       @if (@_win32)
>  +                               windows = true;
>  +                       @elif (@_mac)
>  +                               mac = true;
>  +                       @end
>  +               @*/
>  +               return { w3cdom:w3cdom, pv:playerVersion, webkit:webkit,
> ie:ie, win:windows, mac:mac };
>  +       }();
>  +
>  +       /* Cross-browser onDomLoad
>  +               - Based on Dean Edwards' solution:
> http://dean.edwards.name/weblog/2006/06/again/
>  +               - Will fire an event as soon as the DOM of a page is loaded
> (supported by Gecko based browsers - like Firefox -, IE, Opera9+, Safari)
>  +       */
>  +       var onDomLoad = function() {
>  +               if (!ua.w3cdom) {
>  +                       return;
>  +               }
>  +               addDomLoadEvent(main);
>  +               if (ua.ie && ua.win) {
>  +                       try {  // Avoid a possible Operation Aborted error
>  +                               doc.write("<scr" + "ipt id=__ie_ondomload
> defer=true src=//:></scr" + "ipt>"); // String is split into pieces to avoid
> Norton AV to add code that can cause errors
>  +                               var s = getElementById("__ie_ondomload");
>  +                               if (s) {
>  +                                       s.onreadystatechange = function() {
>  +                                               if (this.readyState ==
> "complete") {
>  +
> this.parentNode.removeChild(this);
>  +
> callDomLoadFunctions();
>  +                                               }
>  +                                       };
>  +                               }
>  +                       }
>  +                       catch(e) {}
>  +               }
>  +               if (ua.webkit && typeof doc.readyState != UNDEF) {
>  +                       timer = setInterval(function() { if
> (/loaded|complete/.test(doc.readyState)) { callDomLoadFunctions(); }}, 10);
>  +               }
>  +               if (typeof doc.addEventListener != UNDEF) {
>  +                       doc.addEventListener("DOMContentLoaded",
> callDomLoadFunctions, null);
>  +               }
>  +               addLoadEvent(callDomLoadFunctions);
>  +       }();
>  +
>  +       function callDomLoadFunctions() {
>  +               if (isDomLoaded) {
>  +                       return;
>  +               }
>  +               if (ua.ie && ua.win) { // Test if we can really add
> elements to the DOM; we don't want to fire it too early
>  +                       var s = createElement("span");
>  +                       try { // Avoid a possible Operation Aborted error
>  +                               var t =
> doc.getElementsByTagName("body")[0].appendChild(s);
>  +                               t.parentNode.removeChild(t);
>  +                       }
>  +                       catch (e) {
>  +                               return;
>  +                       }
>  +               }
>  +               isDomLoaded = true;
>  +               if (timer) {
>  +                       clearInterval(timer);
>  +                       timer = null;
>  +               }
>  +               var dl = domLoadFnArr.length;
>  +               for (var i = 0; i < dl; i++) {
>  +                       domLoadFnArr[i]();
>  +               }
>  +       }
>  +
>  +       function addDomLoadEvent(fn) {
>  +               if (isDomLoaded) {
>  +                       fn();
>  +               }
>  +               else {
>  +                       domLoadFnArr[domLoadFnArr.length] = fn; //
> Array.push() is only available in IE5.5+
>  +               }
>  +       }
>  +
>  +       /* Cross-browser onload
>  +               - Based on James Edwards' solution:
> http://brothercake.com/site/resources/scripts/onload/
>  +               - Will fire an event as soon as a web page including all of
> its assets are loaded
>  +        */
>  +       function addLoadEvent(fn) {
>  +               if (typeof win.addEventListener != UNDEF) {
>  +                       win.addEventListener("load", fn, false);
>  +               }
>  +               else if (typeof doc.addEventListener != UNDEF) {
>  +                       doc.addEventListener("load", fn, false);
>  +               }
>  +               else if (typeof win.attachEvent != UNDEF) {
>  +                       win.attachEvent("onload", fn);
>  +               }
>  +               else if (typeof win.onload == "function") {
>  +                       var fnOld = win.onload;
>  +                       win.onload = function() {
>  +                               fnOld();
>  +                               fn();
>  +                       };
>  +               }
>  +               else {
>  +                       win.onload = fn;
>  +               }
>  +       }
>  +
>  +       /* Main function
>  +               - Will preferably execute onDomLoad, otherwise onload (as a
> fallback)
>  +       */
>  +       function main() { // Static publishing only
>  +               var rl = regObjArr.length;
>  +               for (var i = 0; i < rl; i++) { // For each registered
> object element
>  +                       var id = regObjArr[i].id;
>  +                       if (ua.pv[0] > 0) {
>  +                               var obj = getElementById(id);
>  +                               if (obj) {
>  +                                       regObjArr[i].width =
> obj.getAttribute("width") ? obj.getAttribute("width") : "0";
>  +                                       regObjArr[i].height =
> obj.getAttribute("height") ? obj.getAttribute("height") : "0";
>  +                                       if
> (hasPlayerVersion(regObjArr[i].swfVersion)) { // Flash plug-in version >=
> Flash content version: Houston, we have a match!
>  +                                               if (ua.webkit && ua.webkit
> < 312) { // Older webkit engines ignore the object element's nested param
> elements
>  +                                                       fixParams(obj);
>  +                                               }
>  +                                               setVisibility(id, true);
>  +                                       }
>  +                                       else if
> (regObjArr[i].expressInstall && !isExpressInstallActive &&
> hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) { // Show the Adobe
> Express Install dialog if set by the web page author and if supported
> (fp6.0.65+ on Win/Mac OS only)
>  +
> showExpressInstall(regObjArr[i]);
>  +                                       }
>  +                                       else { // Flash plug-in and Flash
> content version mismatch: display alternative content instead of Flash
> content
>  +                                               displayAltContent(obj);
>  +                                       }
>  +                               }
>  +                       }
>  +                       else {  // If no fp is installed, we let the object
> element do its job (show alternative content)
>  +                               setVisibility(id, true);
>  +                       }
>  +               }
>  +       }
>  +
>  +       /* Fix nested param elements, which are ignored by older webkit
> engines
>  +               - This includes Safari up to and including version 1.2.2 on
> Mac OS 10.3
>  +               - Fall back to the proprietary embed element
>  +       */
>  +       function fixParams(obj) {
>  +               var nestedObj = obj.getElementsByTagName(OBJECT)[0];
>  +               if (nestedObj) {
>  +                       var e = createElement("embed"), a =
> nestedObj.attributes;
>  +                       if (a) {
>  +                               var al = a.length;
>  +                               for (var i = 0; i < al; i++) {
>  +                                       if (a[i].nodeName.toLowerCase() ==
> "data") {
>  +                                               e.setAttribute("src",
> a[i].nodeValue);
>  +                                       }
>  +                                       else {
>  +
> e.setAttribute(a[i].nodeName, a[i].nodeValue);
>  +                                       }
>  +                               }
>  +                       }
>  +                       var c = nestedObj.childNodes;
>  +                       if (c) {
>  +                               var cl = c.length;
>  +                               for (var j = 0; j < cl; j++) {
>  +                                       if (c[j].nodeType == 1 &&
> c[j].nodeName.toLowerCase() == "param") {
>  +
> e.setAttribute(c[j].getAttribute("name"), c[j].getAttribute("value"));
>  +                                       }
>  +                               }
>  +                       }
>  +                       obj.parentNode.replaceChild(e, obj);
>  +               }
>  +       }
>  +
>  +       /* Fix hanging audio/video threads and force open sockets and
> NetConnecti...
>
> [Message clipped]
> _______________________________________________
>  PyAMF dev mailing list - dev@...
>  http://lists.pyamf.org/mailman/listinfo/dev
>
>

 « Return to Thread: Re: [pyamf-commits] r1155 - in examples/trunk: . google_appengine google_appengine/echo google_appengine/static google_appengine/static/swfobject google_appengine/static/swfobject/src google_appengine/templates