|
|
|
|
Emanuel Sartor
()
|
|
||||||||||||
|
Hi all,
About two months ago at ifPeople we started a project that needed Plone- Salesforce integration and in particular needed the upsert feature of Products.salesforcepfgadapter whose development was happening in the osf- upserts branch. During the development we did a couple of changes that I will be summarizing below. I am also attaching a patch with the changes. The patch can't be applied directly over the current osf-upserts branch because we worked on an internal repository and the osf-upserts branch has changed since we started working. However, except for item 1 in the list below, all the other changes are minor and hopefully easy to identify in the patch that I am attaching. 1. Merge trunk by 2009-09-15 to the osf-upserts branch from the same date in a private repository. 2. In the events.py file, in the _set_default method, check that the field has the getRawFgTDefault attribute before trying to figure out if it's safe to override. Otherwise it raises an error for a label object. 3. In content/salesforcepfgadapter.py, methods _clearSession and _userIdToUpdate fixed to ask for 'session.has_key(config.SESSION_KEY)' instead of 'config.SESSION_KEY in session', which was raising an error. 4. Fixed prepopulator to return str dates: prepopulator.py, retrieveData method. I haven't had a chance to look at how the osf-upserts branch has evolved in the last couple of weeks, but I can prepare an 'applicable' patch for items 2 to 4 in the previous list if you think those are helpful, or even commit them myself if you prefer. I just wanted to send this now as it's been in my TODO list for so long now. Regards, Emanuel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Plone Salesforce Integration" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/plonesf?hl=en -~----------~----~----~----~------~----~------~--~--- diff -r osf-upserts0/Products/salesforcepfgadapter/CHANGES.txt osf-upserts1/Products/salesforcepfgadapter/CHANGES.txt 1c1,11 < 1.6 (svn/unreleased) --- > Changelog > ========= > > 1.6 (unreleased) > > > 1.6b1 (2009-09-08) > > - Adjust calls to the salesforcebaseconnector query method to use a single > full SOQL statement. beatbox >= 16.0dev is now required. > [davisagli] < - Fix for issue #13, whereby hitting the next button while editing a < Salesforce Adapter with PloneFormGen 1.5b2 redirected off to the Form < Folder's Quick Edit UI, rather than the field mapping UI as expected. < [andrewb] < 31a37,49 > > 1.5.2 - released August 13, 2009 > > - Fix broken release. > [davisagli] > > 1.5.1 - released August 12, 2009 > > - Fix for issue #13, whereby hitting the next button while editing a > Salesforce Adapter with PloneFormGen 1.5b2 redirected off to the Form > Folder's Quick Edit UI, rather than the field mapping UI as expected. > [andrewb] > < - Cleaning up naughty "import *" statement within Install.py --- > - Cleaning up naughty "import \*" statement within Install.py 235c253,254 < http://svn.plone.org/svn/collective/PloneFormGen/branches/salesforce_adapter_branch/ --- > > - http://svn.plone.org/svn/collective/PloneFormGen/branches/salesforce_adapter_branch/ diff -r osf-upserts0/Products/salesforcepfgadapter/content/salesforcepfgadapter.py osf-upserts1/Products/salesforcepfgadapter/content/salesforcepfgadapter.py 303c303 < if config.SESSION_KEY in session and form_id in session[config.SESSION_KEY]: --- > if session.has_key(config.SESSION_KEY) and form_id in session[config.SESSION_KEY]: 310c310 < if config.SESSION_KEY in session and form_id in session[config.SESSION_KEY]: --- > if session.has_key(config.SESSION_KEY) and form_id in session[config.SESSION_KEY]: diff -r osf-upserts0/Products/salesforcepfgadapter/events.py osf-upserts1/Products/salesforcepfgadapter/events.py 2a3 > from Products.Archetypes.utils import shasattr 25c26 < if _safe_to_override(field): --- > if shasattr(field, 'getRawFgTDefault') and _safe_to_override(field): diff -r osf-upserts0/Products/salesforcepfgadapter/migrations/__init__.py osf-upserts1/Products/salesforcepfgadapter/migrations/__init__.py 0a1 > # \ No newline at end of file diff -r osf-upserts0/Products/salesforcepfgadapter/prepopulator.py osf-upserts1/Products/salesforcepfgadapter/prepopulator.py 6a7 > from datetime import date 60c61,62 < fieldList.append('Id') --- > if not('Id' in fieldList): > fieldList.append('Id') 73c75,78 < data[m['field_path']] = res['records'][0][m['sf_field']] --- > value = res['records'][0][m['sf_field']] > if isinstance(value, date): > value = str(value) > data[m['field_path']] = value diff -r osf-upserts0/Products/salesforcepfgadapter/profiles/default/metadata.xml osf-upserts1/Products/salesforcepfgadapter/profiles/default/metadata.xml 3c3 < <version>1.6</version> --- > <version>1.6.0dev</version> diff -r osf-upserts0/Products/salesforcepfgadapter/README.txt osf-upserts1/Products/salesforcepfgadapter/README.txt 131c131 < Depends upon the beatbox library >= 0.9.1.1, which is a Python wrapper to the --- > Depends upon the beatbox library >= 16.0b1, which is a Python wrapper to the 143c143 < See dependencies for PloneFormGen 1.2.x+. As a pre-requisite, all of these must be --- > See dependencies for PloneFormGen 1.5.x+. As a pre-requisite, all of these must be 146c146 < SalesforceBaseConnector >= 1.0a3. See --- > SalesforceBaseConnector >= 1.2b1. See 195c195 < This is left unfixed in all branches <=1.5.x of the Salesforce PFG Adapter, --- > This is left unfixed in all branches <=1.6.x of the Salesforce PFG Adapter, diff -r osf-upserts0/Products/salesforcepfgadapter/tests/__init__.py osf-upserts1/Products/salesforcepfgadapter/tests/__init__.py 0a1 > # \ No newline at end of file diff -r osf-upserts0/Products/salesforcepfgadapter/tests/testChainedAdapters.py osf-upserts1/Products/salesforcepfgadapter/tests/testChainedAdapters.py 4c4 < import os, sys, email --- > import os, sys 87,90c87,92 < contact_res = self.salesforce.query(['Id','AccountId',], < 'Contact', < """LastName = 'testChainedDependenciesInsertCorrectly' \ < AND Email = '[hidden email]'""") --- > contact_res = self.salesforce.query( > "SELECT Id, AccountId FROM Contact WHERE LastName='%s' AND Email='%s'" % ( > 'testChainedDependenciesInsertCorrectly', > '[hidden email]' > ) > ) 93c95,96 < account_res = self.salesforce.query(['Id',], 'Account', "Name = 'testChainedDependenciesInsertCorrectly'") --- > account_res = self.salesforce.query( > "SELECT Id FROM Account WHERE Name = 'testChainedDependenciesInsertCorrectly'") 148,151c151,156 < contact_res = self.salesforce.query(['Id','AccountId',], < 'Contact', < """LastName = 'testChainedRespectDisabledFinalAdapters' \ < AND Email = '[hidden email]'""") --- > contact_res = self.salesforce.query( > "SELECT Id, AccountId FROM Contact WHERE LastName='%s' AND Email='%s'" % ( > 'testChainedRespectDisabledFinalAdapters', > '[hidden email]' > ) > ) 154c159,160 < account_res = self.salesforce.query(['Id',], 'Account', "Name = 'testChainedRespectDisabledFinalAdapters'") --- > account_res = self.salesforce.query( > "SELECT Id FROM Account WHERE Name = 'testChainedRespectDisabledFinalAdapters'") 208,211c214,219 < contact_res = self.salesforce.query(['Id','AccountId',], < 'Contact', < """LastName = 'testChainedRespectNonexecutableFinalAdapters' \ < AND Email = '[hidden email]'""") --- > contact_res = self.salesforce.query( > "SELECT Id, AccountId FROM Contact WHERE LastName='%s' AND Email='%s'" % ( > 'testChainedRespectNonexecutableFinalAdapters', > '[hidden email]' > ) > ) 214c222,223 < account_res = self.salesforce.query(['Id',], 'Account', "Name = 'testChainedRespectNonexecutableFinalAdapters'") --- > account_res = self.salesforce.query( > "SELECT Id FROM Account WHERE Name = 'testChainedRespectNonexecutableFinalAdapters'") diff -r osf-upserts0/Products/salesforcepfgadapter/tests/testSalesforceFormDateField.py osf-upserts1/Products/salesforcepfgadapter/tests/testSalesforceFormDateField.py 122,124c122,123 < contact_res = self.salesforce.query(['Id','Birthdate'], < 'Contact', < "LastName='PloneTestCaseEmptyDateField'") --- > contact_res = self.salesforce.query( > "SELECt Id, Birthdate FROM Contact WHERE LastName='PloneTestCaseEmptyDateField'") diff -r osf-upserts0/Products/salesforcepfgadapter/tests/testSalesforce.py osf-upserts1/Products/salesforcepfgadapter/tests/testSalesforce.py 9d8 < from zope.interface import providedBy 278d276 < from Products.Archetypes.interfaces import IMultiPageSchema 311,312c309,314 < res = self.salesforce.query(['Id',],self.ff1.contact_adapter.getSFObjectType(), < "[hidden email]' and LastName='PloneTestCase'") --- > res = self.salesforce.query( > "SELECT Id FROM %s WHERE Email='%s' AND LastName='%s'" % ( > self.ff1.contact_adapter.getSFObjectType(), > '[hidden email]', > 'PloneTestCase') > ) 356,358c358,363 < contact_res = self.salesforce.query(['Id',], < self.ff1.contact_adapter.getSFObjectType(), < "[hidden email]' and LastName='PloneTestCase1ToN'") --- > contact_res = self.salesforce.query( > "SELECT Id FROM %s WHERE Email='%s' AND LastName='%s'" % ( > self.ff1.contact_adapter.getSFObjectType(), > '[hidden email]', > 'PloneTestCase1ToN') > ) 363,365c368,373 < account_res = self.salesforce.query(['Id',],self.ff1.account_adapter.getSFObjectType(), < "Name='PloneTestCase1ToN'") < --- > account_res = self.salesforce.query( > "SELECT Id FROM %s WHERE Name='%s'" % ( > self.ff1.account_adapter.getSFObjectType(), > 'PloneTestCase1ToN') > ) > 441,443c449,453 < contact_res = self.salesforce.query(['Id','FirstName'], < self.ff1.contact_adapter.getSFObjectType(), < "LastName='PloneTestCaseFieldsetFields'") --- > contact_res = self.salesforce.query( > "SELECT Id, FirstName FROM %s WHERE LastName='%s'" % ( > self.ff1.contact_adapter.getSFObjectType(), > 'PloneTestCaseFieldsetFields') > ) 558,560c568,571 < attach_res = self.salesforce.query(['Id','Name','BodyLength',], < 'Attachment', < "ParentId='%s'" % contact_create_res[0]['id']) --- > attach_res = self.salesforce.query( > "SELECT Id, Name, BodyLength FROM Attachment WHERE ParentId='%s'" % ( > contact_create_res[0]['id']) > ) 608,610c619,622 < lead_res = self.salesforce.query(['Id','NumberOfEmployees'], < 'Lead', < "LastName='PloneTestCaseEmptyIntegerField'") --- > lead_res = self.salesforce.query( > "SELECT Id, NumberOfEmployees FROM Lead WHERE LastName='%s'" % ( > 'PloneTestCaseEmptyIntegerField') > ) diff -r osf-upserts0/setup.py osf-upserts1/setup.py 4c4 < version = '1.6' --- > version = '1.6.0' 10c10 < long_description=open(os.path.join("Products", "salesforcepfgadapter", "README.txt")).read(), --- > long_description=open(os.path.join("Products", "salesforcepfgadapter", "README.txt")).read() + "\n" + open(os.path.join('Products', 'salesforcepfgadapter', 'CHANGES.txt')).read(), 29,32c29,32 < 'beatbox>=0.9,<=1.0dev', < 'Products.salesforcebaseconnector', < 'Products.PloneFormGen', < 'Products.DataGridField', --- > 'beatbox>=16.0dev', > 'Products.salesforcebaseconnector>=1.2b1', > 'Products.PloneFormGen>=1.5.0', > 'Products.DataGridField>=1.6', |
||||||||||||||
|
|
Christopher Johnson-7
()
|
|
||||||||||||
|
Hey Emanuel,
I just learned from David Glick today that the branch has now merged back into the trunk and that it has evolved some. Hopefully he can comment on any of these items that haven't been addressed yet and need incorporating (he's traveling as of now though). You may want to consider subscribing to the changes update for the trunk to keep tabs on how that evolves going forward. Best, Chris On Thu, Nov 5, 2009 at 2:53 AM, Emanuel Sartor <[hidden email]> wrote: Hi all, -- Cofounder and CEO ifPeople - Innovation for People www.ifpeople.net t: 678-608-3408 130 Boulevard NE, #6 Atlanta, GA 30312 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Plone Salesforce Integration" group. To post to this group, send email to [hidden email] To unsubscribe from this group, send email to [hidden email] For more options, visit this group at http://groups.google.com/group/plonesf?hl=en -~----------~----~----~----~------~----~------~--~--- |
||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |