Index: qRSS2Syndication/branches/Plone3.1/utils.py
===================================================================
--- qRSS2Syndication/branches/Plone3.1/utils.py	(revision 113)
+++ qRSS2Syndication/branches/Plone3.1/utils.py	(revision 126)
@@ -8,7 +8,9 @@
                     include_subfolders = 0,
                     articles_number = 20,
+                    enable_itunes = 0,
+                    itunes_image_url = '',
+                    itunes_explicit = 0,
                     REQUEST = None):
-    """ Save all needed RSS2 properties into 'syndication_information' """
-    import pdb;pdb.set_trace()
+    """ Save all needed RSS2 properties into 'syndication_information' """	
     obj=aq_base(context)
     status = 'success'
@@ -20,21 +22,27 @@
         message = 'Syndication is Disabled'
         status = 'failed'
-    syInfo.rss2_types = list(rss2_types)
-    syInfo.only_published = only_published
-    syInfo.include_subfolders = include_subfolders
-    syInfo.max_items = int(articles_number)
+    else:
+        syInfo.rss2_types = list(rss2_types)
+        syInfo.only_published = only_published
+        syInfo.include_subfolders = include_subfolders
+        syInfo.max_items = articles_number
+        syInfo.enable_itunes = enable_itunes
+        syInfo.itunes_image_url = itunes_image_url
+        syInfo.itunes_explicit = itunes_explicit
     return status, message
 
 def getRSS2Properties(context):
-    """ Return directory of RSS2 properties from 'syndication_information' """
-    obj=aq_base(context)
-    
-    syInfo = getattr(obj, 'syndication_information', None)
-    syPropeties={}
-    syPropeties['rss2_types'] = getattr(syInfo,'rss2_types',[])
-    syPropeties['only_published'] = getattr(syInfo,'only_published',0)
-    syPropeties['include_subfolders'] = getattr(syInfo,'include_subfolders',0)
-    syPropeties['articles_number'] =int(getattr(syInfo,'max_items',20))
-    return  syPropeties
+     """ Return directory of RSS2 properties from 'syndication_information' """
+     obj=aq_base(context)
+     syInfo = getattr(obj, 'syndication_information', None)
+     syPropeties={}
+     syPropeties['rss2_types'] = getattr(syInfo,'rss2_types',[])
+     syPropeties['only_published'] = getattr(syInfo,'only_published',0)
+     syPropeties['include_subfolders'] = getattr(syInfo,'include_subfolders',0)
+     syPropeties['articles_number'] =int(getattr(syInfo,'max_items',20))
+     syPropeties['enable_itunes'] = getattr(syInfo,'enable_itunes',0)
+     syPropeties['itunes_image_url'] = getattr(syInfo,'itunes_image_url','')
+     syPropeties['itunes_explicit'] = getattr(syInfo,'itunes_explicit',0)
+     return  syPropeties
 
 
@@ -47,7 +55,10 @@
     res = []
     ps = getToolByName(context,'portal_syndication')
+    cpath = '/'.join(context.getPhysicalPath())
+    syProperties = getRSS2Properties(context)
+    include_subfolders = 0
+    path_length=len(cpath)+1
+    res1=[]
     if ps.isSyndicationAllowed(context):
-        cpath = '/'.join(context.getPhysicalPath())
-        syProperties = getRSS2Properties(context)
         types = syProperties['rss2_types']
         only_published = syProperties['only_published']
@@ -56,20 +67,19 @@
 
         catalog = getToolByName(context,'portal_catalog')
-        args = {'portal_type':types,
-                'path':cpath,
+        args = {'portal_type':types, 
+              	'path':cpath,
                 'sort_on':'effective',
                 'sort_order':'reverse',}
+
         if only_published:
             args['review_state'] = 'published'
         if include_subfolders == 0:
-            path_length=len(cpath)+1
-            for i in catalog.searchResults(args):
-                if i.getPath()[path_length:].find('/')<0:
-                    res.append(i)
-            res = res[:articles_number]
-        else:
             args['sort_limit'] = articles_number
             res=catalog.searchResults(args)
-        res = [r.getObject() for r in res]
+            for i in res :
+                if i.getPath()[path_length:].find('/')<0:
+                    res1.append(i)
+            res = res1[:articles_number]
+    res = [r.getObject() for r in res]
     return res
 
