00001 from vyperlogix.classes.CooperativeClass import Cooperative 00002 00003 import os, sys, traceback 00004 00005 from vyperlogix import misc 00006 from vyperlogix.misc import ObjectTypeName 00007 00008 try: 00009 from cStringIO import StringIO as StringIO 00010 except: 00011 from StringIO import StringIO as StringIO 00012 00013 from vyperlogix.sf.abstract import SalesForceAbstract 00014 00015 __copyright__ = """\ 00016 (c). Copyright 1990-2008, Vyper Logix Corp., All Rights Reserved. 00017 00018 Published under Creative Commons License 00019 (http://creativecommons.org/licenses/by-nc/3.0/) 00020 restricted to non-commercial educational use only., 00021 00022 See also: http://www.VyperLogix.com and http://www.pypi.info for details. 00023 00024 THE AUTHOR VYPER LOGIX CORP DISCLAIMS ALL WARRANTIES WITH REGARD TO 00025 THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND 00026 FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, 00027 INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING 00028 FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 00029 NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION 00030 WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! 00031 00032 USE AT YOUR OWN RISK. 00033 """ 00034 class SalesForceUsers(SalesForceAbstract): 00035 def __init__(self, sfQuery): 00036 super(SalesForceUsers, self).__init__(sfQuery,object_name='User') 00037 00038 def getUserById(self,id): 00039 soql = "Select u.Email, u.FirstName, u.Id, u.LastName, u.Name from User u where u.Id = '%s'" % (id) 00040 return self.sf_query(soql) 00041 00042 def getAllActiveUsers(self): 00043 soql = "Select u.Email, u.FirstName, u.Id, u.LastName, u.Name, u.IsActive from User u where u.IsActive = true" 00044 return self.sf_query(soql) 00045 00046 def getAllMagmaUsers(self): 00047 soql = "Select u.Email, u.FirstName, u.Id, u.LastName, u.Name, u.IsActive from User u where u.IsActive = true and u.Email LIKE '%@magma%'" 00048 return self.sf_query(soql) 00049 00050 ## 00051 # related_to is a list of object names to which the parent object is related, related objects will be queried along with the parent. 00052 def getUserByEmail(self,email,related_to=[]): 00053 names = self.names 00054 related_to = related_to if (isinstance(related_to,list)) else [related_to] if (related_to is not None) else [] 00055 related_names = self.get_related_names(related_to) 00056 _related_names = [] 00057 for _names in related_names: 00058 _related_names += _names 00059 soql = "Select %s from %s %s where u.Email = '%s'" % (', '.join(names+_related_names),self.object_name,self.object_prefix,email) 00060 return self.sf_query(soql) 00061 00062 if __name__ == "__main__": 00063 import sys 00064 print >>sys.stdout, __copyright__ 00065 print >>sys.stderr, __copyright__ 00066 00067
© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved; If you reference this document or any part of this document you must use the citation verbatim (including the link) "© Copyright 2008-2009 Vyper Logix Corp., All Right Reserved."
Notice: This source code contained in this document is NOT open source and is NOT being distributed as open source.
122,241 lines of code and growing...