Back to index

plone3  3.1.7
Functions
CMFQuickInstallerTool.events Namespace Reference

Functions

def findProductForProfile
def handleBeforeProfileImportEvent
def handleProfileImportedEvent

Function Documentation

def CMFQuickInstallerTool.events.findProductForProfile (   context,
  profile_id 
)

Definition at line 11 of file events.py.

00011 
00012 def findProductForProfile(context, profile_id):
00013     qi = getToolByName(context, "portal_quickinstaller", None)
00014     if qi is None:
00015         return None
00016 
00017     if profile_id.startswith("profile-"):
00018         profile_id = profile_id[8:]
00019 
00020     for product in qi.listInstallableProducts(skipInstalled=False):
00021         profiles = qi.getInstallProfiles(product["id"])
00022         if profile_id in profiles:
00023             return product["id"]
00024 
00025     return None
00026 
00027 
@adapter(IBeforeProfileImportEvent)

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 28 of file events.py.

00028 
00029 def handleBeforeProfileImportEvent(event):
00030     if event.profile_id is None or not event.full_import:
00031         return
00032 
00033     context=event.tool
00034 
00035     # We need a request to scribble some data in
00036     request = getattr(context, "REQUEST", None)
00037     if request is None:
00038         return
00039 
00040     product = findProductForProfile(context, event.profile_id)
00041     if product is None:
00042         return
00043 
00044     qi = getToolByName(context, "portal_quickinstaller", None)
00045     if qi is None:
00046         return
00047 
00048     snapshot = qi.snapshotPortal(aq_parent(context))
00049 
00050     storage = IAnnotatable(request, None)
00051     if storage is None:
00052         return
00053 
00054     installing = storage.get("Products.CMFQuickInstaller.Installing", [])
00055     if product in installing:
00056         return
00057 
00058     if storage.has_key("Products.CMFQuickInstallerTool.Events"):
00059         data = storage["Products.CMFQuickInstallerTool.Events"]
00060     else:
00061         data = storage["Products.CMFQuickInstallerTool.Events"] = {}
00062     data[event.profile_id] = dict(product=product, snapshot=snapshot)
00063 
00064 
@adapter(IProfileImportedEvent)

Here is the call graph for this function:

Definition at line 65 of file events.py.

00065 
00066 def handleProfileImportedEvent(event):
00067     if event.profile_id is None or not event.full_import:
00068         return
00069 
00070     context = event.tool
00071 
00072     # We need a request to scribble some data in
00073     request = getattr(context, "REQUEST", None)
00074     if request is None:
00075         return
00076 
00077     storage = IAnnotatable(request, None)
00078     if storage is None:
00079         return
00080 
00081     data = storage.get("Products.CMFQuickInstallerTool.Events", [])
00082     if event.profile_id not in data:
00083         return
00084     info = data[event.profile_id]
00085 
00086     qi = getToolByName(context, "portal_quickinstaller", None)
00087     if qi is None:
00088         return
00089 
00090     after = qi.snapshotPortal(aq_parent(context))
00091 
00092     settings = qi.deriveSettingsFromSnapshots(info["snapshot"], after)
00093     version = qi.getProductVersion(info["product"])
00094     qi.notifyInstalled(
00095             info["product"],
00096             locked=False,
00097             logmsg="Installed via setup tool",
00098             settings=settings,
00099             installedversion=version,
00100             status='installed',
00101             error=False)

Here is the call graph for this function: