website fixes

This commit is contained in:
Rushabh Mehta 2012-02-06 13:09:08 +01:00
parent e651648b1b
commit cc54fd46bc
4 changed files with 36 additions and 22 deletions

View File

@ -7,7 +7,8 @@ def execute():
add_website_manager()
from webnotes.modules import reload_doc
from webnotes.model import delete_doc
reload_doc('setup', 'doctype', 'item_group')
delete_doc('Website', 'Module Def', 'Website')
reload_doc('website', 'Module Def', 'Website')
reload_doc('website', 'Role', 'Website Manager')
@ -42,16 +43,17 @@ def execute():
def create_home_page():
"""create a dummy home page"""
if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'""")
d = Document('Web Page')
d.title = 'Home'
d.head_section = "<h1>Your Headline</h1>"
d.main_section = "<p>Some introduction about your company</p>"
d.side_section = "<p>Links to other pages</p>"
d.save()
obj = get_obj(doc = d)
obj.validate()
obj.doc.save()
from webnotes.model.code import get_obj
if not webnotes.conn.sql("""select name from `tabWeb Page` where name='home'"""):
d = Document('Web Page')
d.title = 'Home'
d.head_section = "<h1>Your Headline</h1>"
d.main_section = "<p>Some introduction about your company</p>"
d.side_section = "<p>Links to other pages</p>"
d.save()
obj = get_obj(doc = d)
obj.validate()
obj.doc.save()
def add_website_manager():
"""add website manager to system manager"""

View File

@ -236,4 +236,4 @@
'print_hide': 1,
'report_hide': 1
}
]
]

View File

@ -1,3 +1,5 @@
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
@ -24,4 +26,14 @@ class DocType:
website.utils.add_guest_access_to_page(p.name)
self.doc.page_name = p.name
del self.doc.fields['long_description_html']
del self.doc.fields['long_description_html']
self.make_item_group_active()
def make_item_group_active(self):
"""show item group in website"""
if self.doc.published:
from webnotes.model.doc import Document
ig = Document('Item Group', webnotes.conn.get_value('Item', self.doc.item, 'item_group'))
ig.show_in_website = 1
ig.save()

18
wnf.py
View File

@ -68,6 +68,10 @@ def run():
from webnotes.db import Database
import webnotes.modules.patch_handler
# connect
if options.db_name is not None:
webnotes.connect(options.db_name)
# build
if options.build:
import build.project
@ -99,19 +103,11 @@ def run():
os.system('git commit -a -m "%s"' % options.push[2])
os.system('git push %s %s' % (options.push[0], options.push[1]))
# patch
elif options.patch_list:
# clear log
webnotes.modules.patch_handler.log_list = []
# connect to db
if options.db_name is not None:
webnotes.connect(options.db_name)
else:
webnotes.connect()
# run individual patches
for patch in options.patch_list:
webnotes.modules.patch_handler.run_single(\
@ -129,6 +125,10 @@ def run():
elif options.run_latest:
webnotes.modules.patch_handler.run_all()
print '\n'.join(webnotes.modules.patch_handler.log_list)
# print messages
if webnotes.message_log:
print '\n'.join(webnotes.message_log)
if __name__=='__main__':
run()