Changeset 1501
- Timestamp:
- 11/09/06 22:07:45 (2 years ago)
- Files:
-
- datamoverplugin/0.10/datamover/api.py (modified) (2 diffs)
- datamoverplugin/0.10/datamover/providers.py (modified) (2 diffs)
- datamoverplugin/0.10/datamover/templates/datamover_config.cs (modified) (1 diff)
- datamoverplugin/0.10/datamover/ticket.py (modified) (3 diffs)
- datamoverplugin/0.10/datamover/web_ui.py (modified) (1 diff)
- datamoverplugin/0.10/setup.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
datamoverplugin/0.10/datamover/api.py
r1305 r1501 26 26 envs[env] = { 27 27 'name': _open_environment(env).project_name, 28 'mutable': provider.mutable_environments() and envs.get(env, {'mutable': 1}).get('mutable'),28 'mutable': provider.mutable_environments() and envs.get(env, {'mutable': True}).get('mutable'), 29 29 'provider': envs.get(env, {'provider': []}).get('provider') + [provider], 30 30 } … … 32 32 return envs 33 33 34 def any_mutable(self): 35 """Indicate if any of the active providers are mutable.""" 36 for provider in self.env_providers: 37 if provider.mutable_environments(): 38 return True 39 return False datamoverplugin/0.10/datamover/providers.py
r1096 r1501 4 4 5 5 from api import IEnvironmentProvider 6 7 __all__ = ['SiblingProviderModule', 'DBProviderModule'] 6 8 7 9 class SiblingProviderModule(Component): … … 22 24 def mutable_environments(self): 23 25 return False 26 27 class DBProviderModule(Component): 28 """Provide environments from a database table.""" 29 datamoverplugin/0.10/datamover/templates/datamover_config.cs
r1096 r1501 1 1 <h2>Datamover Configuration</h2> 2 3 <?cs if:datamover.any_mutable ?> 4 <form class="addnew" id="addenv" method="post"> 5 <fieldset> 6 <legend>Add Environment</legend> 7 <div class="field"> 8 <label>Path: <input type="text" name="env_path" /></label> 9 </div> 10 <div class="buttons"> 11 <input type="submit" name="add" value="Add" /> 12 </div> 13 </fieldset> 14 </form> 15 <?cs /if ?> 2 16 3 17 <form class="mod" id="modconfig" method="post"> datamoverplugin/0.10/datamover/ticket.py
r1305 r1501 39 39 action_verb = {'copy':'Copied', 'move':'Moved'}[action] 40 40 41 # Double check the ticket number is actually a number 42 if source_type == 'id': 43 try: 44 int(source) 45 except ValueError: 46 raise TracError('Value %r is not numeric'%source) 47 48 self.log.debug('DatamoverTicketModule: Source is %s (%s)', source, source_type) 49 41 50 query_string = { 42 'ticket': 'id=%s'% int(source),51 'ticket': 'id=%s'%source, 43 52 'component': 'component=%s'%source, 44 53 'all': 'id!=0', … … 47 56 48 57 try: 49 ids = [x['id'] for x in Query.from_string(self.env, query_string).execute(req)] 58 # Find the ids we want 59 ids = None 60 if source_type == 'ticket': # Special case this pending #T4119 61 ids = [int(source)] 62 else: 63 self.log.debug('DatamoverTicketModule: Running query %r', query_string) 64 ids = [x['id'] for x in Query.from_string(self.env, query_string).execute(req)] 65 self.log.debug('DatamoverTicketModule: Results: %r', ids) 66 50 67 dest_db = _open_environment(dest).get_db_cnx() 51 68 for id in ids: … … 57 74 Ticket(self.env, id).delete() 58 75 59 req.hdf['datamover.message'] = '%s tickets %s'%(action_verb, ', '.join([str(n) for n in ids])) 76 if ids: 77 req.hdf['datamover.message'] = '%s tickets %s'%(action_verb, ', '.join([str(n) for n in ids])) 78 else: 79 req.hdf['datamover.message'] = 'No tickets %s'%(action_verb.lower()) 60 80 except TracError, e: 61 81 req.hdf['datamover.message'] = "An error has occured: \n"+str(e) datamoverplugin/0.10/datamover/web_ui.py
r1096 r1501 17 17 18 18 def process_admin_request(self, req, cat, page, path_info): 19 envs = DatamoverSystem(self.env).all_environments() 19 system = DatamoverSystem(self.env) 20 envs = system.all_environments() 21 any_mutable = system.any_mutable() 20 22 21 23 req.hdf['datamover.envs'] = envs 24 req.hdf['datamover.any_mutable'] = any_mutable 22 25 return 'datamover_config.cs', None 23 26 datamoverplugin/0.10/setup.py
r1096 r1501 6 6 setup( 7 7 name = 'TracDatamoverPlugin', 8 version = ' 0.1',8 version = '1.0', 9 9 packages = ['datamover'], 10 10 package_data={ 'datamover' : [ 'templates/*.cs' ] }, … … 12 12 author_email = "coderanger@yahoo.com", 13 13 description = "Move data between Trac instances.", 14 long_description = "Move/copy tickets and wiki pages from one Trac instance to another o nthe same server.",14 long_description = "Move/copy tickets and wiki pages from one Trac instance to another on the same server.", 15 15 license = "BSD", 16 16 keywords = "trac plugin data move copy", … … 27 27 28 28 install_requires = [ 'TracWebAdmin' ], 29 30 classifiers = [ 31 'Framework :: Trac', 32 ], 29 33 )
