from node.ext.directory import Directory
from agx.core import handler
from agx.generator.gs.scope import (
    ProfileScope,
    ContentTypeScope,
    DynamicViewScope,
)


@handler('gsprofiledirectories', 'uml2fs', 'hierarchygenerator',
         'gsprofile', order=100)
def eggdocuments(self, source, target):
    """Create GS profile directories.
    """
    package = target.anchor
    if not 'profiles' in package:
        profiles = package['profiles'] = Directory()
        profiles['default'] = Directory()
        profiles['uninstall'] = Directory()
@@ -34,16 +34,59 @@
 rectory%0A
+from node.ext.template import DTMLTemplate%0A
 from agx
@@ -106,16 +106,16 @@
 handler%0A
-
 from agx
@@ -315,19 +315,27 @@
 def 
-eggdocument
+gsprofiledirectorie
 s(se
@@ -471,24 +471,33 @@
         
+package%5B'
 profiles
  = packa
@@ -488,18 +488,40 @@
 profiles
+'%5D
  =
+ Directory()%0A       
  package
@@ -524,32 +524,43 @@
 kage%5B'profiles'%5D
+%5B'default'%5D
  = Directory()%0A 
@@ -571,80 +571,949 @@
    p
-rofiles%5B'default'%5D = Directory()%0A        profiles%5B'uninstall'%5D = Directory()
+ackage%5B'profiles'%5D%5B'uninstall'%5D = Directory()%0A    package%5B'profiles'%5D%5B'default'%5D.factories%5B'.xml'%5D = DTMLTemplate%0A    package%5B'profiles'%5D%5B'uninstall'%5D.factories%5B'.xml'%5D = DTMLTemplate%0A%0A%0A@handler('gsprofilemetadata', 'uml2fs', 'hierarchygenerator',%0A         'gsprofile', order=110)%0Adef gsprofilemetadata(self, source, target):%0A    %22%22%22Create GS profile directories.%0A    %22%22%22%0A    package = target.anchor%0A    default = package%5B'profiles'%5D%5B'default'%5D%0A    if 'metadata.xml' in default:%0A        metadata = default%5B'metadata.xml'%5D%0A    else:%0A        metadata = default%5B'metadata.xml'%5D = DTMLTemplate()%0A    metadata.template = 'agx.generator.gs:templates/metadata.xml'%0A    %0A    # XXX: calculate from model%0A    metadata.params%5B'version'%5D = 1.0%0A    %0A    # XXX: calculate from model%0A    metadata.params%5B'description'%5D = 'Package description'%0A    %0A    # XXX: calculate from model%0A    metadata.params%5B'dependencies'%5D = %5B%0A        'profile-foo.bar:default',%0A    %5D

create metadata.xml