Recent Changes - Search:

Administrators

Developers

Articles

Cookbook

edit

How to migrate your applications from version 0.1.1 to 0.5

Administrators.UpgradingFrom011to05 History

Hide minor edits - Show changes to markup

May 03, 2008, at 02:03 AM by Tassos Koutsovassilis -
Added lines 146-147:
  1. On the UI side, if you application is using splitters then you have to make some final adjustments. The new Splitter widget derives from Box. The first change that you have to make is to invert the splitters' orientation; that is vertical become horizontal and horizontal become vertical. Next remove all the "pane" tags and transfer the positioning and sizing attributes to the inner widget. If a pane contains has more than one child widget then transform in place into a rectangle. On-off panes are no longer an option. All panes are collapsing when double clicking on the splitter handles.
May 02, 2008, at 09:51 PM by Tassos Koutsovassilis -
Changed lines 125-126 from:

The required parameters of this web method are the "of_type" and the "template". The others' default values are shown above. This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The later also applies for QuiX web methods.

to:

The required parameters of this web method are the "of_type" and the "template". The others' default values are shown above. This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The later also applies for QuiX web methods.

Changed line 132 from:

response -> Respose

to:

response -> Response

Added line 141:
Added line 143:
May 02, 2008, at 09:47 PM by Tassos Koutsovassilis -
Changed line 5 from:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:
to:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing a list of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:
Changed line 16 from:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:
to:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs inside your application's package node you need to create a new web method. A registration of the this type:
Changed line 115 from:
  1. If you have used the HTTPServlet? class then the corresponding web method is:
to:
  1. If you have used the HTTPServlet class then the corresponding web method is:
May 02, 2008, at 09:44 PM by Tassos Koutsovassilis -
Changed line 139 from:
  1. Activate your web methods. In order for the web methods to added to you content class you must import them. Most of the times placing this import in you application's main package "__init__.py" is sufficient:
to:
  1. Activate your web methods. In order for the web methods to added to your content classes you must import them. Most of the times placing this import in you application's main package "__init__.py" is sufficient:
May 02, 2008, at 09:44 PM by Tassos Koutsovassilis -
Changed line 144 from:

That's it. For a more detailed view of the changes introduced in this version see the Main.ChangeLog

to:

That's it. For a more detailed view of changes introduced in this version and not mention in this guide see the Main.ChangeLog

May 02, 2008, at 09:42 PM by Tassos Koutsovassilis -
Added line 131:
Changed lines 136-144 from:

@]

to:

@]

  1. Activate your web methods. In order for the web methods to added to you content class you must import them. Most of the times placing this import in you application's main package "__init__.py" is sufficient:
    from com.mycompany.myapp.webmethods import *
    

That's it. For a more detailed view of the changes introduced in this version see the Main.ChangeLog

May 02, 2008, at 09:36 PM by Tassos Koutsovassilis -
Changed lines 125-127 from:

The required parameters of this web method are the "of_type" and the "template". The others' default values are shown above. This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The same applies for QuiX web methods.

  1. Binding PSP pages to objects is no longer supported. Thus, if any of your "store.xml" registrations' action attribute points to a PSP page then you have to transfer the logic of this server page inside a web method.
to:

The required parameters of this web method are the "of_type" and the "template". The others' default values are shown above. This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The later also applies for QuiX web methods.

  1. Binding PSP pages to objects is no longer supported. Thus, if any of your "store.xml" registrations' action attribute points to a PSP page then you have to transfer the logic of this server page inside a web method.

  2. Update your PSP pages' code. All system objects passed in a PSP page now begin with a capital letter. Required replacements are:
    response -> Respose
    request -> Request
    session -> Session
    server -> Server
    
May 02, 2008, at 09:32 PM by Tassos Koutsovassilis -
Changed lines 37-38 from:
                   template='relative/path/to/quix/template')
to:
                   template='relative/path/to/quix/template',
                   isPage=False)
Changed line 103 from:

