PK!44btracrpc/__init__.pyfrom tracrpc.api import * from tracrpc.web_ui import * from tracrpc.ticket import * from tracrpc.wiki import * from tracrpc.search import * PK68X9E9Etracrpc/ticket.pyc; Ec@sdklZdkTdklZlZdklZdki i Z dk i i Z dk lZdklZdkZdkZdkZdklZdefd YZd Zd Zee ihd d <dd <dd <ee ihd d <dd<dd <ee ihd d <dd<dd<dd <ee iee iee iee iee idS((s Attachment(s*(sIXMLRPCHandlers expose_rpc(s to_timestampN(s TicketSystem(sTicketNotifyEmail(sStringIOs TicketRPCcBstZdZeedZdZddZdZdZ dZ he dZ he d Z d Zd d Zeieiie_d ZdZedZdZdZRS(s* An interface to Trac's ticketing system. cCsdSdS(Nsticket((sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_namespacesccsdtfttff|ifVdttiff|ifVdttff|ifVdttff|i fVdtttftttt ftttt t ff|i fVdtttftttt ftttt t ff|i fVdttff|ifVdt tft ttff|ifVdttff|ifVdtittff|ifVdtttttit ftttttiff|ifVdt ttff|ifVdtff|ifVdS(Ns TICKET_VIEWs TICKET_CREATEs TICKET_APPENDs TICKET_ADMIN(slistsstrsselfsquerys xmlrpclibsDateTimesgetRecentChangessintsgetAvailableActionssgetsdictsboolscreatesupdatesNonesdeletes changeLogslistAttachmentssBinarys getAttachments putAttachmentsdeleteAttachmentsgetTicketFields(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_methodss==%=sstatus!=closedcCsQtii|i|}g}x(|i|D]}|i |dq.W|SdS(s: Perform a ticket query, returning a list of ticket ID's. sidN( squerysQuerys from_stringsselfsenvsqstrsqsoutsexecutesreqstsappend(sselfsreqsqstrsqstsout((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysquery+scCspt|}|ii}|i}|id|fg}x%|D]}|i t |dqGW|SdS(sCReturns a list of IDs of tickets that have changed since timestamp.s,SELECT id FROM ticket WHERE changetime >= %siN( s to_timestampssincesselfsenvs get_db_cnxsdbscursorsexecutesresultsrowsappendsint(sselfsreqssincesdbscursorsresultsrow((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetRecentChanges3s    cCs;t|i}ti|i|}|i||i SdS(s8Returns the actions that can be performed on the ticket.N( s TicketSystemsselfsenvs ticketSystemsmodelsTicketsidstsget_available_actionssreqsperm(sselfsreqsids ticketSystemst((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetAvailableActions?scCs5ti|i|}|i|i|i|ifSdS(sG Fetch a ticket. Returns [id, time_created, time_changed, attributes]. N( smodelsTicketsselfsenvsidsts time_createds time_changedsvalues(sselfsreqsidst((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetEsc Csti|i} d| d<|| d<|| d<|ipd| d. sTicketModelImplcstZeedZdZdZdiie_ dZ diie _ dZ diie _ d Z d iie _ d Z d iie _ d ZRS(NcsdiiSdS(Nsticket.(sclss__name__slower(sself(scls(s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_namespacesccsdtff|ifVdttff|ifVdttff|ifVdtttff|ifVdtttff|i fVdS(Ns TICKET_VIEWs TICKET_ADMIN( slistsselfsgetAllsdictsstrsgetsNonesdeletescreatesupdate(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_methodss c#s(x!i|iD] }|iVqWdS(N(sclssselectsselfsenvsisname(sselfsreqsi(scls(s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetAllss$ Get a list of all ticket %s names. csm|i|}h}xJiD]<\}}t ||}|t jo |}n|||/xmlrpc will display this list. cCs|iddfjSdS(Ns /login/xmlrpcs/xmlrpc(sreqs path_info(sselfsreq((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/web_ui.pys match_requestscCsN|id|idd|idt||i|i|dS(Nis Content-Typestext/xmlsContent-Length(sreqs send_responses send_headerslensresponses end_headersswrite(sselfsreqsresponse((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/web_ui.pys_send_responses   c Cs|iid|id}|tjp d|joTh}x#t|i i |D] } | i i dd}||jo;hdt| i|i <dg<d| i <||= %s', (since,)) result = [] for row in cursor: result.append(int(row[0])) return result def getAvailableActions(self, req, id): """Returns the actions that can be performed on the ticket.""" ticketSystem = TicketSystem(self.env) t = model.Ticket(self.env, id) return ticketSystem.get_available_actions(t, req.perm) def get(self, req, id): """ Fetch a ticket. Returns [id, time_created, time_changed, attributes]. """ t = model.Ticket(self.env, id) return (t.id, t.time_created, t.time_changed, t.values) def create(self, req, summary, description, attributes = {}, notify=False): """ Create a new ticket, returning the ticket ID. """ t = model.Ticket(self.env) t['status'] = 'new' t['summary'] = summary t['description'] = description t['reporter'] = req.authname or 'anonymous' for k, v in attributes.iteritems(): t[k] = v t.insert() if notify: try: tn = TicketNotifyEmail(self.env) tn.notify(t, newticket=True) except Exception, e: self.log.exception("Failure sending notification on creation " "of ticket #%s: %s" % (t.id, e)) return t.id def update(self, req, id, comment, attributes = {}, notify=False): """ Update a ticket, returning the new ticket in the same form as getTicket(). """ now = int(time.time()) t = model.Ticket(self.env, id) for k, v in attributes.iteritems(): t[k] = v t.save_changes(req.authname or 'anonymous', comment) if notify: try: tn = TicketNotifyEmail(self.env) tn.notify(t, newticket=False, modtime=now) except Exception, e: self.log.exception("Failure sending notification on change of " "ticket #%s: %s" % (t.id, e)) return self.get(req, t.id) def delete(self, req, id): """ Delete ticket with the given id. """ t = model.Ticket(self.env, id) t.delete() def changeLog(self, req, id, when=0): t = model.Ticket(self.env, id) return t.get_changelog(when) # Use existing documentation from Ticket model changeLog.__doc__ = pydoc.getdoc(model.Ticket.get_changelog) def listAttachments(self, req, ticket): """ Lists attachments for a given ticket. Returns (filename, description, size, time, author) for each attachment.""" for t in Attachment.select(self.env, 'ticket', ticket): yield (t.filename, t.description or '', t.size, t.time, t.author) def getAttachment(self, req, ticket, filename): """ returns the content of an attachment. """ attachment = Attachment(self.env, 'ticket', ticket, filename) return xmlrpclib.Binary(attachment.open().read()) def putAttachment(self, req, ticket, filename, description, data, replace=True): """ Add an attachment, optionally (and defaulting to) overwriting an existing one. Returns filename.""" if not model.Ticket(self.env, ticket).exists: raise TracError, 'Ticket "%s" does not exist' % ticket if replace: try: attachment = Attachment(self.env, 'ticket', ticket, filename) attachment.delete() except TracError: pass attachment = Attachment(self.env, 'ticket', ticket) attachment.author = req.authname or 'anonymous' attachment.description = description attachment.insert(filename, StringIO(data.data), len(data.data)) return attachment.filename def deleteAttachment(self, req, ticket, filename): """ Delete an attachment. """ if not model.Ticket(self.env, ticket).exists: raise TracError('Ticket "%s" does not exists' % ticket) attachment = Attachment(self.env, 'ticket', ticket, filename) attachment.delete() return True def getTicketFields(self, req): """ Return a list of all ticket fields fields. """ return TicketSystem(self.env).get_ticket_fields() def ticketModelFactory(cls, cls_attributes): """ Return a class which exports an interface to trac.ticket.model.. """ class TicketModelImpl(Component): implements(IXMLRPCHandler) def xmlrpc_namespace(self): return 'ticket.' + cls.__name__.lower() def xmlrpc_methods(self): yield ('TICKET_VIEW', ((list,),), self.getAll) yield ('TICKET_VIEW', ((dict, str),), self.get) yield ('TICKET_ADMIN', ((None, str,),), self.delete) yield ('TICKET_ADMIN', ((None, str, dict),), self.create) yield ('TICKET_ADMIN', ((None, str, dict),), self.update) def getAll(self, req): for i in cls.select(self.env): yield i.name getAll.__doc__ = """ Get a list of all ticket %s names. """ % cls.__name__.lower() def get(self, req, name): i = cls(self.env, name) attributes= {} for k, default in cls_attributes.iteritems(): v = getattr(i, k) if v is None: v = default attributes[k] = v return attributes get.__doc__ = """ Get a ticket %s. """ % cls.__name__.lower() def delete(self, req, name): cls(self.env, name).delete() delete.__doc__ = """ Delete a ticket %s """ % cls.__name__.lower() def create(self, req, name, attributes): i = cls(self.env) i.name = name for k, v in attributes.iteritems(): setattr(i, k, v) i.insert(); create.__doc__ = """ Create a new ticket %s with the given attributes. """ % cls.__name__.lower() def update(self, req, name, attributes): self._updateHelper(name, attributes).update() update.__doc__ = """ Update ticket %s with the given attributes. """ % cls.__name__.lower() def _updateHelper(self, name, attributes): i = cls(self.env, name) for k, v in attributes.iteritems(): setattr(i, k, v) return i TicketModelImpl.__doc__ = """ Interface to ticket %s objects. """ % cls.__name__.lower() TicketModelImpl.__name__ = '%sRPC' % cls.__name__ return TicketModelImpl def ticketEnumFactory(cls): """ Return a class which exports an interface to one of the Trac ticket abstract enum types. """ class AbstractEnumImpl(Component): implements(IXMLRPCHandler) def xmlrpc_namespace(self): return 'ticket.' + cls.__name__.lower() def xmlrpc_methods(self): yield ('TICKET_VIEW', ((list,),), self.getAll) yield ('TICKET_VIEW', ((str, str),), self.get) yield ('TICKET_ADMIN', ((None, str,),), self.delete) yield ('TICKET_ADMIN', ((None, str, str),), self.create) yield ('TICKET_ADMIN', ((None, str, str),), self.update) def getAll(self, req): for i in cls.select(self.env): yield i.name getAll.__doc__ = """ Get a list of all ticket %s names. """ % cls.__name__.lower() def get(self, req, name): i = cls(self.env, name) return i.value get.__doc__ = """ Get a ticket %s. """ % cls.__name__.lower() def delete(self, req, name): cls(self.env, name).delete() delete.__doc__ = """ Delete a ticket %s """ % cls.__name__.lower() def create(self, req, name, value): i = cls(self.env) i.name = name i.value = value i.insert() create.__doc__ = """ Create a new ticket %s with the given value. """ % cls.__name__.lower() def update(self, req, name, value): self._updateHelper(name, value).update() update.__doc__ = """ Update ticket %s with the given value. """ % cls.__name__.lower() def _updateHelper(self, name, value): i = cls(self.env, name) i.value = value return i AbstractEnumImpl.__doc__ = """ Interface to ticket %s. """ % cls.__name__.lower() AbstractEnumImpl.__name__ = '%sRPC' % cls.__name__ return AbstractEnumImpl ticketModelFactory(model.Component, {'name': '', 'owner': '', 'description': ''}) ticketModelFactory(model.Version, {'name': '', 'time': 0, 'description': ''}) ticketModelFactory(model.Milestone, {'name': '', 'due': 0, 'completed': 0, 'description': ''}) ticketEnumFactory(model.Type) ticketEnumFactory(model.Status) ticketEnumFactory(model.Resolution) ticketEnumFactory(model.Priority) ticketEnumFactory(model.Severity) PKLBK6a!!tracrpc/api.pyfrom trac.core import * from trac.perm import IPermissionRequestor import inspect import types import xmlrpclib try: set = set except: from sets import Set as set RPC_TYPES = {int: 'int', bool: 'boolean', str: 'string', float: 'double', xmlrpclib.DateTime: 'dateTime.iso8601', xmlrpclib.Binary: 'base64', list: 'array', dict: 'struct', None : 'int'} def expose_rpc(permission, return_type, *arg_types): """ Decorator for exposing a method as an RPC call with the given signature. """ def decorator(func): if not hasattr(func, '_xmlrpc_signatures'): func._xmlrpc_signatures = [] func._xml_rpc_permission = permission func._xmlrpc_signatures.append((return_type,) + tuple(arg_types)) return func return decorator class IXMLRPCHandler(Interface): def xmlrpc_namespace(): """ Provide the namespace in which a set of methods lives. This can be overridden if the 'name' element is provided by xmlrpc_methods(). """ def xmlrpc_methods(): """ Return an iterator of (permission, signatures, callable[, name]), where callable is exposed via XML-RPC if the authenticated user has the appropriate permission. The callable itself can be a method or a normal method. The first argument passed will always be a request object. The XMLRPCSystem performs some extra magic to remove the "self" and "req" arguments when listing the available methods. Signatures is a list of XML-RPC introspection signatures for this method. Each signature is a tuple consisting of the return type followed by argument types. """ class AbstractRPCHandler(Component): implements(IXMLRPCHandler) abstract = True def _init_methods(self): import inspect self._rpc_methods = [] for name, val in inspect.getmembers(self): if hasattr(val, '_xmlrpc_signatures'): self._rpc_methods.append((val._xml_rpc_permission, val._xmlrpc_signatures, val, name)) def xmlrpc_methods(self): if not hasattr(self, '_rpc_methods'): self._init_methods() return self._rpc_methods class Method(object): """ Represents an XML-RPC exposed method. """ def __init__(self, provider, permission, signatures, callable, name = None): """ Accept a signature in the form returned by xmlrpc_methods. """ import pydoc self.permission = permission self.callable = callable self.rpc_signatures = signatures self.description = pydoc.getdoc(callable) if name is None: self.name = provider.xmlrpc_namespace() + '.' + callable.__name__ else: self.name = provider.xmlrpc_namespace() + '.' + name self.namespace = provider.xmlrpc_namespace() self.namespace_description = pydoc.getdoc(provider) def __call__(self, req, args): req.perm.assert_permission(self.permission) result = self.callable(req, *args) # If result is null, return a zero if result is None: result = 0 elif isinstance(result, dict): pass elif not isinstance(result, basestring): # Try and convert result to a list try: result = [i for i in result] except TypeError: pass return (result,) def _get_signature(self): """ Return the signature of this method. """ if hasattr(self, '_signature'): return self._signature fullargspec = inspect.getargspec(self.callable) argspec = fullargspec[0] assert argspec[0:2] == ['self', 'req'] or argspec[0] == 'req', \ 'Invalid argspec %s for %s' % (argspec, self.name) while argspec and (argspec[0] in ('self', 'req')): argspec.pop(0) argspec.reverse() defaults = fullargspec[3] if not defaults: defaults = [] else: defaults = list(defaults) args = [] sig = [] for sigcand in self.xmlrpc_signatures(): if len(sig) < len(sigcand): sig = sigcand sig = list(sig) for arg in argspec: if defaults: value = defaults.pop() if type(value) is str: if '"' in value: value = "'%s'" % value else: value = '"%s"' % value arg += '=%s' % value args.insert(0, RPC_TYPES[sig.pop()] + ' ' + arg) self._signature = '%s %s(%s)' % (RPC_TYPES[sig.pop()], self.name, ', '.join(args)) return self._signature signature = property(_get_signature) def xmlrpc_signatures(self): """ Signature as an XML-RPC 'signature'. """ return self.rpc_signatures class XMLRPCSystem(Component): """ Core of the XML-RPC system. """ implements(IPermissionRequestor, IXMLRPCHandler) method_handlers = ExtensionPoint(IXMLRPCHandler) # IPermissionRequestor methods def get_permission_actions(self): yield 'XML_RPC' # IXMLRPCHandler methods def xmlrpc_namespace(self): return 'system' def xmlrpc_methods(self): yield ('XML_RPC', ((list, list),), self.multicall) yield ('XML_RPC', ((list,),), self.listMethods) yield ('XML_RPC', ((str, str),), self.methodHelp) yield ('XML_RPC', ((list, str),), self.methodSignature) yield ('XML_RPC', ((list,),), self.getAPIVersion) def get_method(self, method): """ Get an RPC signature by full name. """ for provider in self.method_handlers: for candidate in provider.xmlrpc_methods(): #self.env.log.debug(candidate) p = Method(provider, *candidate) if p.name == method: return p raise xmlrpclib.Fault(1, 'XML-RPC method "%s" not found' % method) # Exported methods def all_methods(self, req): """ List all methods exposed via XML-RPC. Returns a list of Method objects. """ for provider in self.method_handlers: for candidate in provider.xmlrpc_methods(): # Expand all fields of method description c = Method(provider, *candidate) if req.perm.has_permission(c.permission): yield c def multicall(self, req, signatures): """ Takes an array of XML-RPC calls encoded as structs of the form (in a Pythonish notation here): {'methodName': string, 'params': array} """ for signature in signatures: try: yield self.get_method(signature['methodName'])(req, signature['params']) except xmlrpclib.Fault, e: yield e except Exception, e: yield xmlrpclib.Fault(2, "'%s' while executing '%s()'" % (str(e), signature['methodName'])) def listMethods(self, req): """ This method returns a list of strings, one for each (non-system) method supported by the XML-RPC server. """ for method in self.all_methods(req): yield method.name def methodHelp(self, req, method): """ This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns a documentation string describing the use of that method. If no such string is available, an empty string is returned. The documentation string may contain HTML markup. """ p = self.get_method(method) req.perm.assert_permission(p.permission) return '\n'.join((p.signature, '', p.description)) def methodSignature(self, req, method): """ This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is the return type of the method, the rest are parameters. """ p = self.get_method(method) req.perm.assert_permission(p.permission) return [','.join([RPC_TYPES[x] for x in sig]) for sig in p.xmlrpc_signatures()] def getAPIVersion(self, req): """ Returns a list with two elements. First element is the major version number, second is the minor. Changes to the major version indicate API breaking changes, while minor version changes are simple additions, bug fixes, etc. """ return [0, 2] PK68X9E9Etracrpc/ticket.pyo; Ec@sdklZdkTdklZlZdklZdki i Z dk i i Z dk lZdklZdkZdkZdkZdklZdefd YZd Zd Zee ihd d <dd <dd <ee ihd d <dd<dd <ee ihd d <dd<dd<dd <ee iee iee iee iee idS((s Attachment(s*(sIXMLRPCHandlers expose_rpc(s to_timestampN(s TicketSystem(sTicketNotifyEmail(sStringIOs TicketRPCcBstZdZeedZdZddZdZdZ dZ he dZ he d Z d Zd d Zeieiie_d ZdZedZdZdZRS(s* An interface to Trac's ticketing system. cCsdSdS(Nsticket((sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_namespacesccsdtfttff|ifVdttiff|ifVdttff|ifVdttff|i fVdtttftttt ftttt t ff|i fVdtttftttt ftttt t ff|i fVdttff|ifVdt tft ttff|ifVdttff|ifVdtittff|ifVdtttttit ftttttiff|ifVdt ttff|ifVdtff|ifVdS(Ns TICKET_VIEWs TICKET_CREATEs TICKET_APPENDs TICKET_ADMIN(slistsstrsselfsquerys xmlrpclibsDateTimesgetRecentChangessintsgetAvailableActionssgetsdictsboolscreatesupdatesNonesdeletes changeLogslistAttachmentssBinarys getAttachments putAttachmentsdeleteAttachmentsgetTicketFields(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_methodss==%=sstatus!=closedcCsQtii|i|}g}x(|i|D]}|i |dq.W|SdS(s: Perform a ticket query, returning a list of ticket ID's. sidN( squerysQuerys from_stringsselfsenvsqstrsqsoutsexecutesreqstsappend(sselfsreqsqstrsqstsout((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysquery+scCspt|}|ii}|i}|id|fg}x%|D]}|i t |dqGW|SdS(sCReturns a list of IDs of tickets that have changed since timestamp.s,SELECT id FROM ticket WHERE changetime >= %siN( s to_timestampssincesselfsenvs get_db_cnxsdbscursorsexecutesresultsrowsappendsint(sselfsreqssincesdbscursorsresultsrow((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetRecentChanges3s    cCs;t|i}ti|i|}|i||i SdS(s8Returns the actions that can be performed on the ticket.N( s TicketSystemsselfsenvs ticketSystemsmodelsTicketsidstsget_available_actionssreqsperm(sselfsreqsids ticketSystemst((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetAvailableActions?scCs5ti|i|}|i|i|i|ifSdS(sG Fetch a ticket. Returns [id, time_created, time_changed, attributes]. N( smodelsTicketsselfsenvsidsts time_createds time_changedsvalues(sselfsreqsidst((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetEsc Csti|i} d| d<|| d<|| d<|ipd| d. sTicketModelImplcstZeedZdZdZdiie_ dZ diie _ dZ diie _ d Z d iie _ d Z d iie _ d ZRS(NcsdiiSdS(Nsticket.(sclss__name__slower(sself(scls(s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_namespacesccsdtff|ifVdttff|ifVdttff|ifVdtttff|ifVdtttff|i fVdS(Ns TICKET_VIEWs TICKET_ADMIN( slistsselfsgetAllsdictsstrsgetsNonesdeletescreatesupdate(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysxmlrpc_methodss c#s(x!i|iD] }|iVqWdS(N(sclssselectsselfsenvsisname(sselfsreqsi(scls(s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/ticket.pysgetAllss$ Get a list of all ticket %s names. csm|i|}h}xJiD]<\}}t ||}|t jo |}n|||1 1 tracrpc/search.pyc; Ec@s_dkTdklZdklZy eZWndklZnXde fdYZ dS((s*(sIXMLRPCHandler(s ISearchSource(sSets SearchRPCcBsKtZdZeeeeZdZdZ dZ gdZ RS(s Search Trac. cCsdSdS(Nssearch((sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysxmlrpc_namespacesccs?dtff|ifVdttftttff|ifVdS(Ns SEARCH_VIEW(slistsselfsgetSearchFilterssstrs performSearch(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysxmlrpc_methodssccs6x/|iD]$}x|i|D] }|Vq Wq WdS(sb Retrieve a list of search filters with each element in the form (name, description). N(sselfssearch_sourcesssourcesget_search_filterssreqsfilter(sselfsreqsfilterssource((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysgetSearchFilterss  c Cssdkl}||}t|} g} x$|iD]}| |i |7} q5Wgi }| D])}|d| jo||dq`q`~}| o/gi }| D]}||dq~}n|iiid|g}x|iD]w}xn|i|||D]W} tt| } |i di|iiddd!| dgt| dq WqW|SdS(s Perform a search using the given filters. Defaults to all if not provided. Results are returned as a list of tuples in the form (href, title, date, author, excerpt).(s search_termsisSearching with %ss/iiN(s trac.Searchs search_termssqueryssetsfiltersschosen_filterssavailable_filterssselfssearch_sourcesssourcesget_search_filterssreqsappends_[1]sfsenvslogsdebugsresultssget_search_resultssresultsmapsunicodesjoinsbase_urlssplitslist( sselfsreqsquerysfilterssfs search_termssresultss_[1]ssourceschosen_filterssresultsavailable_filters((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys performSearch s(    @/ J( s__name__s __module__s__doc__s implementssIXMLRPCHandlersExtensionPoints ISearchSourcessearch_sourcessxmlrpc_namespacesxmlrpc_methodssgetSearchFilterss performSearch(((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys SearchRPC s      N( s trac.cores tracrpc.apisIXMLRPCHandlers trac.Searchs ISearchSourcessetsassetssSets Components SearchRPC(sassetsIXMLRPCHandlers ISearchSources SearchRPC((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys?s   PK68E">1 1 tracrpc/search.pyo; Ec@s_dkTdklZdklZy eZWndklZnXde fdYZ dS((s*(sIXMLRPCHandler(s ISearchSource(sSets SearchRPCcBsKtZdZeeeeZdZdZ dZ gdZ RS(s Search Trac. cCsdSdS(Nssearch((sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysxmlrpc_namespacesccs?dtff|ifVdttftttff|ifVdS(Ns SEARCH_VIEW(slistsselfsgetSearchFilterssstrs performSearch(sself((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysxmlrpc_methodssccs6x/|iD]$}x|i|D] }|Vq Wq WdS(sb Retrieve a list of search filters with each element in the form (name, description). N(sselfssearch_sourcesssourcesget_search_filterssreqsfilter(sselfsreqsfilterssource((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pysgetSearchFilterss  c Cssdkl}||}t|} g} x$|iD]}| |i |7} q5Wgi }| D])}|d| jo||dq`q`~}| o/gi }| D]}||dq~}n|iiid|g}x|iD]w}xn|i|||D]W} tt| } |i di|iiddd!| dgt| dq WqW|SdS(s Perform a search using the given filters. Defaults to all if not provided. Results are returned as a list of tuples in the form (href, title, date, author, excerpt).(s search_termsisSearching with %ss/iiN(s trac.Searchs search_termssqueryssetsfiltersschosen_filterssavailable_filterssselfssearch_sourcesssourcesget_search_filterssreqsappends_[1]sfsenvslogsdebugsresultssget_search_resultssresultsmapsunicodesjoinsbase_urlssplitslist( sselfsreqsquerysfilterssfs search_termssresultss_[1]ssourceschosen_filterssresultsavailable_filters((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys performSearch s(    @/ J( s__name__s __module__s__doc__s implementssIXMLRPCHandlersExtensionPoints ISearchSourcessearch_sourcessxmlrpc_namespacesxmlrpc_methodssgetSearchFilterss performSearch(((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys SearchRPC s      N( s trac.cores tracrpc.apisIXMLRPCHandlers trac.Searchs ISearchSourcessetsassetssSets Components SearchRPC(sassetsIXMLRPCHandlers ISearchSources SearchRPC((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/search.pys?s   PK683l1o7171tracrpc/api.pyo; Ec@sdkTdklZdkZdkZdkZy eZWndklZnXhe d<e d<e d<e d<ei d<eid <ed <ed <ed}|di gi}|D]}|t|qS~q6~SdS(s- This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is the return type of the method, the rest are parameters. s,N(sselfs get_methodsmethodspsreqspermsassert_permissions permissionsappends_[1]sxmlrpc_signaturesssigsjoins_[2]sxs RPC_TYPES(sselfsreqsmethods_[1]spssigsxs_[2]((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pysmethodSignaturescCsddgSdS(s Returns a list with two elements. First element is the major version number, second is the minor. Changes to the major version indicate API breaking changes, while minor version changes are simple additions, bug fixes, etc. iiN((sselfsreq((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys getAPIVersions(s__name__s __module__s__doc__s implementssIPermissionRequestorsIXMLRPCHandlersExtensionPointsmethod_handlerssget_permission_actionssxmlrpc_namespacesxmlrpc_methodss get_methods all_methodss multicalls listMethodss methodHelpsmethodSignatures getAPIVersion(((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys XMLRPCSystems         (s trac.cores trac.permsIPermissionRequestorsinspectstypess xmlrpclibssetssetssSetsintsboolsstrsfloatsDateTimesBinaryslistsdictsNones RPC_TYPESs expose_rpcs InterfacesIXMLRPCHandlers ComponentsAbstractRPCHandlersobjectsMethods XMLRPCSystem( ssets XMLRPCSystemsIPermissionRequestorsinspects xmlrpclibs expose_rpcsAbstractRPCHandlers RPC_TYPESsIXMLRPCHandlersMethodstypes((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys?s     ] JPK68 ?*?*tracrpc/wiki.pyo; Ec@sydklZWn ej odklZnXdkZdkZdkTdklZdkl Z dk l Z dk l Z dklZdklZlZd klZd efd YZdS( (sStringION(s*(sIPermissionRequestor(s WikiSystem(sWikiPage(s wiki_to_html(s Attachment(sIXMLRPCHandlers expose_rpc(s to_timestampsWikiRPCcBstZdZeedZdZdZdZdZ dZ e dZ e dZ d Ze d Zd Zd Zd ZdZedZdZdZdZRS(s] Implementation of the [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API]. cCst|i|_dS(N(s WikiSystemsselfsenvswiki(sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys__init__scCsdSdS(Nswiki((sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysxmlrpc_namespacesccsdttiff|ifVdtff|ifVdttftttff|ifVdtttff|idfVdttftttff|i fVdttftttff|i dfVdt ff|i fVdttftttff|i fVdtttff|i dfVdt tttff|ifVdt tff|ifVdtitff|ifVdt ttiff|ifVdt ttttift ttttit ff|ifVdt tff|ifVdt tff|ifVdttff|ifVdS(Ns WIKI_VIEWsgetPageVersionsgetPageHTMLVersionsgetPageInfoVersions WIKI_CREATEs WIKI_MODIFYs WIKI_DELETE(sdicts xmlrpclibsDateTimesselfsgetRecentChangessintsgetRPCVersionSupportedsstrsgetPages getPageHTMLslists getAllPagess getPageInfosboolsputPageslistAttachmentssBinarys getAttachments putAttachmentsputAttachmentExsdeleteAttachments listLinkss wikiToHtml(sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysxmlrpc_methodss"%%(%=c Cs8td|dtit|d|dt|SdS(Nsnames lastModifiedsauthorsversion(sdictsnames xmlrpclibsDateTimesintstimesauthorsversion(sselfsnamestimesauthorsversion((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys _page_info1sc Cst|}|ii}|i}|id|fg}x9|D]1\}} }}|i |i|| ||qGW|SdS(s+ Get list of changed pages since timestamp shSELECT name, max(time), author, version FROM wiki WHERE time >= %s GROUP BY name ORDER BY max(time) DESCN(s to_timestampssincesselfsenvs get_db_cnxsdbscursorsexecutesresultsnamestimesauthorsversionsappends _page_info( sselfsreqssincesnamesauthorsdbscursorsversionsresultstime((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetRecentChanges5s    #cCsdSdS(s. Returns 2 with this version of the Trac API. iN((sselfsreq((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetRPCVersionSupportedAscCsit|i||}|io |iSn<d|}|t j o|d|7}nt i d|dS(s0 Get the raw Wiki text of page, latest version. sWiki page "%s" does not exists at version %siN( sWikiPagesselfsenvspagenamesversionspagesexistsstextsmsgsNones xmlrpclibsFault(sselfsreqspagenamesversionsmsgspage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetPageEs    cCs<|i|||}t||i|dd}d|SdS(s/ Return page in rendered HTML, latest version. sabsurlsis%sN( sselfsgetPagesreqspagenamesversionstexts wiki_to_htmlsenvshtml(sselfsreqspagenamesversionstextshtml((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getPageHTMLPscCst|iiSdS(sH Returns a list of all pages. The result is an array of utf8 pagenames. N(slistsselfswikis get_pages(sselfsreq((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getAllPagesVscCs]t|i||}|io:|ii}|i |i |d|d|iSndS(s+ Returns information about the given page. iiN( sWikiPagesselfsenvspagenamesversionspagesexistss get_historysnexts last_updates _page_infosname(sselfsreqspagenamesversions last_updatespage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getPageInfoZs  cCst|i|}|io|iidn0|i o|iidn|iid||_ |ii do$|idodpd|_n|i|id|i|id|itSd S( s! writes the content of the page. s WIKI_ADMINs WIKI_CREATEs WIKI_MODIFYsreadonlyiisauthorscommentN(sWikiPagesselfsenvspagenamespagesreadonlysreqspermsassert_permissionsexistsscontentstextshas_permissions attributessgetssavesauthnames remote_addrsTrue(sselfsreqspagenamescontents attributesspage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysputPagebs   $  cCsFgi}ti|id|D]}||d|iq ~SdS(s$ Lists attachments on a given page. swikis/N( sappends_[1]s Attachmentsselectsselfsenvspagenamesasfilename(sselfsreqspagenamesas_[1]((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pyslistAttachmentsuscCsJti|\}}t|id||}t i |i i SdS(s' returns the content of an attachment. swikiN( s posixpathssplitspathspagenamesfilenames Attachmentsselfsenvs attachments xmlrpclibsBinarysopensread(sselfsreqspathsfilenames attachmentspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getAttachmentyscCs6ti|\}}|i|||t|t SdS(s (over)writes an attachment. Returns True if successful. This method is compatible with WikiRPC. `putAttachmentEx` has a more extensive set of (Trac-specific) features. N( s posixpathssplitspathspagenamesfilenamesselfsputAttachmentExsreqsNonesdatasTrue(sselfsreqspathsdatasfilenamespagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys putAttachmentscCst|i|i otd|n|o@y&t|id||}|i Wqotj oqoXnt|id|}|i pd|_ ||_|i|t|it|i|iSdS(s Attach a file to a Wiki page. Returns the (possibly transformed) filename of the attachment. Use this method if you don't care about WikiRPC compatibility. sWiki page "%s" does not existswikis anonymousN(sWikiPagesselfsenvspagenamesexistss TracErrorsreplaces Attachmentsfilenames attachmentsdeletesreqsauthnamesauthors descriptionsinsertsStringIOsdataslen(sselfsreqspagenamesfilenames descriptionsdatasreplaces attachment((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysputAttachmentExs  %cCsgti|\}}t|i|i ot d|nt |id||}|i t SdS(s Delete an attachment. sWiki page "%s" does not existswikiN(s posixpathssplitspathspagenamesfilenamesWikiPagesselfsenvsexistss TracErrors Attachments attachmentsdeletesTrue(sselfsreqspathsfilenames attachmentspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysdeleteAttachments cCsgSdS(s ''Not implemented'' N((sselfsreqspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys listLinksscCs#tt||i|ddSdS(s% Render arbitrary Wiki text as HTML. sabsurlsiN(sunicodes wiki_to_htmlstextsselfsenvsreq(sselfsreqstext((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys wikiToHtmls(s__name__s __module__s__doc__s implementssIXMLRPCHandlers__init__sxmlrpc_namespacesxmlrpc_methodss _page_infosgetRecentChangessgetRPCVersionSupportedsNonesgetPages getPageHTMLs getAllPagess getPageInfosputPageslistAttachmentss getAttachments putAttachmentsTruesputAttachmentExsdeleteAttachments listLinkss wikiToHtml(((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysWikiRPCs(               (s cStringIOsStringIOs ImportErrors xmlrpclibs posixpaths trac.cores trac.permsIPermissionRequestors trac.wiki.apis WikiSystemstrac.wiki.modelsWikiPagestrac.wiki.formatters wiki_to_htmlstrac.attachments Attachments tracrpc.apisIXMLRPCHandlers expose_rpcs tracrpc.utils to_timestamps ComponentsWikiRPC( s expose_rpcs posixpathsStringIOs wiki_to_htmls xmlrpclibsIPermissionRequestors to_timestamps AttachmentsIXMLRPCHandlersWikiRPCs WikiSystemsWikiPage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys?s        PK68 ?*?*tracrpc/wiki.pyc; Ec@sydklZWn ej odklZnXdkZdkZdkTdklZdkl Z dk l Z dk l Z dklZdklZlZd klZd efd YZdS( (sStringION(s*(sIPermissionRequestor(s WikiSystem(sWikiPage(s wiki_to_html(s Attachment(sIXMLRPCHandlers expose_rpc(s to_timestampsWikiRPCcBstZdZeedZdZdZdZdZ dZ e dZ e dZ d Ze d Zd Zd Zd ZdZedZdZdZdZRS(s] Implementation of the [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API]. cCst|i|_dS(N(s WikiSystemsselfsenvswiki(sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys__init__scCsdSdS(Nswiki((sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysxmlrpc_namespacesccsdttiff|ifVdtff|ifVdttftttff|ifVdtttff|idfVdttftttff|i fVdttftttff|i dfVdt ff|i fVdttftttff|i fVdtttff|i dfVdt tttff|ifVdt tff|ifVdtitff|ifVdt ttiff|ifVdt ttttift ttttit ff|ifVdt tff|ifVdt tff|ifVdttff|ifVdS(Ns WIKI_VIEWsgetPageVersionsgetPageHTMLVersionsgetPageInfoVersions WIKI_CREATEs WIKI_MODIFYs WIKI_DELETE(sdicts xmlrpclibsDateTimesselfsgetRecentChangessintsgetRPCVersionSupportedsstrsgetPages getPageHTMLslists getAllPagess getPageInfosboolsputPageslistAttachmentssBinarys getAttachments putAttachmentsputAttachmentExsdeleteAttachments listLinkss wikiToHtml(sself((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysxmlrpc_methodss"%%(%=c Cs8td|dtit|d|dt|SdS(Nsnames lastModifiedsauthorsversion(sdictsnames xmlrpclibsDateTimesintstimesauthorsversion(sselfsnamestimesauthorsversion((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys _page_info1sc Cst|}|ii}|i}|id|fg}x9|D]1\}} }}|i |i|| ||qGW|SdS(s+ Get list of changed pages since timestamp shSELECT name, max(time), author, version FROM wiki WHERE time >= %s GROUP BY name ORDER BY max(time) DESCN(s to_timestampssincesselfsenvs get_db_cnxsdbscursorsexecutesresultsnamestimesauthorsversionsappends _page_info( sselfsreqssincesnamesauthorsdbscursorsversionsresultstime((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetRecentChanges5s    #cCsdSdS(s. Returns 2 with this version of the Trac API. iN((sselfsreq((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetRPCVersionSupportedAscCsit|i||}|io |iSn<d|}|t j o|d|7}nt i d|dS(s0 Get the raw Wiki text of page, latest version. sWiki page "%s" does not exists at version %siN( sWikiPagesselfsenvspagenamesversionspagesexistsstextsmsgsNones xmlrpclibsFault(sselfsreqspagenamesversionsmsgspage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysgetPageEs    cCs<|i|||}t||i|dd}d|SdS(s/ Return page in rendered HTML, latest version. sabsurlsis%sN( sselfsgetPagesreqspagenamesversionstexts wiki_to_htmlsenvshtml(sselfsreqspagenamesversionstextshtml((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getPageHTMLPscCst|iiSdS(sH Returns a list of all pages. The result is an array of utf8 pagenames. N(slistsselfswikis get_pages(sselfsreq((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getAllPagesVscCs]t|i||}|io:|ii}|i |i |d|d|iSndS(s+ Returns information about the given page. iiN( sWikiPagesselfsenvspagenamesversionspagesexistss get_historysnexts last_updates _page_infosname(sselfsreqspagenamesversions last_updatespage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getPageInfoZs  cCst|i|}|io|iidn0|i o|iidn|iid||_ |ii do$|idodpd|_n|i|id|i|id|itSd S( s! writes the content of the page. s WIKI_ADMINs WIKI_CREATEs WIKI_MODIFYsreadonlyiisauthorscommentN(sWikiPagesselfsenvspagenamespagesreadonlysreqspermsassert_permissionsexistsscontentstextshas_permissions attributessgetssavesauthnames remote_addrsTrue(sselfsreqspagenamescontents attributesspage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysputPagebs   $  cCsFgi}ti|id|D]}||d|iq ~SdS(s$ Lists attachments on a given page. swikis/N( sappends_[1]s Attachmentsselectsselfsenvspagenamesasfilename(sselfsreqspagenamesas_[1]((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pyslistAttachmentsuscCsJti|\}}t|id||}t i |i i SdS(s' returns the content of an attachment. swikiN( s posixpathssplitspathspagenamesfilenames Attachmentsselfsenvs attachments xmlrpclibsBinarysopensread(sselfsreqspathsfilenames attachmentspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys getAttachmentyscCs6ti|\}}|i|||t|t SdS(s (over)writes an attachment. Returns True if successful. This method is compatible with WikiRPC. `putAttachmentEx` has a more extensive set of (Trac-specific) features. N( s posixpathssplitspathspagenamesfilenamesselfsputAttachmentExsreqsNonesdatasTrue(sselfsreqspathsdatasfilenamespagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys putAttachmentscCst|i|i otd|n|o@y&t|id||}|i Wqotj oqoXnt|id|}|i pd|_ ||_|i|t|it|i|iSdS(s Attach a file to a Wiki page. Returns the (possibly transformed) filename of the attachment. Use this method if you don't care about WikiRPC compatibility. sWiki page "%s" does not existswikis anonymousN(sWikiPagesselfsenvspagenamesexistss TracErrorsreplaces Attachmentsfilenames attachmentsdeletesreqsauthnamesauthors descriptionsinsertsStringIOsdataslen(sselfsreqspagenamesfilenames descriptionsdatasreplaces attachment((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysputAttachmentExs  %cCsgti|\}}t|i|i ot d|nt |id||}|i t SdS(s Delete an attachment. sWiki page "%s" does not existswikiN(s posixpathssplitspathspagenamesfilenamesWikiPagesselfsenvsexistss TracErrors Attachments attachmentsdeletesTrue(sselfsreqspathsfilenames attachmentspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysdeleteAttachments cCsgSdS(s ''Not implemented'' N((sselfsreqspagename((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys listLinksscCs#tt||i|ddSdS(s% Render arbitrary Wiki text as HTML. sabsurlsiN(sunicodes wiki_to_htmlstextsselfsenvsreq(sselfsreqstext((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys wikiToHtmls(s__name__s __module__s__doc__s implementssIXMLRPCHandlers__init__sxmlrpc_namespacesxmlrpc_methodss _page_infosgetRecentChangessgetRPCVersionSupportedsNonesgetPages getPageHTMLs getAllPagess getPageInfosputPageslistAttachmentss getAttachments putAttachmentsTruesputAttachmentExsdeleteAttachments listLinkss wikiToHtml(((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pysWikiRPCs(               (s cStringIOsStringIOs ImportErrors xmlrpclibs posixpaths trac.cores trac.permsIPermissionRequestors trac.wiki.apis WikiSystemstrac.wiki.modelsWikiPagestrac.wiki.formatters wiki_to_htmlstrac.attachments Attachments tracrpc.apisIXMLRPCHandlers expose_rpcs tracrpc.utils to_timestamps ComponentsWikiRPC( s expose_rpcs posixpathsStringIOs wiki_to_htmls xmlrpclibsIPermissionRequestors to_timestamps AttachmentsIXMLRPCHandlersWikiRPCs WikiSystemsWikiPage((s0build/bdist.darwin-8.0.1-x86/egg/tracrpc/wiki.pys?s        PK68Utracrpc/web_ui.pyo; ,YDc@sjdkTdklZdklZlZdklZlZdk l Z dk Z de fdYZ dS((s*(sIRequestHandler(sITemplateProvidersadd_stylesheet(sIXMLRPCHandlers XMLRPCSystem(swiki_to_onelinerNs XMLRPCWebcBsHtZdZeeedZdZdZdZ dZ RS(s Handle XML-RPC calls from HTTP clients, as well as presenting a list of methods available to the currently logged in user. Browsing to /xmlrpc will display this list. cCs|iddfjSdS(Ns /login/xmlrpcs/xmlrpc(sreqs path_info(sselfsreq((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/web_ui.pys match_requestscCsN|id|idd|idt||i|i|dS(Nis Content-Typestext/xmlsContent-Length(sreqs send_responses send_headerslensresponses end_headersswrite(sselfsreqsresponse((s2build/bdist.darwin-8.0.1-x86/egg/tracrpc/web_ui.pys_send_responses   c Cs|iid|id}|tjp d|joTh}x#t|i i |D] } | i i dd}||jo;hdt| i|i <dg<d| i <||:ï11tracrpc/api.pyc; Ec@sdkTdklZdkZdkZdkZy eZWndklZnXhe d<e d<e d<e d<ei d<eid <ed <ed <ed}|di gi}|D]}|t|qS~q6~SdS(s- This method takes one parameter, the name of a method implemented by the XML-RPC server. It returns an array of possible signatures for this method. A signature is an array of types. The first of these types is the return type of the method, the rest are parameters. s,N(sselfs get_methodsmethodspsreqspermsassert_permissions permissionsappends_[1]sxmlrpc_signaturesssigsjoins_[2]sxs RPC_TYPES(sselfsreqsmethods_[1]spssigsxs_[2]((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pysmethodSignaturescCsddgSdS(s Returns a list with two elements. First element is the major version number, second is the minor. Changes to the major version indicate API breaking changes, while minor version changes are simple additions, bug fixes, etc. iiN((sselfsreq((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys getAPIVersions(s__name__s __module__s__doc__s implementssIPermissionRequestorsIXMLRPCHandlersExtensionPointsmethod_handlerssget_permission_actionssxmlrpc_namespacesxmlrpc_methodss get_methods all_methodss multicalls listMethodss methodHelpsmethodSignatures getAPIVersion(((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys XMLRPCSystems         (s trac.cores trac.permsIPermissionRequestorsinspectstypess xmlrpclibssetssetssSetsintsboolsstrsfloatsDateTimesBinaryslistsdictsNones RPC_TYPESs expose_rpcs InterfacesIXMLRPCHandlers ComponentsAbstractRPCHandlersobjectsMethods XMLRPCSystem( ssets XMLRPCSystemsIPermissionRequestorsinspects xmlrpclibs expose_rpcsAbstractRPCHandlers RPC_TYPESsIXMLRPCHandlersMethodstypes((s/build/bdist.darwin-8.0.1-x86/egg/tracrpc/api.pys?s     ] JPK 5pOf tracrpc/web_ui.pyfrom trac.core import * from trac.web.main import IRequestHandler from trac.web.chrome import ITemplateProvider, add_stylesheet from tracrpc.api import IXMLRPCHandler, XMLRPCSystem from trac.wiki.formatter import wiki_to_oneliner import xmlrpclib class XMLRPCWeb(Component): """ Handle XML-RPC calls from HTTP clients, as well as presenting a list of methods available to the currently logged in user. Browsing to /xmlrpc will display this list. """ implements(IRequestHandler, ITemplateProvider) # IRequestHandler methods def match_request(self, req): return req.path_info in ('/login/xmlrpc', '/xmlrpc') def _send_response(self, req, response): req.send_response(200) req.send_header('Content-Type', 'text/xml') req.send_header('Content-Length', len(response)) req.end_headers() req.write(response) def process_request(self, req): # Need at least XML_RPC req.perm.assert_permission('XML_RPC') # Dump RPC functions content_type = req.get_header('Content-Type') if content_type is None or 'text/xml' not in content_type: namespaces = {} for method in XMLRPCSystem(self.env).all_methods(req): namespace = method.namespace.replace('.', '_') if namespace not in namespaces: namespaces[namespace] = { 'description' : wiki_to_oneliner(method.namespace_description, self.env), 'methods' : [], 'namespace' : method.namespace, } try: namespaces[namespace]['methods'].append((method.signature, wiki_to_oneliner(method.description, self.env), method.permission)) except Exception, e: from StringIO import StringIO import traceback out = StringIO() traceback.print_exc(file=out) raise Exception('%s: %s\n%s' % (method.name, str(e), out.getvalue())) add_stylesheet(req, 'common/css/wiki.css') req.hdf['xmlrpc.functions'] = namespaces return 'xmlrpclist.cs', None # Handle XML-RPC call args, method = xmlrpclib.loads(req.read(int(req.get_header('Content-Length')))) try: result = XMLRPCSystem(self.env).get_method(method)(req, args) self._send_response(req, xmlrpclib.dumps(result, methodresponse=True)) except xmlrpclib.Fault, e: self.log.error(e) self._send_response(req, xmlrpclib.dumps(e)) except Exception, e: self.log.error(e) import traceback from StringIO import StringIO out = StringIO() traceback.print_exc(file = out) self.log.error(out.getvalue()) self._send_response(req, xmlrpclib.dumps(xmlrpclib.Fault(2, "'%s' while executing '%s()'" % (str(e), method)))) # ITemplateProvider def get_htdocs_dirs(self): return [] def get_templates_dirs(self): from pkg_resources import resource_filename return [resource_filename(__name__, 'templates')] PK'835tracrpc/search.pyfrom trac.core import * from tracrpc.api import IXMLRPCHandler from trac.Search import ISearchSource try: a = set() except: from sets import Set as set class SearchRPC(Component): """ Search Trac. """ implements(IXMLRPCHandler) search_sources = ExtensionPoint(ISearchSource) # IXMLRPCHandler methods def xmlrpc_namespace(self): return 'search' def xmlrpc_methods(self): yield ('SEARCH_VIEW', ((list,),), self.getSearchFilters) yield ('SEARCH_VIEW', ((list, str), (list, str, list)), self.performSearch) # Others def getSearchFilters(self, req): """ Retrieve a list of search filters with each element in the form (name, description). """ for source in self.search_sources: for filter in source.get_search_filters(req): yield filter def performSearch(self, req, query, filters = []): """ Perform a search using the given filters. Defaults to all if not provided. Results are returned as a list of tuples in the form (href, title, date, author, excerpt).""" from trac.Search import search_terms query = search_terms(query) chosen_filters = set(filters) available_filters = [] for source in self.search_sources: available_filters += source.get_search_filters(req) filters = [f[0] for f in available_filters if f[0] in chosen_filters] if not filters: filters = [f[0] for f in available_filters] self.env.log.debug("Searching with %s" % filters) results = [] for source in self.search_sources: for result in source.get_search_results(req, query, filters): result = map(unicode, result) results.append(['/'.join(req.base_url.split('/')[0:3]) + result[0]] + list(result[1:])) return results PKD5+ atracrpc/wiki.pytry: from cStringIO import StringIO except ImportError: from StringIO import StringIO import xmlrpclib import posixpath from trac.core import * from trac.perm import IPermissionRequestor from trac.wiki.api import WikiSystem from trac.wiki.model import WikiPage from trac.wiki.formatter import wiki_to_html from trac.attachment import Attachment from tracrpc.api import IXMLRPCHandler, expose_rpc from tracrpc.util import to_timestamp class WikiRPC(Component): """ Implementation of the [http://www.jspwiki.org/Wiki.jsp?page=WikiRPCInterface2 WikiRPC API]. """ implements(IXMLRPCHandler) def __init__(self): self.wiki = WikiSystem(self.env) def xmlrpc_namespace(self): return 'wiki' def xmlrpc_methods(self): yield ('WIKI_VIEW', ((dict, xmlrpclib.DateTime),), self.getRecentChanges) yield ('WIKI_VIEW', ((int,),), self.getRPCVersionSupported) yield ('WIKI_VIEW', ((str, str), (str, str, int),), self.getPage) yield ('WIKI_VIEW', ((str, str, int),), self.getPage, 'getPageVersion') yield ('WIKI_VIEW', ((str, str), (str, str, int)), self.getPageHTML) yield ('WIKI_VIEW', ((str, str), (str, str, int)), self.getPageHTML, 'getPageHTMLVersion') yield ('WIKI_VIEW', ((list,),), self.getAllPages) yield ('WIKI_VIEW', ((dict, str), (dict, str, int)), self.getPageInfo) yield ('WIKI_VIEW', ((dict, str, int),), self.getPageInfo, 'getPageInfoVersion') yield ('WIKI_CREATE', ((bool, str, str, dict),), self.putPage) yield ('WIKI_VIEW', ((list, str),), self.listAttachments) yield ('WIKI_VIEW', ((xmlrpclib.Binary, str),), self.getAttachment) yield ('WIKI_MODIFY', ((bool, str, xmlrpclib.Binary),), self.putAttachment) yield ('WIKI_MODIFY', ((bool, str, str, str, xmlrpclib.Binary), (bool, str, str, str, xmlrpclib.Binary, bool)), self.putAttachmentEx) yield ('WIKI_DELETE', ((bool, str),), self.deleteAttachment) yield ('WIKI_VIEW', ((list, str),), self.listLinks) yield ('WIKI_VIEW', ((str, str),), self.wikiToHtml) def _page_info(self, name, time, author, version): return dict(name=name, lastModified=xmlrpclib.DateTime(int(time)), author=author, version=int(version)) def getRecentChanges(self, req, since): """ Get list of changed pages since timestamp """ since = to_timestamp(since) db = self.env.get_db_cnx() cursor = db.cursor() cursor.execute('SELECT name, max(time), author, version FROM wiki' ' WHERE time >= %s GROUP BY name ORDER BY max(time) DESC', (since,)) result = [] for name, time, author, version in cursor: result.append(self._page_info(name, time, author, version)) return result def getRPCVersionSupported(self, req): """ Returns 2 with this version of the Trac API. """ return 2 def getPage(self, req, pagename, version=None): """ Get the raw Wiki text of page, latest version. """ page = WikiPage(self.env, pagename, version) if page.exists: return page.text else: msg = 'Wiki page "%s" does not exist' % pagename if version is not None: msg += ' at version %s' % version raise xmlrpclib.Fault(0, msg) def getPageHTML(self, req, pagename, version=None): """ Return page in rendered HTML, latest version. """ text = self.getPage(req, pagename, version) html = wiki_to_html(text, self.env, req, absurls=1) return '%s' % html def getAllPages(self, req): """ Returns a list of all pages. The result is an array of utf8 pagenames. """ return list(self.wiki.get_pages()) def getPageInfo(self, req, pagename, version=None): """ Returns information about the given page. """ page = WikiPage(self.env, pagename, version) if page.exists: last_update = page.get_history().next() return self._page_info(page.name, last_update[1], last_update[2], page.version) def putPage(self, req, pagename, content, attributes): """ writes the content of the page. """ page = WikiPage(self.env, pagename) if page.readonly: req.perm.assert_permission('WIKI_ADMIN') elif not page.exists: req.perm.assert_permission('WIKI_CREATE') else: req.perm.assert_permission('WIKI_MODIFY') page.text = content if req.perm.has_permission('WIKI_ADMIN'): page.readonly = attributes.get('readonly') and 1 or 0 page.save(attributes.get('author', req.authname), attributes.get('comment'), req.remote_addr) return True def listAttachments(self, req, pagename): """ Lists attachments on a given page. """ return [pagename + '/' + a.filename for a in Attachment.select(self.env, 'wiki', pagename)] def getAttachment(self, req, path): """ returns the content of an attachment. """ pagename, filename = posixpath.split(path) attachment = Attachment(self.env, 'wiki', pagename, filename) return xmlrpclib.Binary(attachment.open().read()) def putAttachment(self, req, path, data): """ (over)writes an attachment. Returns True if successful. This method is compatible with WikiRPC. `putAttachmentEx` has a more extensive set of (Trac-specific) features. """ pagename, filename = posixpath.split(path) self.putAttachmentEx(req, pagename, filename, None, data) return True def putAttachmentEx(self, req, pagename, filename, description, data, replace=True): """ Attach a file to a Wiki page. Returns the (possibly transformed) filename of the attachment. Use this method if you don't care about WikiRPC compatibility. """ if not WikiPage(self.env, pagename).exists: raise TracError, 'Wiki page "%s" does not exist' % pagename if replace: try: attachment = Attachment(self.env, 'wiki', pagename, filename) attachment.delete() except TracError: pass attachment = Attachment(self.env, 'wiki', pagename) attachment.author = req.authname or 'anonymous' attachment.description = description attachment.insert(filename, StringIO(data.data), len(data.data)) return attachment.filename def deleteAttachment(self, req, path): """ Delete an attachment. """ pagename, filename = posixpath.split(path) if not WikiPage(self.env, pagename).exists: raise TracError, 'Wiki page "%s" does not exist' % pagename attachment = Attachment(self.env, 'wiki', pagename, filename) attachment.delete() return True def listLinks(self, req, pagename): """ ''Not implemented'' """ return [] def wikiToHtml(self, req, text): """ Render arbitrary Wiki text as HTML. """ return unicode(wiki_to_html(text, self.env, req, absurls=1)) PKj5btracrpc/templates/xmlrpclist.cs

XML-RPC exported functions

> -

Function Description Permission required
PK 282EGG-INFO/zip-safe PKۆ68;V%?LLEGG-INFO/SOURCES.txtsetup.py TracXMLRPC.egg-info/PKG-INFO TracXMLRPC.egg-info/SOURCES.txt TracXMLRPC.egg-info/dependency_links.txt TracXMLRPC.egg-info/entry_points.txt TracXMLRPC.egg-info/top_level.txt TracXMLRPC.egg-info/zip-safe tracrpc/__init__.py tracrpc/api.py tracrpc/search.py tracrpc/ticket.py tracrpc/util.py tracrpc/web_ui.py tracrpc/wiki.py PKچ68%%EGG-INFO/entry_points.txt[trac.plugins] TracXMLRPC = tracrpc PKن682EGG-INFO/dependency_links.txt PKن68IEGG-INFO/PKG-INFOMetadata-Version: 1.0 Name: TracXMLRPC Version: 0.1 Summary: XML-RPC interface to Trac Home-page: http://trac-hacks.swapoff.org/wiki/XmlRpcPlugin Author: Alec Thomas Author-email: alec@swapoff.org License: UNKNOWN Description: UNKNOWN Platform: UNKNOWN PKن68^7EGG-INFO/top_level.txttracrpc PK!44btracrpc/__init__.pyPK68X9E9Etracrpc/ticket.pycPKD5&Ftracrpc/util.pyPK68)3Gtracrpc/__init__.pyoPK68UyHtracrpc/web_ui.pycPKLBK6$++Ytracrpc/ticket.pyPKLBK6a!!tracrpc/api.pyPK68X9E9Etracrpc/ticket.pyoPK68E">1 1 mtracrpc/search.pycPK68E">1 1 tracrpc/search.pyoPK683l1o7171/tracrpc/api.pyoPK68 ?*?*7tracrpc/wiki.pyoPK68 ?*?*btracrpc/wiki.pycPK68Umtracrpc/web_ui.pyoPK680 44tracrpc/util.pycPK680 44tracrpc/util.pyoPK68)ztracrpc/__init__.pycPK68>:ï11tracrpc/api.pycPK 5pOf tracrpc/web_ui.pyPK'835~tracrpc/search.pyPKD5+ a=tracrpc/wiki.pyPKj5btracrpc/templates/xmlrpclist.csPK 282 EGG-INFO/zip-safePKۆ68;V%?LLJ EGG-INFO/SOURCES.txtPKچ68%% EGG-INFO/entry_points.txtPKن682$ EGG-INFO/dependency_links.txtPKن68I` EGG-INFO/PKG-INFOPKن68^7EGG-INFO/top_level.txtPK