Пример #1
0
 def _pre_parse_entry(self, load, local_paths, url):
     sthread = SupportThread(url=url,
                             file_path=local_paths[0],
                             pages=len(local_paths),
                             channel=self.channel)
     sthread.save()
     load.entry = sthread
Пример #2
0
 def _pre_parse_entry(self, load, local_paths, url):
     sthread = SupportThread(
             url=url,
             file_path=local_paths[0],
             pages=len(local_paths),
             channel=self.channel
             )
     sthread.save()
     load.entry = sthread
Пример #3
0
def start_thread(title, support_message, channel):
    # This is a thread!

    support_thread = SupportThread(title=title,
                                   first_date=support_message.msg_date,
                                   url=support_message.url,
                                   file_path=support_message.file_path,
                                   channel=channel,
                                   pages=1)
    support_thread.save()
    support_message.index = 0
    support_message.save()
    support_thread.messages.add(support_message)
Пример #4
0
def start_thread(title, support_message, channel):
    # This is a thread!

    support_thread = SupportThread(
            title=title,
            first_date=support_message.msg_date,
            url=support_message.url,
            file_path=support_message.file_path,
            channel=channel,
            pages=1)
    support_thread.save()
    support_message.index = 0
    support_message.save()
    support_thread.messages.add(support_message)
Пример #5
0
    def create_channel(self):
        create_channel_local(self.pname, 'usermail', 'foo', 'url')
        channel = create_channel_db(self.pname, 'user mail', 'usermail',
                'foo', 'foo', 'url')

        thread1 = SupportThread(
                title='HTTP Server Question',
                channel=channel)
        thread1.save()

        thread2 = SupportThread(
                title='Http client question',
                channel=channel)
        thread2.save()

        thread3 = SupportThread(
                title='Random Question',
                channel=channel)
        thread3.save()

        message1 = Message(
                title='HTTP Server Question',
                index=0,
                sthread=thread1
                )
        message1.save()

        message2 = Message(
                title='RE: HTTP Server Question',
                index=1,
                sthread=thread1
                )
        message2.save()

        message3 = Message(
                title='Http client question',
                index=0,
                sthread=thread2
                )
        message3.save()

        message4 = Message(
                title='RE: Http client question',
                index=1,
                sthread=thread2
                )
        message4.save()

        message5 = Message(
                title='Random Question',
                index=0,
                sthread=thread3
                )
        message5.save()

        message6 = Message(
                title='RE: RE: HTTP Server Question',
                index=0,
                sthread=thread1
                )
        message6.save()

        coderef1 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='clazz1',
                source='s',
                kind_hint=self.class_kind,
                local_context=message1,
                global_context=thread1
                )
        coderef1.save()
        self.code_refs.append(coderef1)

        coderef2 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='Enum1',
                source='s',
                kind_hint=self.class_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef2.save()
        self.code_refs.append(coderef2)

        coderef3 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='Disco',
                source='s',
                kind_hint=self.class_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef3.save()
        self.code_refs.append(coderef3)

        coderef4 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='RecodocClient',
                source='s',
                kind_hint=self.class_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef4.save()
        self.code_refs.append(coderef4)

        coderef5 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='foo.RecodocClient',
                source='s',
                kind_hint=self.class_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef5.save()
        self.code_refs.append(coderef5)

        coderef6 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='callMethod1("hello")',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef6.save()
        self.code_refs.append(coderef6)

        coderef7 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='callMethod1("hello", 2)',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef7.save()
        self.code_refs.append(coderef7)

        coderef8 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='callMethod1(p3.Foo, p3.Bar)',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef8.save()
        self.code_refs.append(coderef8)

        coderef9 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='equals()',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef9.save()
        self.code_refs.append(coderef9)

        coderef10 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='list.add(foo)',
                source='s',
                kind_hint=self.class_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef10.save()
        self.code_refs.append(coderef10)

        coderef11 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='list.add(foo)',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                parent_reference=coderef10,
                )
        coderef11.save()
        self.code_refs.append(coderef11)

        coderef12 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='nonexistentmethod',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                parent_reference=coderef10,
                )
        coderef12.save()
        self.code_refs.append(coderef12)

        # Index = 14
        coderef13 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='recodoc.callMethod10(foo)',
                source='s',
                kind_hint=self.class_kind,
                local_context=message5,
                global_context=thread3,
                )
        coderef13.save()
        self.code_refs.append(coderef13)

        # Index = 15
        coderef14 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='recodoc.callMethod10(foo)',
                source='s',
                kind_hint=self.method_kind,
                local_context=message5,
                global_context=thread3,
                parent_reference=coderef13,
                )
        coderef14.save()
        self.code_refs.append(coderef14)

        coderef15 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='getClient2()',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef15.save()
        self.code_refs.append(coderef15)

        # Index = 17
        coderef16 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='method100()',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef16.save()
        self.code_refs.append(coderef16)

        coderef17 = SingleCodeReference(
                project=self.project,
                project_release=self.releasedb,
                content='method200()',
                source='s',
                kind_hint=self.method_kind,
                local_context=message2,
                global_context=thread1,
                )
        coderef17.save()
        self.code_refs.append(coderef17)

        snippet_content = r'''

        @Annotation1
        public class FooBar extends FooBarSuper {
          public void main(String arg) {
            System.out.println();
            RecodocClient obj = new RecodocClient();
            List list = null;
            aFoo.callMethod10();
          }
        '''

        snippet1 = CodeSnippet(
                project=self.project,
                project_release=self.releasedb,
                language='j',
                source='s',
                snippet_text=snippet_content,
                local_context=message3,
                global_context=thread2
                )
        snippet1.save()
        self.code_snippets.append(snippet1)