For the QuiX? web methods since there is no "self.params" dict, the web method must return this Python dict. Therefore, I recommend:

to:

Specifically for the web methods that have a template since there is no "self.params" dict, the web method must return this Python dict. Therefore, I recommend:

Changed lines 125-126 from:

This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The same applies for QuiX web methods.

to:

The required parameters of this web method are the "of_type" and the "template". The others' default values are shown above. This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The same applies for QuiX web methods.

May 02, 2008, at 09:26 PM by Tassos Koutsovassilis -
Changed line 16 from:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:\\
to:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:
Added lines 114-126:
  1. If you have used the HTTPServlet? class then the corresponding web method is:
    
    @webmethods.webmethod(of_type=MyContainerClass, http_method='GET', client='', lang='', qs='',
                          max_age=0, content_type='text/html', encoding='utf-8',
                          template='relative/path/to/the/template/file')
    def my_method(self):
        ...
    
    

    This method is called by issuing an HTTP GET on "http://SERVER/porcupine.py/OBJECT_ID?cmd=my_method". Use the special name "__blank__" if no cmd parameter is required. The same applies for QuiX web methods.

  2. Binding PSP pages to objects is no longer supported. Thus, if any of your "store.xml" registrations' action attribute points to a PSP page then you have to transfer the logic of this server page inside a web method.
May 02, 2008, at 09:12 PM by Tassos Koutsovassilis -
Changed line 5 from:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:\\
to:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:
May 02, 2008, at 09:11 PM by Tassos Koutsovassilis -
Changed line 81 from:

since the web method is bound to the content class. Next, you can now get the HTTP context by using:

to:

since the web method is bound to the content class itself. Then replace all the database handle references:

Changed lines 84-85 from:

http_context = HttpContext?.current()

to:

self.server.store -> db

Changed line 87 from:

and then replace:

to:

Next, you can now get the HTTP context inside the web method by using:

Added lines 90-95:

http_context = HttpContext?.current()

@]
and then apply the following replacements: [@

Changed lines 98-99 from:

@]

to:

self.session -> context.session self.server -> context.server

@]
For the QuiX? web methods since there is no "self.params" dict, the web method must return this Python dict. Therefore, I recommend:

self.params -> params


for making params a local variable and then:

return params

May 02, 2008, at 08:55 PM by Tassos Koutsovassilis -
Changed line 61 from:

It is worth mentioning that registrations of the above type DO NOT need to be migrated since these kind of methods are bound to the base content classes and they are already there for all sub-classes:

to:

It is worth mentioning that registrations such as the one below DO NOT need to be migrated since these kind of methods are bound to the base content classes and they are already there for all sub-classes:

May 02, 2008, at 08:53 PM by Tassos Koutsovassilis -
Added lines 74-92:

@]

  1. The code pasted inside the web methods needs some amendments. The first obvious replacement is:
    
    self.item -> self
    
    

    since the web method is bound to the content class. Next, you can now get the HTTP context by using:
    
    http_context = HttpContext.current()
    
    

    and then replace:

[@

self.response -> context.response self.request -> context.request

May 02, 2008, at 08:47 PM by Tassos Koutsovassilis -
Changed line 5 from:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:
to:
  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:\\
Added line 14:
Changed lines 16-17 from:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:
to:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:\\
Changed lines 30-31 from:

@]becomes something like this (this code should be entered in the content class's file inside the "webmethods" package):

to:

@]
becomes something like this (this code should be entered in the content class's file inside the "webmethods" package):

Changed lines 41-42 from:

@]Whereas, an XML-RPC registration of this type, typically requires more than one web method; one for each XML-RPC method defined inside the XML-RPC servlet:

to:

@]
Whereas, an XML-RPC registration of this type, typically requires more than one web method; one for each XML-RPC method defined inside the XML-RPC servlet:

Changed lines 52-53 from:

@]One remote method is defined as:

to:

@]
One remote method is defined as:

Changed lines 60-61 from:

@]It is worth mentioning that registrations of the above type DO NOT need to be migrated since these kind of methods are bound to the base content classes and they are already there all sub-classes:

