<commit_before># django-salesforce
#
# by <NAME>
# (c) 2012 Working Today
# See LICENSE.md for details
#

"""
Database router for SalesforceModel objects.
"""

from django.conf import settings

class ModelRouter(object):
	"""
	Database router for Salesforce models.
	"""
	sf_alias = getattr(settings, 'SALESFORCE_DB_ALIAS', 'salesforce')
	
	def db_for_read(self, model, **hints):
		"""
		If passed a class or instance, return the salesforce alias if it's a subclass of SalesforceModel.
		"""
		from salesforce import models
		if isinstance(model, models.SalesforceModel):
			return self.sf_alias
		if issubclass(model, models.SalesforceModel):
			return self.sf_alias

	def db_for_write(self, model, **hints):
		"""
		If passed a class or instance, return the salesforce alias if it's a subclass of SalesforceModel.
		"""
		from salesforce import models
		if isinstance(model, models.SalesforceModel):
			return self.sf_alias
		if issubclass(model, models.SalesforceModel):
			return self.sf_alias

	def allow_relation(self, obj1, obj2, **hints):
		"""
		Salesforce doesn't support relations in the traditional sense.
		"""
		return None

	def allow_syncdb(self, db, model):
		"""
		Don't attempt to sync the salesforce database connection.
		"""
		return db != self.sf_alias
<commit_msg>fixed model router<commit_after># django-salesforce
#
# by <NAME>
# (c) 2012 Working Today
# See LICENSE.md for details
#

"""
Database router for SalesforceModel objects.
"""

from django.conf import settings

class ModelRouter(object):
	"""
	Database router for Salesforce models.
	"""
	sf_alias = getattr(settings, 'SALESFORCE_DB_ALIAS', 'salesforce')
	
	def db_for_read(self, model, **hints):
		"""
		If passed a class or instance, return the salesforce alias if it's a subclass of SalesforceModel.
		"""
		from salesforce import models
		if isinstance(model, models.SalesforceModel):
			return self.sf_alias
		if issubclass(model, models.SalesforceModel):
			return self.sf_alias

	def db_for_write(self, model, **hints):
		"""
		If passed a class or instance, return the salesforce alias if it's a subclass of SalesforceModel.
		"""
		from salesforce import models
		if isinstance(model, models.SalesforceModel):
			return self.sf_alias
		if issubclass(model, models.SalesforceModel):
			return self.sf_alias

	def allow_relation(self, obj1, obj2, **hints):
		"""
		Salesforce doesn't support relations in the traditional sense.
		"""
		from salesforce import models
		if isinstance(obj1, models.SalesforceModel):
			return False
		if issubclass(obj1, models.SalesforceModel):
			return False
		if isinstance(obj2, models.SalesforceModel):
			return False
		if issubclass(obj2, models.SalesforceModel):
			return False

	def allow_syncdb(self, db, model):
		"""
		Don't attempt to sync salesforce models.
		"""
		from salesforce import models
		if isinstance(model, models.SalesforceModel):
			return False
		if issubclass(model, models.SalesforceModel):
			return False

{'fraction_non_alphanumeric': 0.09679595278246206, 'fraction_numerical': 0.005396290050590219, 'mean_word_length': 4.5130111524163565, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1638385', 'n_tokens_mistral': 1025, 'n_tokens_neox': 902, 'n_words': 293}