예제 #1
0
	def setUp(self):
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		
		for sql in test.TEST_TABLES.split(";"):
			if(sql.strip()):
				self.store.pool.runOperation(sql)
예제 #2
0
def create(hostname, source, destination, nightly=False):
	os.chdir(source)
	os.system('svn update')
	
	existing = os.listdir(destination)
	
	os.system('python setup.py egg_info %s sdist' % (('-RDb ""', '')[int(nightly)]))
	
	filename = None
	for item in os.listdir(os.path.join(source, 'dist')):
		if(item not in existing):
			filename = item
			shutil.copy(os.path.join(source, 'dist', item), destination)
			break
	else:
		raise IOError("Tarball not found.")
	
	match = RE_TARBALL_VERSION.match(filename)
	if not(match):
		raise RuntimeError("Filename %s can't be parsed for project and version information." % filename)
	
	project_name = match.group(1)
	release_version = match.group(2)
	
	pool = dbapi.connect(modusite_site.db_url)
	store = Store(pool)
	
	store.ensure_factory('project', model_class=project.Project)
	store.ensure_factory('release', model_class=release.Release)
	
	p = store.load_one('project', shortname=project_name)
	if not(p):
		raise RuntimeError("No such project, '%s'" % project_name)
	
	r = store.load_one('release', project_id=p.get_id(), version_string=release_version)
	if(r):
		raise RuntimeError("There is already a '%s' release with version string '%s'" % (project_name, release_version))
	
	r = release.Release()
	r.project_id = p.get_id()
	r.active = 1
	r.nightly = int(nightly)
	r.release_date = datetime.datetime.now()
	
	r.license_name = p.license_name
	r.license_url = p.license_url
	r.installation_url = p.installation_url
	r.changelog_url = p.changelog_url

	r.version_string = release_version
	r.version_weight = re.sub(r'[-_.]', '', release_version)

	req = get_release_request(hostname)
	r.load_tarball_info(req, filename)
	
	store.save(r)
	
예제 #3
0
	def setUp(self):
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		self.store.ensure_factory('autoinc_table', guid_table=None)
		
		global TEST_TABLES
		for sql in TEST_TABLES.split(";"):
			if(sql.strip()):
				self.store.pool.runOperation(sql)
예제 #4
0
	def setUp(self):
		"""
		Initializes the testing tables in the modu test database.
		"""
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		
		for sql in test.TEST_TABLES.split(";"):
			if(sql.strip()):
				self.store.pool.runOperation(sql)
예제 #5
0
	def setUp(self):
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		
		global TEST_TABLES
		for sql in TEST_TABLES.split(";"):
			if(sql.strip()):
				try:
					self.store.pool.runOperation(sql)
				except self.store.pool.dbapi.Warning:
					pass
예제 #6
0
	def setUp(self):
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		
		global TEST_TABLES
		for sql in TEST_TABLES.split(";"):
			if(sql.strip()):
				try:
					self.store.pool.runOperation(sql)
				except self.store.pool.dbapi.Warning:
					pass
		
		self.store.ensure_factory('user', user.User)
		self.store.ensure_factory('role', user.Role)
		self.store.ensure_factory('permission', user.Permission)
예제 #7
0
	def setUp(self):
		pool = dbapi.connect('MySQLdb://*****:*****@localhost/modu')
		self.store = persist.Store(pool)
		#self.store.debug_file = sys.stderr
		
		for sql in test.TEST_TABLES.split(";"):
			if(sql.strip()):
				self.store.pool.runOperation(sql)
		
		self.store.ensure_factory('page', force=True)
		
		for i in range(105):
			s = storable.Storable('page')
			s.code = 'url-code-%d' % self.store.fetch_id(s)
			s.content = 'The quick brown fox jumps over the lazy dog.'
			s.title = 'Old School'
			self.store.save(s)
예제 #8
0
	def get_request(self, form_data={}):
		"""
		The request generator for this TestCase.
		
		This returns a Store-enabled request.
		"""
		environ = test.generate_test_wsgi_environment(form_data)
		environ['REQUEST_URI'] = '/app-test/test-resource'
		environ['HTTP_HOST'] = '____store-test-domain____:1234567'
		environ['SERVER_NAME'] = '____store-test-domain____'
		environ['HTTP_PORT'] = '1234567'
		
		application = app.get_application(environ)
		self.failIf(application is  None, "Didn't get an application object.")
		
		req = app.configure_request(environ, application)
		req['modu.pool'] = dbapi.connect(application.db_url)
		req['modu.user'] = test.TestAdminUser()
		persist.activate_store(req)
		
		return req
예제 #9
0
	def get_request(self, form_data={}):
		"""
		The request generator for this TestCase.
		
		This particular implementation will return a Request object
		that has had a store instance defined for it.
		"""
		environ = test.generate_test_wsgi_environment(form_data)
		environ['REQUEST_URI'] = '/app-test/test-resource'
		environ['HTTP_HOST'] = '____store-test-domain____:1234567'
		environ['SERVER_NAME'] = '____store-test-domain____'
		environ['HTTP_PORT'] = '1234567'
		
		application = app.get_application(environ)
		self.failIf(application is  None, "Didn't get an application object.")
		
		req = app.configure_request(environ, application)
		req['modu.pool'] = dbapi.connect(application.db_url)
		req['modu.user'] = test.TestAdminUser()
		queue.activate_content_queue(req)
		persist.activate_store(req)
		
		return req
예제 #10
0
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

from modu.sites import seaflux_site

from gigkeeper.util import artistdata

class Options(usage.Options):
	"""
	Implement usage parsing for the export_ioda.py script.
	"""
	optParameters = []
	
	optFlags = [['debug', 'd', 'Debug queries to the database.'],
				]

if(__name__ == '__main__'):
	config = Options()
	try:
		config.parseOptions()
	except usage.UsageError, e:
		print >>sys.stderr, '%s: %s\nTry --help for usage details.' % (sys.argv[0], e)
		sys.exit(1)
	
	if(config['debug']):
		dbapi.debug = True
	
	pool = dbapi.connect(seaflux_site.db_url)
	store = Store(pool)
	
	artistdata.sync_shows(store)
예제 #11
0
	except usage.UsageError, e:
		print >>sys.stderr, '%s: %s\nTry --help for usage details.' % (sys.argv[0], e)
		sys.exit(1)
	
	child_pid = os.fork()
	if child_pid:
		time.sleep(config['timeout'])
		for sig in ('TERM', 'INT', 'HUP', 'KILL'):
			if(os.system('kill -%s %d' % (sig, child_pid)) != 0):
				print >>sys.stderr, "warning: kill failed: pid=%d, signal=%s" % (child_pid, sig)
				time.sleep(1)
		pid, retval = os.wait()
		sys.exit(retval)
	else:
		if(config['feed']):
			pool = dbapi.connect(feedme_site.db_url)
			store = Store(pool)
		
			store.ensure_factory('feed', model_class=feed.Feed)
			f = store.load_one('feed', url_code=config['feed'])
		
			try:
				sys.stdout.write(f.to_xml())
			except:
				sys.exit(-2)
		else:
			url = sys.stdin.readline()
			pattern = ''
		
			char = sys.stdin.read()
			while(char):