to:

@]
It is worth mentioning that registrations of the above type DO NOT need to be migrated since these kind of methods are bound to the base content classes and they are already there for all sub-classes:

May 02, 2008, at 08:30 PM by Tassos Koutsovassilis -
Changed line 16 from:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration in your application's package node you need to create a new web method. A registration of the this type:
to:
  1. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration serving UIs? inside your application's package node you need to create a new web method. A registration of the this type:
Changed line 36 from:
                   template='path/to/quix/template')
to:
                   template='relative/path/to/quix/template')
Changed lines 39-40 from:

@]

to:
@]Whereas, an XML-RPC registration of this type, typically requires more than one web method; one for each XML-RPC method defined inside the XML-RPC servlet:

<reg action="com.mycompany.myapp.XMLRPC.MyContainerClass"
	cc="com.mycompany.myapp.schema.MyContainerClass"
	client="vcXMLRPC"
	lang=".*"
	method="POST"
	param=""/>

One remote method is defined as:

@webmethods.remotemethod(of_type="MyContainerClass")
def method_name(self):
    [PASTE THE CODE OF THE method_name METHOD OF THE com.mycompany.myapp.XMLRPC.MyContainerClass SERVLET HERE]

It is worth mentioning that registrations of the above type DO NOT need to be migrated since these kind of methods are bound to the base content classes and they are already there all sub-classes:

<reg action="org.innoscript.desktop.ui.Frm_AutoNew"
	cc="com.mycompany.myapp.schema.MyContainerClass"
	client="(MSIE [6-7])|(Mozilla/5.0.+rv:1.[7-9])"
	lang=".*"
	method="GET"
	param="new">
            <filter type="porcupine.filters.postProcessing.multilingual.Multilingual"
		    using="org.innoscript.desktop.strings.resources"/>
</reg>

May 02, 2008, at 08:12 PM by Tassos Koutsovassilis -
Added lines 1-40:

(:title How to migrate your applications from version 0.1.1 to 0.5:)

Follow the following steps:

  1. First you need to create the appropriate web methods for your content classes. For this reason create a new "webmethods" Python package inside your application's directory. Inside this package I recommend creating one file per content class. Therefore, if you need to add web methods to two content classes this package will contain two python files. It is also advised to edit the "__init__.py" file of the aforementioned package and then add the "__all__" special attribute containing alist of all of its contained modules. This is because in the next steps we will use something like "from com.mycompany.myapp.webmethods import *". The typical imports required for each one of these modules are:
    
    from porcupine import HttpContext
    from porcupine import webmethods
    from porcupine import filters
    from porcupine import db
    
    from com.mycompany.myapp.schema import MyContainerClass
    

  2. Inspect the "store.xml.bak" file (this is actually a backup kept temporarily and can be safely deleted after the migration process is finshed). Typically, for each registration in your application's package node you need to create a new web method. A registration of the this type:
    
    <reg action="com.mycompany.myapp.ui.MyForm"
    	cc="com.mycompany.myapp.schema.MyContainerClass"
    	qs="com.mycompany.myapp.schema.MyItemClass"
    	client="(MSIE [6-7])|(Mozilla/5.0.+rv:1.[7-9])"
    	lang=".*"
    	method="GET"
    	param="new">
                <filter type="porcupine.filters.postProcessing.multilingual.Multilingual"
    		    using="org.innoscript.desktop.strings.resources"/>
    </reg>
    
    
    becomes something like this (this code should be entered in the content class's file inside the "webmethods" package):
    
    @filters.i18n('org.innoscript.desktop.strings.resources')
    @webmethods.quixui(of_type=MyContainerClass,
                       qs='com.mycompany.myapp.schema.MyItemClass',
                       template='path/to/quix/template')
    def new(self):
        [PASTE THE CODE OF THE execute METHOD OF THE com.mycompany.myapp.ui.MyForm SERVLET HERE]
    
Page last modified on May 03, 2008, at 02:03 AM