import os
import kalamar.site
from kalamar.access_point.cache import Cache
from kalamar.access_point.xml.rest import Rest, RestProperty, TITLE
from kalamar.access_point.filesystem import FileSystem

from sitenco import PROJECTS_PATH

page = Rest(
        FileSystem(
            PROJECTS_PATH, r'(.*)/pages/(.*)\.rst', ('project', 'page')),
        [('title', RestProperty(unicode, TITLE))], 'content')
news = Rest(
    FileSystem(
        PROJECTS_PATH, r'(.*)/news/(.*)/(.*)\.rst',
        ('project', 'writer', 'datetime')),
    [('title', RestProperty(unicode, TITLE))], 'content')
tutorial = Cache(
    Rest(
        FileSystem(
            PROJECTS_PATH, r'(.*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
        [('title', RestProperty(unicode, TITLE)),
         ('abstract', RestProperty(unicode, '//topic/paragraph'))], 'content'))
                     
SITE = kalamar.site.Site()
SITE.register('page', page)
SITE.register('news', news)
SITE.register('tutorial', tutorial)

import os
import kalamar.site
from kalamar.access_point.cache import Cache
from kalamar.access_point.xml.rest import Rest, RestProperty, TITLE
from kalamar.access_point.filesystem import FileSystem

from sitenco import PROJECTS_PATH

page = Rest(
        FileSystem(
            PROJECTS_PATH, r'([a-z]*)/pages/(.*)\.rst', ('project', 'page')),
        [('title', RestProperty(unicode, TITLE))], 'content')
news = Rest(
    FileSystem(
        PROJECTS_PATH, r'([a-z]*)/news/(.*)/(.*)\.rst',
        ('project', 'writer', 'datetime')),
    [('title', RestProperty(unicode, TITLE))], 'content')
tutorial = Cache(
    Rest(
        FileSystem(
            PROJECTS_PATH,
            r'([a-z]*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
        [('title', RestProperty(unicode, TITLE)),
         ('abstract', RestProperty(unicode, '//topic/paragraph'))], 'content'))
                     
SITE = kalamar.site.Site()
SITE.register('page', page)
SITE.register('news', news)
SITE.register('tutorial', tutorial)

Use [a-z]* pattern to match project ids
Use [a-z]* pattern to match project ids

  import os
  import kalamar.site
  from kalamar.access_point.cache import Cache
  from kalamar.access_point.xml.rest import Rest, RestProperty, TITLE
  from kalamar.access_point.filesystem import FileSystem
  
  from sitenco import PROJECTS_PATH
  
  page = Rest(
          FileSystem(
-             PROJECTS_PATH, r'(.*)/pages/(.*)\.rst', ('project', 'page')),
+             PROJECTS_PATH, r'([a-z]*)/pages/(.*)\.rst', ('project', 'page')),
          [('title', RestProperty(unicode, TITLE))], 'content')
  news = Rest(
      FileSystem(
-         PROJECTS_PATH, r'(.*)/news/(.*)/(.*)\.rst',
+         PROJECTS_PATH, r'([a-z]*)/news/(.*)/(.*)\.rst',
          ('project', 'writer', 'datetime')),
      [('title', RestProperty(unicode, TITLE))], 'content')
  tutorial = Cache(
      Rest(
          FileSystem(
+             PROJECTS_PATH,
-             PROJECTS_PATH, r'(.*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
+             r'([a-z]*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
          [('title', RestProperty(unicode, TITLE)),
           ('abstract', RestProperty(unicode, '//topic/paragraph'))], 'content'))
                       
  SITE = kalamar.site.Site()
  SITE.register('page', page)
  SITE.register('news', news)
  SITE.register('tutorial', tutorial)
  
Use [a-z]* pattern to match project ids
## Code Before:
import os
import kalamar.site
from kalamar.access_point.cache import Cache
from kalamar.access_point.xml.rest import Rest, RestProperty, TITLE
from kalamar.access_point.filesystem import FileSystem

from sitenco import PROJECTS_PATH

page = Rest(
        FileSystem(
            PROJECTS_PATH, r'(.*)/pages/(.*)\.rst', ('project', 'page')),
        [('title', RestProperty(unicode, TITLE))], 'content')
news = Rest(
    FileSystem(
        PROJECTS_PATH, r'(.*)/news/(.*)/(.*)\.rst',
        ('project', 'writer', 'datetime')),
    [('title', RestProperty(unicode, TITLE))], 'content')
tutorial = Cache(
    Rest(
        FileSystem(
            PROJECTS_PATH, r'(.*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
        [('title', RestProperty(unicode, TITLE)),
         ('abstract', RestProperty(unicode, '//topic/paragraph'))], 'content'))
                     
SITE = kalamar.site.Site()
SITE.register('page', page)
SITE.register('news', news)
SITE.register('tutorial', tutorial)

## Instruction:
Use [a-z]* pattern to match project ids
## Code After:
import os
import kalamar.site
from kalamar.access_point.cache import Cache
from kalamar.access_point.xml.rest import Rest, RestProperty, TITLE
from kalamar.access_point.filesystem import FileSystem

from sitenco import PROJECTS_PATH

page = Rest(
        FileSystem(
            PROJECTS_PATH, r'([a-z]*)/pages/(.*)\.rst', ('project', 'page')),
        [('title', RestProperty(unicode, TITLE))], 'content')
news = Rest(
    FileSystem(
        PROJECTS_PATH, r'([a-z]*)/news/(.*)/(.*)\.rst',
        ('project', 'writer', 'datetime')),
    [('title', RestProperty(unicode, TITLE))], 'content')
tutorial = Cache(
    Rest(
        FileSystem(
            PROJECTS_PATH,
            r'([a-z]*)/tutorials/(.*)\.rst', ('project', 'tutorial')),
        [('title', RestProperty(unicode, TITLE)),
         ('abstract', RestProperty(unicode, '//topic/paragraph'))], 'content'))
                     
SITE = kalamar.site.Site()
SITE.register('page', page)
SITE.register('news', news)
SITE.register('tutorial', tutorial)
